Skip to content

support in transformer for assignments#299

Merged
Perryvw merged 3 commits intoTypeScriptToLua:multiphase-transpilefrom
tomblind:multiphase-transpile
Dec 9, 2018
Merged

support in transformer for assignments#299
Perryvw merged 3 commits intoTypeScriptToLua:multiphase-transpilefrom
tomblind:multiphase-transpile

Conversation

@tomblind
Copy link
Copy Markdown
Collaborator

@tomblind tomblind commented Dec 6, 2018

Everything works (tests are passing), but this could probably use some cleanup/refactoring.

Note, I had to do some split code paths to deal with statements vs expressions.

I noticed in the TS source, operators like +=, -=, etc... are referred to as 'compound assignment operators" so I'm sticking with that terminology for those.

@tomblind
Copy link
Copy Markdown
Collaborator Author

tomblind commented Dec 6, 2018

Looks like I have tests to fix...

src/TSHelper.ts Outdated
return [false, null];
}

public static isNonCompoundPrefixUnaryOperator(node: ts.PrefixUnaryExpression): boolean {
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.

Would it not be nicer to have the opposite of this function and just use a negation where you need this? Depends on what the most common case is I guess.

src/TSHelper.ts Outdated
|| ts.isForStatement(node.parent);
}

public static createLuaConcatExpression(left: ts.Expression, right: ts.Expression): LuaConcatExpression {
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.

I think @lolleko made a TransformHelper.ts for functions like these.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Totally missed it! I'll move these over.

@tomblind
Copy link
Copy Markdown
Collaborator Author

tomblind commented Dec 9, 2018

Current outstanding issues:
-destructuring into variable declarations doesn't work correctly and breaks a lot of tests
-getters/setters not yet supported

@Perryvw Perryvw merged commit a8589f1 into TypeScriptToLua:multiphase-transpile Dec 9, 2018
@tomblind tomblind deleted the multiphase-transpile branch January 1, 2019 12:45
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.

2 participants