Skip to content

Commit 56b41f6

Browse files
author
Alex D
committed
more fixes
1 parent ac99e92 commit 56b41f6

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

src/emitterlua.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,17 +2683,24 @@ export class EmitterLua {
26832683
}
26842684

26852685
private processParenthesizedExpression(node: ts.ParenthesizedExpression) {
2686-
this.functionContext.textCode.push("(");
2686+
const skip =
2687+
node.expression.kind !== ts.SyntaxKind.TypeAssertionExpression
2688+
&& node.expression.kind !== ts.SyntaxKind.PropertyAccessExpression;
2689+
if (skip)
2690+
{
2691+
this.functionContext.textCode.push("(");
2692+
}
2693+
26872694
this.processExpression(node.expression);
2688-
this.functionContext.textCode.push(")");
2695+
2696+
if (skip)
2697+
{
2698+
this.functionContext.textCode.push(")");
2699+
}
26892700
}
26902701

26912702
private processTypeAssertionExpression(node: ts.TypeAssertion) {
26922703
this.processExpression(node.expression);
2693-
2694-
if (node.type.kind === ts.SyntaxKind.InterfaceDeclaration) {
2695-
//
2696-
}
26972704
}
26982705

26992706
private processPrefixUnaryExpression(node: ts.PrefixUnaryExpression): void {

test/test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
let a = 1;
2-
let count = 0;
3-
while (a) {
4-
a--;
5-
count++;
6-
}
7-
console.log(count);
1+
var a = { value: 1 };
2+
console.log(<any>(++((<any>a).value)));
3+
console.log(<any>(--((<any>a).value)));
4+
console.log(<any>(((<any>a).value)++));
5+
console.log(<any>(((<any>a).value)--));

0 commit comments

Comments
 (0)