Skip to content

Commit b9f1d75

Browse files
committed
Feature(compiler): Support -- operator
1 parent 749bfa4 commit b9f1d75

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/backend/llvm/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,20 @@ function buildFromPostfixUnaryExpression(
353353
false
354354
);
355355
}
356+
case ts.SyntaxKind.MinusMinusToken: {
357+
const left = buildFromExpression(expr.operand, ctx, builder);
358+
359+
const next = builder.createFAdd(
360+
loadIfNeeded(left, builder, ctx),
361+
llvm.ConstantFP.get(ctx.llvmContext, -1)
362+
);
363+
364+
return builder.createStore(
365+
next,
366+
left,
367+
false
368+
);
369+
}
356370
default:
357371
throw new UnsupportedError(
358372
expr,

0 commit comments

Comments
 (0)