diff options
-rw-r--r-- | lib/fjbg.jar.desired.sha1 | 2 | ||||
-rw-r--r-- | src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/fjbg.jar.desired.sha1 b/lib/fjbg.jar.desired.sha1 index 1b1068b0d3..d24a5d01fc 100644 --- a/lib/fjbg.jar.desired.sha1 +++ b/lib/fjbg.jar.desired.sha1 @@ -1 +1 @@ -9aa9c99b8032e454f1f85d27de31a88b3dec1045 ?fjbg.jar +c3f9b576c91cb9761932ad936ccc4a71f33d2ef2 ?fjbg.jar diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java b/src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java index 8b0338ed29..d4c5417260 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JExtendedCode.java @@ -596,6 +596,16 @@ public class JExtendedCode extends JCode { double minDensity) { assert keys.length == branches.length; + //The special case for empty keys. It makes sense to allow + //empty keys and generate LOOKUPSWITCH with defaultBranch + //only. This is exactly what javac does for switch statement + //that has only a default case. + if (keys.length == 0) { + emitLOOKUPSWITCH(keys, branches, defaultBranch); + return; + } + //the rest of the code assumes that keys.length > 0 + // sorting the tables // FIXME use quicksort for (int i = 1; i < keys.length; i++) { |