Beka Westberg
9e5df6216a
Fixed comment ownership. ( #2923 )
...
* Moved comment icons to use a model-based system. The block holds the model of the comment, and the comment icon holds a reference to it.
* Reorganized the setVisible function.
* Changed how xml.js serializes and deserializes comments.
2019-09-20 13:16:07 -07:00
Rachel Fenichel
6f4476c962
Textarea Field, Multiline Block (from acbart) ( #2663 )
...
* Field Textarea, text_multiline block, generators
2019-09-11 17:57:46 -07:00
Neil Fraser
939bbd072b
Lint
2019-08-02 11:00:40 -07:00
Neil Fraser
e77a9b7e81
Change parseFloat() to Number()
...
Number() is a bit less forgiving than parseFloat() and is more likely to generate NaN rather than some random number. An audit of each case shows nowhere that parseFloat()’s features are needed.
2019-08-01 11:36:58 -07:00
Neil Fraser
92c4d6d3a3
Fix colour injection vulnerability.
...
The new validators already solve this problem, but as a second layer of defence, the generators should also be secured. Issue #2637
2019-07-15 16:03:55 -07:00
Neil Fraser
d1a29739d8
Move utilities into own directory.
...
TODO: There are more functions which may be migrated into dom and string.
2019-06-07 10:32:57 -07:00
Neil Fraser
05253d0766
Add prefix/suffix to orphaned value blocks.
...
Also respect suppressPrefixSuffix on loops when generating prefix/suffix with continue/break blocks.
2019-05-17 15:04:39 -07:00
Neil Fraser
ed0b5adcd1
Wrong language.
2019-05-17 15:04:39 -07:00
Neil Fraser
e642a77f5d
Use conventional prefix/suffix for function calls.
...
Previously a function call with no return value generated:
prefix();
suffix();
function();
The intent was so the prefix and suffix calls in the function body wouldn’t overlap with the prefix and suffix calls of the function call. However, this is doomed to be inconsistent with a function call with a return value:
prefix();
print(function());
suffix();
Thus since overlaping must exist, both types of function calls should have consistent suffix locations.
2019-05-17 15:04:39 -07:00
Neil Fraser
04e39c20f8
Fix indentation bug if no xfix exists in function
2019-05-14 17:19:31 -07:00
Neil Fraser
585866a1b6
Revisit function block for return.
...
Visit (with prefix and suffix) function block when executed. This commit adds a revisit at the end of the function body when evaluating the return value.
2019-05-14 17:19:31 -07:00
Neil Fraser
c0e14c3a7c
Add method to suppress prefix/suffix from blocks.
...
This allows generators to have more control over the placement of suffix. Needed for ‘if’ blocks and function calls which require their suffix code to be somewhere other than the end.
Also, add loop’s prefix to ‘break’ blocks, since the loop’s suffix will be the next statement hit.
Also, reuse procedures_callreturn generator for procedures_callnoreturn.
2019-05-14 17:19:31 -07:00
Neil Fraser
25adb40e66
Prefix and suffix edge cases for flow statements.
...
Call suffix code on break/continue before executing the break/continue.
Call prefix code for enclosing loop before executing continue.
2019-05-14 17:19:31 -07:00
Neil Fraser
0259f8bb48
Add extra suffix when generating if/return block.
...
Also fix loops in Lua.
2019-05-14 17:19:31 -07:00
Neil Fraser
ba18ae2159
Add STATEMENT_SUFFIX
...
Also remove need to manually indent INFINITE_LOOP_TRAP. This is a breaking change for Python users of this property. However, very few users of this property exist, given that the existing code breaks if the block ID has a $ in it (also fixed in this PR).
2019-05-14 17:19:31 -07:00
tojimjiang
25b883d920
Remove Python references in Dart math generator
...
Resolves #2329
Commit in develop branch
2019-03-27 15:48:03 -07:00
Rachel Fenichel
e4690902de
Merge pull request #2179 from DubeySandeep/PHP-text-outerOrder
...
Fix #2161 : Changes outerOrder for PHP/text component.
2018-12-17 13:28:20 -08:00
Sandeep Dubey
8d09419afc
Changes outerOrder for PHP/text component.
2018-12-16 22:32:19 +05:30
alschmiedt
f06bee4eca
Fixes pull request comments
2018-11-27 09:55:15 -08:00
Abby Schmiedt
26a4774b35
Adds option to generate code for a single block
2018-11-21 09:00:29 -08:00
Andrew n marshall
9252c947bc
Add new atan2 block (PR #2079 )
...
Merge pull request from nadyafebi/add-atan2-support-1835
2018-10-16 11:27:00 -07:00
Andrew n marshall
58bfab7c6c
Math.PI => Math.pi
...
The Dart test was failing prior to this.
2018-10-16 11:25:10 -07:00
Neil Fraser
4f714716a5
Upgrade to dart 2.0
2018-10-15 16:17:50 -07:00
Nadya Febiana Djojosantoso
d3deeedc02
Add math_atan2 Python generator
2018-10-11 14:34:26 -07:00
Nadya Febiana Djojosantoso
c61822befa
Add math_atan2 PHP generator
2018-10-11 14:20:27 -07:00
Nadya Febiana Djojosantoso
683a738166
Add math_atan2 Lua generator
2018-10-11 14:19:40 -07:00
Nadya Febiana Djojosantoso
fd0bcabacd
Add math_atan2 Dart generator
2018-10-11 14:19:01 -07:00
Nadya Febiana Djojosantoso
23bb0e00d9
Add math_atan2 JavaScript generator
2018-10-11 14:18:25 -07:00
Neil Fraser
f3a76cc288
Remove unneeded String() and str() calls.
...
String literals in JS and Python don’t need to be coerced to strings.
2018-09-25 14:00:00 -07:00
Andrew n marshall
f42291ea64
Do not escape % in python strings. ( #1982 )
...
Rebase of PR-1890, commit 793055… from Ellipsis753:patch-1
2018-07-20 15:54:11 -07:00
Neil Fraser
c8bfc888c8
Throw errors instead of strings. ( #1974 )
...
Blocks and generators
2018-07-16 16:33:44 -07:00
Neil Fraser
6203cadcae
Move away from math.log10 and math.pow in Lua generators.
...
Fixes #1695
2018-03-12 11:35:29 -07:00
Neil Fraser
10dbf2cc6d
Random typos.
...
@rachel-fenichel LGTMs in person.
2018-02-21 17:47:01 -08:00
Rachel Fenichel
6d96e4003b
Merge pull request #1576 from rachel-fenichel/bugfix/1574
...
Add generators for dynamic variable blocks.
2018-01-29 16:20:28 -08:00
Rachel Fenichel
bce24fef6b
Add generators for dynamic variable blocks.
2018-01-26 17:10:45 -08:00
Rachel Fenichel
3b168f5370
Fix #1538
2018-01-26 15:20:19 -08:00
Neil Fraser
a4ec65d85d
Improve support >ES5 and Node.
...
Adds ‘yield’ and ‘**’ to JS order list.
Build generates files (more) parsable by Node.
This PR should have no effect on existing code.
2018-01-25 11:47:11 -08:00
jschanker
f0b68fad66
Fixed JS/PHP generators for math_number
...
It was returning ORDER_ATOMIC for the block for any number; changed it so that it now returns ORDER_UNARY_NEGATION for negative numbers.
2018-01-25 09:02:38 -08:00
Nat Zimmermann
9ce13d8883
Add ORDER_AWAIT constant to JavaScript generator
2018-01-25 09:02:18 -08:00
Rachel Fenichel
dc5267da65
Merge pull request #1547 from rachel-fenichel/feature/dev_var_ordering
...
Declare developer variables before user variables. Rebuild generators.
2018-01-18 10:24:37 -08:00
Rachel Fenichel
9a3dc70031
Declare developer variables before user variables. Rebuild generators.
2018-01-17 17:38:26 -08:00
Rachel Fenichel
376b3c4b44
Update procedure generators for PHP and Python to declare developer variables as globals
2018-01-17 13:04:41 -08:00
Rachel Fenichel
9b091a8f9e
Update procedure generators
2018-01-02 16:27:17 -08:00
Rachel Fenichel
24cf1cf7dd
Remove TODO and get rid of unnecessary wrapper call.
2017-12-21 10:54:54 -08:00
Rachel Fenichel
0a0b6f3848
Add error; python and php tests pass.
2017-12-20 16:28:14 -08:00
Rachel Fenichel
fced496d28
Lua generator tests pass with new variables
2017-12-20 15:23:05 -08:00
Rachel Fenichel
3d0567fe46
JS and Dart generator tests pass
2017-12-20 15:14:37 -08:00
Nicole Parrot
97ce5b3e4f
Fix indentation for function blocks with return statements ( #1362 )
...
* fix indentation for the return statement in function blocks that return a value
* Fix hard-coded autoindent, and swap it for Blockly.PHP.INDENT
* Fix hard-coded 2 spaces indent and use language-appropriate global indent
2017-10-17 15:20:11 -07:00
Nicole Parrot
4df6f11f8a
Do not assume an indentation of 2 spaces when writing the global variables at the top of a function declaration. ( #1356 )
2017-10-10 16:06:40 -07:00
Neil Fraser
f34a2c2ed4
Properly escape IDs in procedure generators. ( #1305 )
...
Issue #251 and #1304 .
2017-09-04 08:51:16 -07:00