Skip to content
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 Lua generators to TypeScript #7654

Merged
merged 6 commits into from
Nov 20, 2023

Conversation

btw17
Copy link
Member

@btw17 btw17 commented Nov 17, 2023

The basics

The details

Resolves

Part of #6828.

Proposed Changes

Migrate generators/lua/*.js and generators/lua.js to TypeScript.

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 from typings/).

Additional Information

It may be easier to review this commit-by-commit, as the final format commit make a lot of noisy changes.

@btw17 btw17 requested a review from a team as a code owner November 17, 2023 17:28
@btw17 btw17 requested a review from maribethb November 17, 2023 17:28
@BeksOmega BeksOmega assigned cpcallen and unassigned maribethb Nov 17, 2023
@BeksOmega BeksOmega requested review from cpcallen and removed request for maribethb November 17, 2023 17:28
Copy link
Contributor

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with just a few minor tweaks to comments / formatting.

@@ -5,40 +5,38 @@
*/

/**
* @fileoverview Helper functions for generating Lua for blocks.
* @file Helper functions for generating Lua for blocks.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the other CodeGenerator subclasses:

Suggested change
* @file Helper functions for generating Lua for blocks.
* @file Lua code generator class, including helper methods for
* generating Lua for blocks.

(But now I've noticed that I forgot to replace @fileoverview with @file in lots of places in the other generators…)

import {inputTypes} from '../../core/inputs/input_types.js';


/**
* Order of operation ENUMs.
* http://www.lua.org/manual/5.3/manual.html#3.4.8
* @enum {number}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @enum JSDoc tag is no longer needed and should be deleted.

Comment on lines 29 to 37
HIGH = 1, // Function calls, tables[]
EXPONENTIATION = 2, // ^
UNARY = 3, // not # - ~
MULTIPLICATIVE = 4, // * / %
ADDITIVE = 5, // + -
CONCATENATION = 6, // ..
RELATIONAL = 7, // < > <= >= ~= ==
AND = 8, // and
OR = 9, // or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore the original formatting here and use // prettier-ignore to preserve it.

@cpcallen cpcallen merged commit dc61e48 into google:develop Nov 20, 2023
6 checks passed
@btw17
Copy link
Member Author

btw17 commented Nov 27, 2023

Thanks for merging this and resolving the small tweaks after! I was out last week, so I would've have been able to get to it until this morning.

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.
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants