Skip to content

Fix call context#1294

Merged
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
GlassBricks:fix-call-context
Jun 24, 2022
Merged

Fix call context#1294
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
GlassBricks:fix-call-context

Conversation

@GlassBricks
Copy link
Copy Markdown
Contributor

@GlassBricks GlassBricks commented Jun 23, 2022

Fixes #1292, which was broken by #1282

To still keep #1262, I couldn't find an elegant way to detect jsx createElement calls specifically. Instead I found a condition that tells if a call is probably jsx createElement (see changes in call.ts).

Maybe the best thing to do is to revert #1282, and document that the this parameter is always required for jsx createElement.

if (ts.nodeIsSynthesized(node.expression)) {
// this includes JSX createElement calls
// For this we use noImplicitSelf option
return !context.options.noImplicitSelf;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can't we just use this return for any node without declaration? In what case does this fail?

Copy link
Copy Markdown
Contributor Author

@GlassBricks GlassBricks Jun 24, 2022

Choose a reason for hiding this comment

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

I just checked and that works, will change.

I somehow recall that doing that broke some tests, I guess that is (no longer?) the case.

@Perryvw Perryvw merged commit 70b61d9 into TypeScriptToLua:master Jun 24, 2022
@GlassBricks GlassBricks deleted the fix-call-context branch July 2, 2022 15:50
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.

Function calls with this parameter break when using noImplicitSelf

2 participants