Commit Graph

16 Commits

Author SHA1 Message Date
Neil Fraser
42fde0f81b chore: Reduce delta on ports to blockly-samples (#6886)
* Reduce usage of obsolete .keyCode property.
* Rename private properties/methods which violate eslint rules.
* Use arrays of bound events rather than individual properties.
* Improve typing info.
* Also fix O(n^2) recursive performance issue in theme's getComponentStyle function.
* And replace String(...) with '${...}' (smaller, faster).
* .toString() is considered harmful.
2023-03-15 13:28:57 -07:00
Neil Fraser
5612e13824 fix: Remove float() coercion in Python loops (#6259)
Coercion to a float is a very JavaScript thing to do, Python is not JavaScript.

From this discussion:
https://groups.google.com/g/blockly/c/OF_j9rKQgpI
2022-07-06 08:46:10 -07:00
gregdyke
706c2bfd41 fix: provide initial values to reduce functions in generated js (#6178) 2022-05-31 09:22:34 -07:00
Neil Fraser
1f6a1bd8d9 chore: Use ES6 template strings in CSS and code generators (#5902)
* Unindent CSS, save 3 kb of code.
* Convert generator functions to template strings. 
This resolves #5761.
2022-01-28 17:58:43 -08:00
Richard Doherty
a31003fab9 fix(generators): Fix an operator precedence issue in the math_number_property generators to remove extra parentheses (#5685)
* Fixed issue where the mathIsPrime function inserted extra parenthesis around certain blocks.
* Added tests to generated JS
* Updated generated code in Lua
* Updated Generated code for tests in Dart
* Updated generated code for tests in PHP
* Updated generated code for tests in Python
* Also changed var to const and let.

Co-authored-by: jeremyjacob123 <43049656+jeremyjacob123@users.noreply.github.com>
Co-authored-by: LouisCatala <86700310+LouisCatala@users.noreply.github.com>
Co-authored-by: jeremyjacob123 <43049656+jeremyjacob123@users.noreply.github.com>
2022-01-27 15:54:05 +00:00
Neil Fraser
1c3f4f0524 fix: isPrime block should cast str as num (#5680)
Fixes #5678
2021-11-05 11:12:25 -07:00
Neil Fraser
c929b3015b chore: Convert == to === and != to !== where possible. (#5599) 2021-10-15 09:17:04 -07:00
Neil Fraser
37a1ee55b8 Remove useless variable declarations in PHP. (#4849) 2021-05-27 21:40:04 -07:00
Monica Kozbial
6ec002e3d4 Adding tests for multiline block (#4317)
* Adding tests for multiline input
2020-09-30 15:20:35 -07:00
Monica Kozbial
81d355f5fa Fix order errors in text generators (#4329)
* Fix dart text generator logic

* Fix Javascript text generator logic.

* Fix Lua text generator logic

* Fix php text generator logic

* Fix python text generator logic

* Fix error in substring logic

* Fix unit test block generators

* Update from ORDER_COMMA to ORDER_NONE

* Update golden files
2020-09-30 14:08:45 -07:00
Monica Kozbial
fcc3a09661 Fix python loop (#4007)
* Fix code generation for python controls_for

* Update python golden file.
2020-06-30 11:35:48 -07:00
Monica Kozbial
d6abf4798e Fixing operator precedence in Lua and and adding test. (#3765)
* Fixing operator precedence in Lua and and adding test.

* Updating golden files.
2020-03-25 14:34:07 -07:00
RoboErikG
e62c2a3f6b Remove multi-line comments to avoid escaping (#3231)
Fixes #3230 by removing multi-line comments for procedures.
2019-10-14 10:40:22 -07:00
Neil Fraser
b6947976d7 Fix lint in golden PHP generator.
Causing tests to fail.
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
Rachel Fenichel
6202919272 Make generator tests compare results against golden files; add golden files. 2018-11-09 13:22:34 -08:00