Skip to content

Feature/small bugfixes#475

Merged
Perryvw merged 10 commits intomasterfrom
feature/small-bugfixes
Mar 15, 2019
Merged

Feature/small bugfixes#475
Perryvw merged 10 commits intomasterfrom
feature/small-bugfixes

Conversation

@Perryvw
Copy link
Copy Markdown
Member

@Perryvw Perryvw commented Mar 10, 2019

Fixed an issue where const foo = class Bar {} would translate as:

local foo = (function()
    local Bar = Bar or {};
    -- ...
    return ____;
end)()

The function will now just return Bar.

Also swapped around the meaning of right shift operators. Fixes #471

@Perryvw Perryvw requested review from lolleko and tomblind and removed request for lolleko March 10, 2019 19:53
let className = statement.name ? this.transformIdentifier(statement.name) : nameOverride;
let className = statement.name
? this.transformIdentifier(statement.name)
: tstl.createIdentifier("____");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There's actually a tstl.createAnnonymousIdentifier() function which can be used for these identifiers now.

public transformClassExpression(expression: ts.ClassExpression): ExpressionVisitResult {
const className = expression.name !== undefined
? this.transformIdentifier(expression.name)
: tstl.createIdentifier("____");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same as above

[tstl.SyntaxKind.BitwiseOrOperator]: "|",
[tstl.SyntaxKind.BitwiseExclusiveOrOperator]: "~",
[tstl.SyntaxKind.BitwiseRightShiftOperator]: ">>",
[tstl.SyntaxKind.BitwiseArithmeticRightShift]: ">>>",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be good to remove BitwiseArithmeticRightShift from AST, since it's not really a valid token

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seconded - it doesn't make sense to have AST kinds for things that don't exist in lua.

@Perryvw Perryvw requested a review from tomblind March 11, 2019 19:21
[tstl.SyntaxKind.BitwiseOrOperator]: "|",
[tstl.SyntaxKind.BitwiseExclusiveOrOperator]: "~",
[tstl.SyntaxKind.BitwiseRightShiftOperator]: ">>",
[tstl.SyntaxKind.BitwiseArithmeticRightShift]: ">>>",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seconded - it doesn't make sense to have AST kinds for things that don't exist in lua.

case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
return this.transformBinaryBitOperation(tsOriginal, left, right, operator);
case ts.SyntaxKind.PlusToken:
if (ts.isBinaryExpression(tsOriginal)) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this necessary here? Won't transformBinaryOperator already do this?

@Perryvw Perryvw merged commit d9103e8 into master Mar 15, 2019
@Perryvw Perryvw deleted the feature/small-bugfixes branch March 15, 2019 09:28
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.

4 participants