Merged
Conversation
Perryvw
reviewed
Feb 7, 2021
| }" | ||
| `; | ||
|
|
||
| exports[`invalid $multi call (const {} = $multi();): diagnostics 1`] = `"main.ts(2,20): error TSTL: The $multi function must be called in an expression that is returned."`; |
Member
There was a problem hiding this comment.
This diagnostic seems unclear, would it be clearer to change it to The $multi function must be called in a return statement or variable declaration.?
Collaborator
Author
There was a problem hiding this comment.
This is what it was previously. $multi can't be called in a variable declaration, so maybe we change it to just The $multi function must be called in a return statement.
Perryvw
approved these changes
Feb 7, 2021
lolleko
approved these changes
Feb 8, 2021
| if (!ts.isArrayBindingPattern(declaration.name)) { | ||
| context.diagnostics.push(invalidMultiTypeToNonArrayBindingPattern(declaration.name)); | ||
| return []; | ||
| export function multiReturnCallShouldBeWrapped(context: TransformationContext, node: ts.CallExpression) { |
Member
There was a problem hiding this comment.
I would prefer
Suggested change
| export function multiReturnCallShouldBeWrapped(context: TransformationContext, node: ts.CallExpression) { | |
| export function shouldMultiReturnCallBeWrapped(context: TransformationContext, node: ts.CallExpression) { |
But I am also okay with the current version.
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.
This turned into a somewhat major refactor on the multi-return stuff, as I ran into more unhandled cases along the way.
Here's the main things this PR does:
MultiReturntoLuaMultiReturnfor consistency with other lib extensions$multicould be implicitly cast to something else (such as when the function explicitly defines a non-multireturn return type)