mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
a0301a217a3c8ffb6fad69491147d1dba802f2de
20 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
130989763c |
refactor(generators): Restructure generator modules to contain side effects (#7173)
* refactor(generators): Move lang.js -> lang/lang_gernator.js
Move the LangGenerator definitions into their respective
subdirectories and add a _generator suffix to their filenames,
i.e. generators/javascript.js becomes
generators/javascript/javascript_generator.js.
This is to keep related code together and allow the `lang/all.js`
entrypoints to be moved to the top level generators/ directory.
No goog module IDs were changed, so playground and test code
that accesses this modules by filename does not need to be modified.
* refactor(generators) Move lang/all.js -> lang.js
- Move the entrypoints in generators/*/all.js to correspondingly-named
files in generators/ instead—i.e., generators/javascript/all.js
becomes generators/javascript.js.
- Update build_tasks.js accordingly.
* fix(generators): Add missing exports for LuaGenerator, PhpGenerator
These were inadvertently omitted from #7161 and #7162, respectively.
* refactor(generators): Make block generator modules side-effect free
- Move declaration of <lang>Generator instance from
generators/<lang>/<lang>_generator.js to generators/<lang>.js.
- Move .addReservedWords() calls from generators/<lang>/*.js to
generators/<lang>.js
- Modify generators/<lang>/*.js to export block generator functions
individually, rather than installing on <lang>Generator instance.
- Modify generators/<lang>.js to import and install block generator
functions on <lang>Generator instance.
* fix(tests): Fix tests broken by restructuring of generators
Where these tests needed block generator functions preinstalled
they should have been importing the Blockly.<Lang>.all module.
Where they do not need the provided block generator functions
they can now create their own empty <Lang>Generator instances.
* chore: Update renamings file
- Fix a malformation in previous entries that was not detected by
the renaming file validator test.
- Add entries describing the work done in this and related recent
PRs.
* fix: Correct minor errors in PR #7173
- Fix a search-and-replace error in renamings.json5
- Fix an incorrect-but-usable import in generator_test.js
|
||
|
|
a3458871db |
refactor(generators)!: Pass this CodeGenerator to individual generator functions (#7168)
* feat(generators): Pass this CodeGenerator to generator functions This implements option 1A of proposal 1 of #7086. This commit is not by itself a breaking change, except in the unlikely event that developers' custom generator functions take an (optional) second argument of a dfferent type. * feat(generators): Accept generator argument in block functions Accept a CodeGenerator instance as parameter two of every per-block-type generator function. * fix(generators): Pass generator when calling other generator functions Make sure to pass generator to any other block functions that are called recursively. * refactor(generators)!: Use generator argument in generator functions Refactor per-block-type generator functions to use the provided generator argument to make recursive calls, rather than depending on the closed-over <lang>Generator instance. This allows generator functions to be moved between CodeGenerator instances (of the same language, at least). This commit was created by search-and-replace and addresses most but not all recursive references; remaining uses will require manual attention and will be dealt with in a following commit. BREAKING CHANGE: This commit makes the generator functions we provide dependent on the new generator parameter. Although CodeGenerator.prototype.blockToCode has been modified to supply this, so this change will not affect most developers, this change will be a breaking change where developers make direct calls to these generator functions without supplying the generator parameter. See previous commit for an example of the update required. * refactor(generators): Manual fix for remaining uses of langGenerator Manually replace remaining uses of <lang>Generator in block generator functions. * fix(generators): Delete duplicate procedures_callnoreturn generator For some reason the generator function for procedures_callnoreturn appears twice in generators/javascript/procedures.js. Delete the first copy (since the second one overwrote it anyway). * chore(generators): Format |
||
|
|
eeb89194c4 |
refactor(generators): Introduce PhpGenerator class, Order enum (#7162)
* refactor(generators): Introduce PhpGenerator class, Order enum * refactor(generators): Use Order.* instead of .ORDER_* * refactor(generators): Don't rename phpGenerator |
||
|
|
f9c865b1b3 |
refactor(generators)!: CodeGenerator per-block-type generator function dictionary (#7150)
* feat(generators): Add block generator function dictionary Add a dictionary of block generator functions, provisionally called .forBlock. Look up generator functions there first, but fall back to looking up on 'this' (with deprecation notice) for backwards compatibility. Also tweak error message generation to use template literal. * refactor(generators)!: Update generator definitions to use dictionary * fix(tests): Have blockToCodeTest clean up after itself Have the blockToCodeTest helper function delete the block generator functions it adds to generator once the test is done. * refactor(tests): Use generator dictionary in insertion marker test The use of generators in insertion_marker_test.js was overlooked in the earlier commit making such updates, and some test here were failing due to lack of cleanup in cleanup in the generator_test.js. BREAKING CHANGE: this PR moves the generator functions we provide from their previous location directly on the CodeGenerator instances to the new .forBlock dictionary on each instance. This does not oblige external developers to do the same for their custom generators, but they will need to update any code that references the generator functions we provide (in generators/*/*, i.e. on javascriptGenerator, dartGenerator etc.) e.g. to replace the implementation or reuse the implementation for a different block type. |
||
|
|
4d2201a427 |
chore(generators): Migrate generators to ES Modules (#7103)
* feat(j2ts): Add support for migrating renaming imports
Convert
const {foo: bar} = require(/*...*/);
into
import {foo as bar} from /*...*/;
^^^^^^^^^^
Also fix a bug that caused relative paths to ESM in the same
directory to be missing a leading "./".
* fix(build): Fix trivial error exports for generators
The UMD wrapper was inadvertently exporting the contents of (e.g.)
the Blockly.JavaScript closure module rather than the intended
export of Blockly.JavaScript.all module - which went unnoticed
because the latter just reexported the former - but we are
about to convert the former to ESM.
* chore(generators): Migrate language generators to ESM
Migrate the main language generators in generators/*.js to ESM.
This was done by running js2ts on the files, renaming them back
to .js, and commenting out "import type" statements, which are
legal TS but not needed in JS (at least if you are not actually
letting Closure Compiler do type checking, which we are not.)
* chore(generators): Migrate block generators to ESM
Migrate generators/*/*.js (except all.js) to ESM.
This was done by running js2ts on the files, renaming them back
to .js, and removing now-spurious @suppress {extraRequire}
directives.
* chores(generators): Migrate generator chunk entrypoints to ESM
This was done by running js2ts on the files, renaming them back
to .js, and manually fixing the export statements.
An additional change to the chunk exports configuration in
build_tasks.js was necessary in order for the UMD wrapper to
find the new module object, which is given a different name
than the old exports object.
|
||
|
|
f947b3f4f6 |
refactor!: Remove remaining use of goog.module.declareLegacyNamespace. (#6254)
* fix(build): Minor corrections to build_tasks.js
- Use TSC_OUTPUT_DIR to find goog/goog.js when suppressing warnings.
- Remove unnecessary trailing semicolons.
* refactor(blocks): Remove declareLegacyNamespace
Remove the call to goog.module.declareLegacyNamespace from
Blockly.libraryBlocks. This entails:
- Changes to the UMD wrapper to be able to find the exports object.
- Changes to tests/bootstrap_helper.js to save the exports object
in the libraryBlocks global variable.
- As a precaution, renaming the tests/compile/test_blocks.js module
so that goog.provide does not touch Blockly or
Blockly.libraryBlocks, which may not exist / be writable.
* feat(build): Add support named exports from chunks
We need to convert the generators to named exports. For backwards
compatibility we still want e.g. Blockly.JavaScript to point at
the generator object when the chunk is loaded using a script tag.
Modify chunkWrapper to honour a .reexportOnly property in the
chunks table and generate suitable additional code in the UMD
wrapper.
* refactor(generators): Migrate JavaScript generator to named export
- Export the JavaScript generator object as javascriptGenerator
from the Blockly.JavaScript module(generators/javascript.js).
- Modify the Blockly.JavaScript.all module
(generators/javascript/all.js) to reexport the exports from
Blockly.JavaScript.
- Update chunk configuration so the generator object remains
available as Blockly.JavaScript when loading
javascript_compressed.js via a <script> tag.
(N.B. it is otherwise necessary to destructure the require
/ import.)
- Modify bootstrap_helper.js to store that export as
window.javascriptGenerator for use in test code.
- Modify test code to use javascriptGenerator instead of
Blockly.JavaScript.
- Modify .eslintrc.json so that javascriptGenerator is allowed
as a global in test/. (Also restrict use of Blockly global
to test/.)
N.B. that demo code in demos/code/code.js uses <script> tag
loading and so will continue to access Blockly.JavaScript.
* refactor(generators): Migrate Lua generator to named export
* refactor(generators): Migrate PHP generator to named export
* refactor(generators): Migrate Python generator to named export
* refactor(generators): Remove declareLegacyNamespace calls
Remove the goog.module.declareLegacyNamespace calls from the
generators.
This turns out to have the unexpected side-effect of causing the
compiler to rename the core/blockly.js exports object from
$.Blockly to just Blockly in blockly_compressed.js - presumably
because it no longer needs to be accessed in any subsequent chunk
because they no longer add properties to it. This requires
some changes (mainly simplification) to the chunkWrapper function
in build_tasks.js.
* refactor(core): Remove declareLegacyNamespace from blockly.js
So easy to do _now_: just need to:
- Make sure the UMD wrapper for the first chunk knows where the
exports object is.
- Use that same value to set the Blockly.VERSION @define.
- Have bootstrap_helper.js set window.Blockly to the exports
object.
- Fix tests/compile/test_blocks.js to not assume a Blockly
global variable, by converting it to a goog.module so we
can use a named require.
|
||
|
|
c0517ea360 |
refactor: convert some block generators to goog.module (#5770)
* refactor: convert generators/lua.js to goog.module * refactor: convert generator/lua.js to named requires * chore: run clang-format * refactor: convert generators/php/colour.js to goog.module * refactor: convert generators/php/colour.js to named requires * chore: run clang-format * refactor: convert generators/php/lists.js to goog.module * refactor: convert generators/php/lists.js to named requires * chore: run clang-format * refactor: convert generators/php/logic.js to goog.module * refactor: convert generators/php/logic.js to named requires * chore: run clang-format * refactor: convert generators/php/loops.js to goog.module * refactor: convert generators/php/loops.js to named requires * chore: run clang-format * refactor: convert generators/php/math.js to goog.module * refactor: convert generators/php/math.js to named requires * chore: run clang-format * refactor: convert generators/php/procedures.js to goog.module * refactor: convert generators/php/procedures.js to named requires * chore: run clang-format * refactor: convert generators/php/text.js to goog.module * refactor: convert generators/php/text.js to named requires * chore: run clang-format * refactor: convert generators/php/variables.js to goog.module * refactor: convert generators/php/variables.js to named requires * chore: run clang-format * refactor: convert generators/php/variables_dynamic.js to goog.module * refactor: convert generators/php/variables_dynamic.js to named requires * refactor: convert generators/php.js to goog.module * refactor: convert generators/php.js to named requires * chore: run clang-format * chore: rebuild deps.js |
||
|
|
985af10f6e |
chore(build): Use chunked compilation (#5721)
* chore(build): Add "all" modules for blocks & generators
These modules (Blockly.blocks.all and Blockly.<Generator>.all) will
be the entry points for the corresponding chunks.
They also make it easier to pull in all the modules in each package
(e.g. for playground and tests).
It is necessary to set the Closure Compiler dependency_mode to
SORT_ONLY as otherwise it tries to compile the "all" modules before
their dependencies, which fails.
The only impact on the _compressed.js files is the addition of a short
string to the very end of each file, e.g.:
var module$exports$Blockly$JavaScript$all={};
* chore(deps): Add devDependency on closure-calculate-chunks
* feat(build): First pass at chunked complation
Add a new buildCompiled gulp target (npm run build:compiled) that
uses closure-calculate-chunks to do chunked compliation of core/,
blocks/ and generators/ all in a single pass.
This work is incomplete: the resulting *_compressed.js files don't
(yet) have UMD wrappers.
* chore(build): Generate chunk wrappers
A first pass; this does not have support for a namespace object yet.
* refactor(build): Use chunked compilation by default
Remove old "compressed" gulp tasks in favour of new "compiled" task.
* chore(build): Remove cruft from buildCompiled
Remove unneeded `done` parameter and commented-out options that had
been cargo-culted from the old build pipeline.
* fix(build): Fix test failures caused by new build pipeline
- Exclude closure/goog/base.js from compiler input; use
externs/goog-externs.js instead.
- Have the build:debug and build:strict targets only build the first
chunk (blockly_compressed.js).
- Fix namespace entries for blocks and generators.
* fix(build): Fix build failures on node v12
closure-calculate-chunks requires node.js v14 or later.
When running on node.js v14 or later have getChunkOptions save
the output of closure-calculate-chunks to
scripts/gulpfiles/chunks.json. When running on older versions of
node.js have it use this checked-in, cached output instead of
attempting to run closure-calculate-chunks.
* chore(build): enable --rename_prefix_namespace
This will allow modules in blocks/ and generators/ to use
goog.require to obtain the exports object of goog.modules from
core/.
* fix(build): Always build all chunks
The previous commit enabled --rename_prefix_namespace option to
Closure Compiler, and this causes the buildCompressed target to
work fine when run without --debug or --strict, but adding either
of those flags (as for example when `npm test` runs
`npm run build:debug`) causes an issue:
- Because of many compiler errors in blocks/ and generators/,
a previous commit added a hack to only build the first chunk
when doing debug/strict builds.
- When asked to build only one chunk, Closure Compiler ignores the
--rename_prefix_namespace flag, because it 'correctly' infers
that there are no later chunks that will need to access global
variables from the first chunk.
- This causes a test failure, because `npm test` first runs
`npm run build`, which generates a valid blockly_compressed.js,
but this is then overrwritten by an invalid one when it next runs
`npm run build:debug`.
(The invalid one is missing all `$.` prefixes on 'global' variables,
including on Blockly, so the wrapper's last two lines -
"$.Blockly.internal_ = $;" and "return $.Blockly" - fail.)
The fix is to add appropriate @suppress annotations to blocks/*.js and
generators/**/*.js and then remove the first-chunk-only hack.
* refactor(build): Just build once
Since the previous commit caused `npm run build:debug` to do
everything that `... build:compressed` does - and to produce
byte-for-byte identical output - it doesn't make sense to run
both when testing. To that end:
- Replace the build:debug and build:strict package scripts that
did `gulp buildCompressed --...` with new scripts build-debug
and build-strict that do `gulp build --...` instead.
(The target names are changed so as to extend our existing naming
convention as follows: a target named "foo:bar" does some sub-part
of the job done by target "foo", but a target named "foo-bar" does
all the work of the target "foo" with some extra options.)
- build:debug:log and build:strict:log are similarly replaced with
build-debug-log and build-strict-log.
- Modify run_all_tests.js to just do `npm run build-debug` instead of
doing both `npm run build` and `npm run build:debug`.
- Also remove the 'build:blocks' script that should have been removed
when the buildBlocks gulp task was deleted previously.
* refactor(build): Compile with base_minimal.js instead of base.js
Introduce a (very!) cut-down version of closure/goog/base.js named
base_minimal.js that is used as input to the compiler as an
alternative to using externs/goog-externs.js (which will be deleted
once the buildAdvancedCompilationTest target has been updated).
This will allow use of goog.setTestOnly since it will now exist in
compiled mode, and allows the changes made in
|
||
|
|
1b29a00267 | chore: update php block generators to const and let (#5663) | ||
|
|
90b3f75d82 |
Remove @author tags (#5601)
Our files are up to a decade old, and have churned so much, that the initial author of the file no longer has much meaning. Furthermore, this will encourage developers to post to the developer group, rather than emailing Googlers (usually me) directly. |
||
|
|
2f2252f588 |
Rename variableDB_ to nameDB_
There is significant confusion in names and comments with regards to variables and procedures. `Blockly.Generator.prototype.variableDB_` is a Blockly.Names database, not a variable map. This rename introduces a getter and setter so deprecated references still work. This commit also fixes some comments which are either outright wrong or misleading regarding variable and procedure names. |
||
|
|
4e2f8e6e02 |
Use SPDX licences.
This is a followup to #3127. At the time, SPDX licenses were pending approval by Google. |
||
|
|
64c52efb5b | Resolve warnings in generator code (#3350) | ||
|
|
b46a4fe286 |
Bring our license format up to date (#3127)
* Google changed from an Inc to an LLC. This happened back in 2017 but we didn’t notice. Officially we should update files from Inc to LLC when they are changed as part of regular edits, but this is a nightmare to remember for the next decade. * Remove project description/titles from licenses This is no longer part of Google’s header requirements. Our existing descriptions were useless (“Visual Blocks Editor”) or grossly obselete (“Visual Blocks Language”). * License no longer requires URL. * Fix license regexps. |
||
|
|
2b191e897e |
Adding indexing settings, tests and fixing bugs (#464)
* Add indexing setting for JavaScript Generation Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default. * Updating js lists to do zero and one based index Updated generated JavaScript to change depending on whether one based indexing is enabled or not. * Updating js text to do zero and one based index Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting. * Start of python indexing Start of work on allowing one and zero indexing for generated python for lists. * Fixing bug and lint fixed Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing * Converting from if to switch statements Comverting if statements to switch statements when appropriate and adding spacing. * Modified sublist JavaScript generation Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create). * Stripping unecessary ids Removing ids from xml file. * Localisation updates from https://translatewiki.net. * Fix typo in flyout.js (#403) * Fix typo in flyout.js (#402) * Localisation updates from https://translatewiki.net. * Add indexing setting for JavaScript Generation Adding setting to allow for switching between zero and one based indexing for Blockly Blocks such that the generated code will use this flag to determine whether one based or zero based indexing should be used. One based indexing is enabled by default. * Updating js lists to do zero and one based index Updated generated JavaScript to change depending on whether one based indexing is enabled or not. * Updating js text to do zero and one based index Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting. * Fixing bug and lint fixed Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing * Converting from if to switch statements Comverting if statements to switch statements when appropriate and adding spacing. * Modified sublist JavaScript generation Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create). * Stripping unecessary ids Removing ids from xml file. * Updating generator test Modifying sublist test and re-formatting spacing between blocks. * Updating js lists to do zero and one based index Updated generated JavaScript to change depending on whether one based indexing is enabled or not. * Updating js text to do zero and one based index Change so that JavaScript generated for text blocks either assumes blocks use zero or one based index based on setting. * Fixing bug and lint fixed Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing * Converting from if to switch statements Comverting if statements to switch statements when appropriate and adding spacing. * Modified sublist JavaScript generation Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create). * Stripping unecessary ids Removing ids from xml file. * Localisation updates from https://translatewiki.net. * Localisation updates from https://translatewiki.net. * Updating js lists to do zero and one based index Updated generated JavaScript to change depending on whether one based indexing is enabled or not. * Fixing bug and lint fixed Fixing bug caused by not setting the return of concat when concatenating lines for sublist and substring functions. Also renamed these functions to be getSubsequece. Fixed lint errors with spacing * Modified sublist JavaScript generation Added case so that helper function is not generated if not necessary. Helper function is not generated if list length is not needed or if list is a simple block (such as a variable, as oppossed to a function call or list create). * Stripping unecessary ids Removing ids from xml file. * Updating generator test Modifying sublist test and re-formatting spacing between blocks. * Adding tests for indexing and extra cases Adding tests for indexing with custom block to adjust number based on what indexing is being generated. * Adding tests and renaming tests Adding tests for sublist and renaming tests. * Fixes for order for sublists Fixes so that parenthesis are generated properly for index for sublist * Cleaning up test generated code Changing order returned for unit test adjust index function to generate less unecessary parenthesis. * Adding tests for order Adding tests for order, relevant for methods that use index from start (because 1 is added) * Fixing JS order for getIndex and setIndex Changing to the correct order type when calling valueToCode in JS generation for getIndex and setIndex. * Fixed unittest adjustIndex Fixed uninttest adjustindex to also check whether the ONE_BASED_INDEXING variable has been defined to ensure proper behaviour. * Fixing lint and formatting for JS/lists Making line fixes and changing an if/elseif to case statement. * Tests added to include case for bug found Added tests with sublist combinations of different where's for the two indices after bug for this found in python. * Adding and renaming tests Adding test case for creating a sublist that encompasses the whole list but uses # and #-end instead of first last (applicable for python). Also, renaming tests. * Adding contant and fixing python lists bugs Adding contant for ONE_BASED_INDEXING and fixing bugs in python for lists. * Fixing test get random Fixing test get random to take into account indexing for return value. * Adding indexing checkbox to test page Adding checkbos on test page so that code can be generated for one and zero based indexing. Languages that are generated with zero based indexing that do not have it implemented will fail tests as expected. * Fixing unittest getremove random Fixing unittest getremove random to take into account the return value based on indexing. * Change comparison for getremove random test Fixed comparison to equal for the return value for getremove random. * Fixing bugs with lists zero-indexing Fixing getIndex and getSublist methods to pass for zero-indexed tests. * Adding test cases and formatting Adding test cases to text tests, reordering a couple list test, and formatting block spacing. * Fixing unittest expected value Fixing expected value fore unit tests for sublist. * Cleanup Removing obvious comments, formatting fixes, and naming in generated code in JS. * Helper function for Python lists Adding helper function for casting to int for indices. * Expanding helper to reduce duplicated code Expanding helper method to also get the property with the correct order and check indexing to reduce duplicated code. * Cleaning up JS indexing with helper function Adding helper function for indexing and used it in lists and text. * Moving helper function and formatting fixes Moving helper function, formatting fixes, and changing some generated code variable names. * Fixing python generation for text Fixing all failinng tests for python and using new helper method. * Lint fixes and order in indexOf Making lint fixes and correcting returned order in indexOf. * Python variable renaming Renaming a few generated variables. * Fixing comment and order Fixing comment to list Blockly.Block type and fixing order because it could be higher. * Switching back to if Switching switch back to if statements because there weren't enough cases to warrant for a switch. * Adding order and fixing lists for Dart Adding if null operator to operator precedence for Dart. Also, fixing lists implementation to pass unit tests and adding zero-indexing functionality. * Formatting and lint fixes Formatting and lint fixes * Dart text fixed Fixing Dart text generation to pass unit tests. * Changing back to variable Changing switch condition back to variable. * Fixing ORDER_OVERRIDES Inner and outer order was switched . * Adding bug with order caused by generator change Flooring order before comparision because of how the order constants were modified. * Adding list tests Adding tests for additional cases for lists/ * Adding comment for dart order Adding comment for Dart ORDER_IF_NULL operator. * Formatting fixes Formatting fixes for line indentation. * Fixing PHP order and lists generation Fixing PHP order constants and fixing lists so that they pass unit tests. * Fixing tests Removing duplicate unit test * Adding text tests Adding tests for text. * Renaming variable and removing unused variable Renaming variables from exceptionIndex to errorIndex and removing unused at variable. * Adding missing function call to test Adding missing funciton call to test that was causing tests to fail when they shouldn't. * Fixing PHP text generation Fixing PHP text code generation so it passes unit tests. * Formatting fixes Cleaning up code, renamiing a variable. * Fixing failing subsequence tests Fixing JS code that failed for sublist/substring tests. * Fixing intentation Fixing indentation. * Fixing Dart sublist/substring Fixing sublist/substring to include condiiton where FROM_START (and not throw error by mistake) when zero-indexed. * Adding order subtraction test Adding test for checking order for subtraction x- (y - z) x - (y + z). * Updating to new PHP power operator Updating from pow function to ** operator to clean up code. * Updating to new removeWhere Updating removeMatching to removeWhere because new version of Dart now use removeWhere. * Fix for lua rounding assertequals Adding check for number in equlity check for comparing number for floats. * Adding test for copy of list Adding test that checks the list is copied when a sublist is made first-last. * Formatting and order fixes Fixing formatting such as indentation and order fixes. * Adding comment for clarity Adding comment about how Lua code generation is not supporting zero indexing. * Changed variable names in code Changed variable names to follow style guide and changed for loop variable from n to i as is typical. * Reducing unecessarily generated functions and renaming variables Reducing number of generated functions using gensym_ by adding parameters to provided function. Renaming variables to make functions more readble. * Fixing sublist order and sort variable Fixing order used for valueToCode for sublist and renaming list variable in sort to match rest of code.. * Fixing order constant order Removing operator () that was incorrect and addiung ~, * Fixing order and indentation Fixing order return fro create lists blocks and fixing indentationn for string array. * Fixing order and renaming variables Fixing order to be the correct strength and renaming variables to be more readable/ * Changing assert blocks for unit tests Changing assert blocks to have a value input instead of a field so there is more flexibility in writing tests. * Cleaning up and adding missing order tests Adding tests for order for paramters for list blocks that weren't being tested to uncover bugs. Test were also cleaned up/reorganized/renamed to be more readable and shorter vertically (but lines wider horizontally). * Compile error fix and order in Dart generation. Fixing compile error in generated code and incorrect order in get sublist for Dart. * Fixing typo in getIndex and invalid parameter name Fixing type in getIndex where list code should have been appended but instead an undefined variable was added. The parameter in lists_sort was changed to my_list because list is a reserved word in python. * Fixing order, parenthesis bug, and variable declaration in Lua Fixing incorrect order in Lua. Fixing bug caused by missing parenthesis around ternary operator in code. Variable code was declared with JavaScript syntax, this was fixed to be valid in Lua. * Adding tests and formatting tests Adding missing test for order in text/lists. Changing spacing/order of tests and updating comments. * Fixing error in code Changing to correct function call in empy tests and changing test name that was duplicated to be more clear. * Renamed test helper function * Fixing order and renaming variable in JS generator Fixing order for charAt and renaming variable in code list_sort from listCode to list to be consistent with rest of code. * Fixing order for dart text Fixing roder for dart charAt * Cleaning up generated code for Dart getIndex Cleaning up generated code for Dart getIndex so that helper functions aren't generated unecessarily and adding comments. * Fixing Dart remove random error Fixing error caused by remove random implementation in Dart. index should have been x but instead was length - x. * Fixing unit test blocks Fixing Lua unit test block that should have just returned the number and removing unecessary checks in other blocks because the constant was defined. * Fixing Lua assert equals block string.format was throwing an error if one of the values happened to be a boolean. * Adding tests for create text with number Adding test for create text with numbers as parameters * Fixing lua unit test block Lua unit test block should have added 1 * Removing indexing setting for Lua tests Removing setting index setting for Lua generation because it is always one-indexed. * Fixing order and create text Fixing failing test caused by improper order and fixed create text to properly convert to string when there is one element. * Running linter on generator code Running linter on generator code and fixing spacing/indentation problems. * Editing comments and removing uneeded parenthesis Editing and adding comments and removing uneeded parenthesis around ternary operator condition. * Fixing order and changing variable names Fixing orders that were incorrect and changing variable names to be more descriptive and consistent across code. * Adding comment about list support and fixes for PHP Adding comment about how lists are not fully supported for PHP. Adding missing order to PHP and fixing order errors throughout. Fixing regex for variable matching in lists. Cleaning up variable names to be more readable and consistent with other parts of code. * Reducing complexity for getremove/remove in JS Reducing complexity in generated code for getremove/remove in JavaScript by replacing unecessary helper function. * Fixing spacing before inline comments Ensuring there are two spaces before inline comments. * Changing JS list copy for clarity Changing JavaScript list copy to use slice(0) instead of concat for clarity and to use the same pattern as the other sublist methods. * Changing generated variable name tmp_x Changing tmp_x to tmpX to follow closer to the correct style for JavaScript. * Prefixing empy lines between comment text Prior to this change, comments with an empty line between text did not have a comment prefix before it, resulting in comment blocks that seemed disjoined although they were for the same block. This change affects how the prefix line function works so that those lines will have the prefix (if applicable) while still taking into account the trailing newline character. * Changing for loops variable names Changing most for loops to use i as the variable name (or j if applicable) or changing name to be more readable. * Simplifying provided subsequence function Simplifying subsequence function to generate a simpler function depending on where combination instead of a larger complex function that works for all where combinations. * Style fixes Fixing indentation, comments, and other formatting-type changes based on pull request comments. * Fixing indentation Fixing indentation and removing an extra newline. * Fixing PHP mode implementation Fixing PHP mode implementation to properlyu return multiple modes if applicable. * Fixing line too long Wrapping lines in php/math.js with lines longer than 80 characters. * Wrapping long lines Wrapping lines that are too long. * Changing boolean casing Changing boolean casing to be lowercase. |
||
|
|
0faf2b7a53 | still working on tests, lists are the only unfinished | ||
|
|
867d6c03da | changes from Neil's comments | ||
|
|
37faa9937a | more debugging | ||
|
|
da2e0710bf | fixing some items | ||
|
|
f0c837bb2d | starting php support addition |