X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fcodegen%2Fssa%2Fexits%2FSwitch.java;h=55f38f809b540acbea4e3cf7baa47877e5965e1d;hp=b3584ae7e53692c5196bcf0f9f575723296f5117;hb=91682baa9a8252390f09b80fd724f47e5957b234;hpb=3826e289058a51d09310b7ba1251e959dc0ed3d0 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Switch.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Switch.java index b3584ae7e..55f38f809 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Switch.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Switch.java @@ -34,7 +34,8 @@ public class Switch extends SSAExit implements ValRefBinder { ValRef scrutinee; BranchRef[] branches; - public Switch(ValRef scrutinee, BranchRef[] branches) { + public Switch(int lineNumber, ValRef scrutinee, BranchRef[] branches) { + super(lineNumber); this.scrutinee = scrutinee; this.branches = branches; scrutinee.setParent(this); @@ -90,6 +91,7 @@ public class Switch extends SSAExit implements ValRefBinder { @Override public void generateCode(MethodBuilder mb) { + mb.lineNumber(lineNumber); if(isIntegerSwitch()) { generateIntegerSwitch(mb); return; @@ -168,7 +170,7 @@ public class Switch extends SSAExit implements ValRefBinder { @Override public SSAExit copy(CopyContext context) { - return new Switch(context.copy(scrutinee), + return new Switch(lineNumber, context.copy(scrutinee), BranchRef.copy(context, branches)); } @@ -221,10 +223,11 @@ public class Switch extends SSAExit implements ValRefBinder { SSAExit newExit; if(thenTarget == elseTarget) { scrutinee.remove(); - newExit = new Jump(thenTarget); + newExit = new Jump(lineNumber, thenTarget); } else { - newExit = new If(scrutinee, + newExit = new If(lineNumber, + scrutinee, thenTarget, elseTarget); } @@ -234,7 +237,7 @@ public class Switch extends SSAExit implements ValRefBinder { } else if(branches.length == 1 && isConstructorParameterless(branches[0])) { scrutinee.remove(); - getParent().setExit(new Jump(branches[0].cont)); + getParent().setExit(new Jump(lineNumber, branches[0].cont)); } }