correctly passing context to functions accessed as elements#313
Merged
Perryvw merged 2 commits intoTypeScriptToLua:masterfrom Dec 27, 2018
Merged
correctly passing context to functions accessed as elements#313Perryvw merged 2 commits intoTypeScriptToLua:masterfrom
Perryvw merged 2 commits intoTypeScriptToLua:masterfrom
Conversation
Perryvw
approved these changes
Dec 27, 2018
src/Transpiler.ts
Outdated
|
|
||
| public transpileElementCall(node: ts.CallExpression): string { | ||
| if (!ts.isElementAccessExpression(node.expression)) { | ||
| throw TSTLErrors.InvalidPropertyCall(node); |
Member
There was a problem hiding this comment.
Shouldn't this be InvalidElementCall?
Collaborator
Author
There was a problem hiding this comment.
But, that would make sense! 😂
| if (!signatureDeclaration | ||
| || tsHelper.getDeclarationContextType(signatureDeclaration, this.checker) !== ContextType.Void) { | ||
| // Pass left-side as context | ||
| if (node.arguments.length > 0) { |
Member
There was a problem hiding this comment.
This looks a little weird but I do understand it prevents some duplication. Maybe if you just improve the comment a little bit on the logic for this if statement, that would already help.
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.
fixes #266
Also has a bit of refactoring in transpileCallExpression()