Skip to content

Fix context failed to be resolved due to parentheses#1095

Merged
Perryvw merged 2 commits intomasterfrom
bugfix/elementaccess-context
Aug 20, 2021
Merged

Fix context failed to be resolved due to parentheses#1095
Perryvw merged 2 commits intomasterfrom
bugfix/elementaccess-context

Conversation

@Perryvw
Copy link
Copy Markdown
Member

@Perryvw Perryvw commented Aug 19, 2021

I have introduced an additional TS transformer before we transform to lua. The transformer simply looks for any call expressions and when it finds them it will unwrap any (nested) ParenthesisExpressions that might be in its expression field. This means that calls like ts.isPropertyAssignment(callExpression.expression) will not suddenly be false due to a random ParenthesisExpression.

For now I only transformed callexpression.expressions, in the future we could extend this to do other TS AST transformations before transforming to Lua.

Fixes #959

@Perryvw Perryvw merged commit b0ef3b0 into master Aug 20, 2021
@Perryvw Perryvw deleted the bugfix/elementaccess-context branch August 20, 2021 12:42
sanikoyes pushed a commit to sanikoyes/TypeScriptToLua that referenced this pull request Sep 24, 2021
…#1095)

* Fix context failed to be resolved due to parentheses

* Added test with more parentheses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context is not correctly inferred from indexed expression on this

2 participants