Conversation
ark120202
reviewed
Jan 20, 2020
Perryvw
commented
Jan 27, 2020
| context: TransformationContext, | ||
| isDefaultExport = false | ||
| ): lua.Expression { | ||
| let className: lua.Identifier; |
ark120202
reviewed
Feb 1, 2020
# Conflicts: # src/transformation/visitors/class/index.ts # test/unit/functions/validation/invalidFunctionAssignments.spec.ts
ark120202
reviewed
Apr 4, 2020
| classDeclaration, | ||
| className, | ||
| localClassName, | ||
| getReflectionClassName(classDeclaration), |
Contributor
There was a problem hiding this comment.
Should we move getReflectionClassName implementation to setup instead of passing it as a parameter? Unrelated, buy maybe extendedType too?
ark120202
reviewed
Apr 5, 2020
| lua.createAssignmentStatement( | ||
| lua.createTableIndexExpression(lua.cloneIdentifier(localClassName), lua.createStringLiteral("name")), | ||
| lua.createStringLiteral(classNameText), | ||
| reflectionClassName, |
Contributor
There was a problem hiding this comment.
Suggested change
| reflectionClassName, | |
| getReflectionClassName(context, statement, localClassName), |
ark120202
reviewed
Apr 5, 2020
Comment on lines
+83
to
+87
| export function getReflectionClassName( | ||
| declaration: ts.ClassLikeDeclaration, | ||
| className: lua.Identifier, | ||
| context: TransformationContext | ||
| ): lua.Expression { |
Contributor
There was a problem hiding this comment.
Suggested change
| export function getReflectionClassName( | |
| declaration: ts.ClassLikeDeclaration, | |
| className: lua.Identifier, | |
| context: TransformationContext | |
| ): lua.Expression { | |
| export function getReflectionClassName( | |
| context: TransformationContext, | |
| declaration: ts.ClassLikeDeclaration, | |
| className: lua.Identifier | |
| ): lua.Expression { |
ark120202
reviewed
Apr 5, 2020
test/unit/classes/classes.spec.ts
Outdated
Comment on lines
+774
to
+783
| function Numbers(...message_type_args: number[]) { | ||
| return <T extends new(...args: any[]) => {}>(constructor: T) => { | ||
| return class extends constructor { | ||
| protected numbers = message_type_args; | ||
| }; | ||
| }; | ||
| } | ||
|
|
||
| @Numbers(10, 20) | ||
| class MyClass {} |
Contributor
There was a problem hiding this comment.
Suggested change
| function Numbers(...message_type_args: number[]) { | |
| return <T extends new(...args: any[]) => {}>(constructor: T) => { | |
| return class extends constructor { | |
| protected numbers = message_type_args; | |
| }; | |
| }; | |
| } | |
| @Numbers(10, 20) | |
| class MyClass {} | |
| const decorator = <T extends new (...args: any[]) => any>(constructor: T) => class extends constructor {}; | |
| @decorator | |
| class MyClass {} |
test/unit/modules/modules.spec.ts
Outdated
| }, | ||
| "value" | ||
| ); | ||
| test("default exported name class has correct name property", () => { |
Contributor
There was a problem hiding this comment.
I think these would be better with other class tests
ark120202
approved these changes
Apr 5, 2020
Comment on lines
72
to
73
| classDeclaration: ts.ClassLikeDeclaration, | ||
| context: TransformationContext, |
Contributor
There was a problem hiding this comment.
For consistency:
Suggested change
| classDeclaration: ts.ClassLikeDeclaration, | |
| context: TransformationContext, | |
| context: TransformationContext, | |
| classDeclaration: ts.ClassLikeDeclaration, |
Member
Author
There was a problem hiding this comment.
Actually it is consistent right now with transformClassDeclaration and transformClassAsExpression
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.
As discovered in #802, the class name property on anonymous classes did not match the class names in JS.
Not entirely sure about the modules.spec test, since it depends on the logic of the unique variable generation staying the same. Maybe we can come up with a better way to test that.