We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 41a5023 commit 6c42b5cCopy full SHA for 6c42b5c
2 files changed
src/backend/llvm/code-generation/if-statement.ts
@@ -28,7 +28,9 @@ export class IfStatementCodeGenerator implements NodeGenerateInterface<ts.IfStat
28
builder.setInsertionPoint(negativeBlock);
29
passNode(node.elseStatement, ctx, builder);
30
31
- builder.createBr(next);
+ if (!negativeBlock.getTerminator()) {
32
+ builder.createBr(next);
33
+ }
34
} else {
35
emitCondition(
36
node.expression,
tests/snapshots/general/branch.ts
@@ -0,0 +1,19 @@
1
+
2
+{
3
+ function compareWithReturnInElse(left: number, right: number): string {
4
+ console_log("compareWithReturnInElse");
5
+ console_log(left);
6
+ console_log(right);
7
8
+ if (left == right) {
9
10
+ } else {
11
+ return "false";
12
13
14
+ return "true";
15
16
17
+ compareWithReturnInElse(1, 5);
18
+ compareWithReturnInElse(5, 1);
19
+}
0 commit comments