-
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
refactor(generators): Migrate Dart generators to TypeScript #7646
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
Slightly simplify the implementation of getAdjusted, in part to make it more readable. Also improve its JSDoc comment.
First pass doing very mechanistic migration, not attempting to fix all the resulting type errors.
This consists almost entirely of adding casts, so the code output by tsc should be as similar as possible to the pre-migration .js source files.
The migration of the JavaScript and Python generators inadvertently introduced some inconsistencies in the code, e.g.: - Incorrect import ordering. - Putting executable code before the initial comment line that most generator functions begin with, and/or deleting or replacing these comments. - N.B. however that these inline comments should have been JSDocs; a task to convert them has been added to google#7600.
The way the generator functions are added to dartGenerator.forBlock has been modified so that incorrect generator function signatures will cause tsc to generate a type error.
One block protected with // prettier-ignore to preserve careful comment formatting. Where there are repeated concatenations prettier has made a pretty mess of things, but the correct fix is probably to use template literals instead (rather than just locally disabling prettier). This is one of the items in the to-do list in google#7600.
BeksOmega
approved these changes
Nov 13, 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.
Overall LGTM!
Fixed the one definite error. Please let me know if your other comments have been satisfactorily addressed (at least for the purposes of this PR). |
LGTM! |
cpcallen
added a commit
to cpcallen/blockly
that referenced
this pull request
Mar 15, 2024
In PRs google#7602, google#7616, google#7646, google#7647 and google#7654 the @Protected access modifier on scrub_ was not transcribed to the new typescript signature. BREAKING CHANGE: This makes scrub_ protected again, which will break any code attempting to access this method from outside a CodeGenerator subclass.
cpcallen
added a commit
to cpcallen/blockly
that referenced
this pull request
Mar 15, 2024
Fixes google#2156. In PRs google#7602, google#7616, google#7646, google#7647 and google#7654 the @Protected access modifier on scrub_ on the CodeGenerator subclasses was not transcribed to the new typescript signature. I was going to re-add it, but this breaks some of the procedure block generator functions which rely on it, and then @BeksOmega pointed out that this might be one of the CodeGenerator API functions which we had already decided should be public—and lo and behold I found google#2156. Per discussion amongst team, I am not renaming it to scrub at this time.
cpcallen
added a commit
to cpcallen/blockly
that referenced
this pull request
Mar 15, 2024
Fixes google#2156. In PRs google#7602, google#7616, google#7646, google#7647 and google#7654 the @Protected access modifier on scrub_ on the CodeGenerator subclasses was not transcribed to the new typescript signature. I was going to re-add it, but this breaks some of the procedure block generator functions which rely on it, and then @BeksOmega pointed out that this might be one of the CodeGenerator API functions which we had already decided should be public—and lo and behold I found google#2156. Per discussion amongst team, I am not renaming it to scrub at this time.
cpcallen
added a commit
to cpcallen/blockly
that referenced
this pull request
Mar 15, 2024
Fixes google#2156. In PRs google#7602, google#7616, google#7646, google#7647 and google#7654 the @Protected access modifier on scrub_ on the CodeGenerator subclasses was not transcribed to the new typescript signature. I was going to re-add it, but this breaks some of the procedure block generator functions which rely on it, and then @BeksOmega pointed out that this might be one of the CodeGenerator API functions which we had already decided should be public—and lo and behold I found google#2156. Per discussion amongst team, I am not renaming it to scrub at this time.
1 task
cpcallen
added a commit
that referenced
this pull request
Mar 15, 2024
Fixes #2156. In PRs #7602, #7616, #7646, #7647 and #7654 the @Protected access modifier on scrub_ on the CodeGenerator subclasses was not transcribed to the new typescript signature. I was going to re-add it, but this breaks some of the procedure block generator functions which rely on it, and then @BeksOmega pointed out that this might be one of the CodeGenerator API functions which we had already decided should be public—and lo and behold I found #2156. Per discussion amongst team, I am not renaming it to scrub at this time.
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
The details
Resolves
Part of #6828.
Proposed Changes
Migrate
generators/dart/*.js
andgenerators/dart.js
to TypeScript.Also make a few minor corrections to previously-migrated files in
generators/javascript/
andgenerators/python/
for consistency (see commit d934aa1).Reason for Changes
Finish TS migration.
Test Coverage
npm test
passes. No changes to manual test procedures required.Documentation
No changes to documentation yet, as there should be minimal changes to the generated code and no changes to the published typings (because during build we overwrite the generated
.d.ts
files with the ones fromtypings/
).Additional Information
It may be easier to review this commit-by-commit, as the final format commit make a lot of noisy changes.