Skip to content

Commit a2c6dca

Browse files
committed
fix accessor assignment
1 parent d22da21 commit a2c6dca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/LuaTransformer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1797,7 +1797,10 @@ export class LuaTransformer {
17971797
);
17981798
}
17991799

1800-
if (ts.isPropertyAccessExpression(expression.left) || ts.isElementAccessExpression(expression.left)) {
1800+
if (
1801+
ts.isPropertyAccessExpression(expression.left) && !tsHelper.hasSetAccessor(expression.left, this.checker)
1802+
|| ts.isElementAccessExpression(expression.left)
1803+
) {
18011804
// Left is property/element access: cache result while maintaining order of evaluation
18021805
// (function(o, i, v) o[i] = v; return v end)(${objExpression}, ${indexExpression}, ${right})
18031806
const objParameter = tstl.createIdentifier("o");

0 commit comments

Comments
 (0)