fix(generators): Changes to exports and access controls for TypeScript compatibility#7295
Merged
cpcallen merged 4 commits intoRaspberryPiFoundation:developfrom Jul 17, 2023
Merged
Conversation
Remove the protected declaration on provideFunction_ and FUNCITON_NAME_PLACEHOLDER_ so they can be used from generator functions written in TypeScript. Not strictly part of RaspberryPiFoundation#7283, but closely related and required to fixing the related issue RaspberryPiFoundation/blockly-samples#1785.
ericblackmonGoogle
pushed a commit
that referenced
this pull request
Jul 17, 2023
…t compatibility (#7295) * fix(generators): Add missing declarations for Order enums * chore(generators): Remove spurious whitespace * fix(generators): Make provideFunction_ etc. public Remove the protected declaration on provideFunction_ and FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator functions written in TypeScript. Not strictly part of #7283, but closely related and required to fixing the related issue RaspberryPiFoundation/blockly-samples#1785. * chore(generators): format (cherry picked from commit d503fbb)
4 tasks
ericblackmonGoogle
added a commit
that referenced
this pull request
Jul 17, 2023
* fix(generators): Changes to exports and access controls for TypeScript compatibility (#7295) * fix(generators): Add missing declarations for Order enums * chore(generators): Remove spurious whitespace * fix(generators): Make provideFunction_ etc. public Remove the protected declaration on provideFunction_ and FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator functions written in TypeScript. Not strictly part of #7283, but closely related and required to fixing the related issue RaspberryPiFoundation/blockly-samples#1785. * chore(generators): format (cherry picked from commit d503fbb) * fix: Correct errors in `HSV_SATURATION`, `HSV_VALUE` accessors (#7297) * fix: Correct errors in HSV_SATURATION, HSV_VALUE accessors Fix the comment / message errors noted in #7249 (comment) * chore: Add renamings for HSV_SATURATION, HSV_VALUE (cherry picked from commit 1bc4f67) * release: Update version number to 10.0.2 --------- Co-authored-by: Christopher Allen <cpcallen+git@google.com>
3 tasks
ericblackmonGoogle
added a commit
that referenced
this pull request
Jul 17, 2023
* fix(generators): Changes to exports and access controls for TypeScript compatibility (#7295) * fix(generators): Add missing declarations for Order enums * chore(generators): Remove spurious whitespace * fix(generators): Make provideFunction_ etc. public Remove the protected declaration on provideFunction_ and FUNCTION_NAME_PLACEHOLDER_ so they can be used from generator functions written in TypeScript. Not strictly part of #7283, but closely related and required to fixing the related issue RaspberryPiFoundation/blockly-samples#1785. * chore(generators): format (cherry picked from commit d503fbb) * fix: Correct errors in `HSV_SATURATION`, `HSV_VALUE` accessors (#7297) * fix: Correct errors in HSV_SATURATION, HSV_VALUE accessors Fix the comment / message errors noted in #7249 (comment) * chore: Add renamings for HSV_SATURATION, HSV_VALUE (cherry picked from commit 1bc4f67) * release: Update version number to 10.0.2 --------- Co-authored-by: Christopher Allen <cpcallen+git@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The basics
npm run formatandnpm run lintThe details
Resolves
Fixes #7283.
Also partially fixes RaspberryPiFoundation/blockly-samples#1785.
Proposed Changes
Add missing declarations for
Orderenums totypings/<language>.d.ts.This is a temporary measure until the generators are converted to TypeScript and the
.d.tsfiles can be autogenerated.)Remove the
protecteddeclaration on theprovideFunction_method andFUNCTION_NAME_PLACEHOLDER_property onCodeGeneratorso they can be used from generator functions written in TypeScript.Previously generator functions were (ES5-style) methods on (Code)
Generatorinstances, and Closure Compiler was apparently happy with this, but now these functions live in a separate dictionary andtscis pickier.Behaviour Before Change
It was not possible to write code generators in TypeScript that made use of
Order,provideFunction_orFUNCTION_NAME_PLACEHOLDER_. The former limitation had to be worked around by using the now-deprecatedORDER_*properties on theCodeGeneratorinstance instead.Behaviour After Change
It is now possible to use all three features in TypeScript.
Reason for Changes
Fix bugs.
Test Coverage
Manually tested changes (to
javascript/javascript_generator.jsonly) viablockly-samples'examples/sample-app-ts.Documentation
We should regenerate the documentation for
CodeGeneratorto remove theprotecteddeclaration.It turns out we have no auto-generated reference documentation for anything in
generators/so there is nothing needing updating on that front. 🙁Additional Information
This fix should be cherry-picked into a patch release ASAP.