-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(generators): Changes to exports and access controls for TypeScript compatibility #7295
Merged
Conversation
This file contains 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
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 google#7283, but closely related and required to fixing the related issue google/blockly-samples#1785.
cpcallen
requested review from
BeksOmega
and removed request for
rachel-fenichel
July 17, 2023 17:08
BeksOmega
approved these changes
Jul 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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 google/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 google/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 <[email protected]>
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 google/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 <[email protected]>
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 format
andnpm run lint
The details
Resolves
Fixes #7283.
Also partially fixes google/blockly-samples#1785.
Proposed Changes
Add missing declarations for
Order
enums totypings/<language>.d.ts
.This is a temporary measure until the generators are converted to TypeScript and the
.d.ts
files can be autogenerated.)Remove the
protected
declaration on theprovideFunction_
method andFUNCTION_NAME_PLACEHOLDER_
property onCodeGenerator
so they can be used from generator functions written in TypeScript.Previously generator functions were (ES5-style) methods on (Code)
Generator
instances, and Closure Compiler was apparently happy with this, but now these functions live in a separate dictionary andtsc
is 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 theCodeGenerator
instance 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.js
only) viablockly-samples
'examples/sample-app-ts
.Documentation
We should regenerate the documentation for
CodeGenerator
to remove theprotected
declaration.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.