diff options
author | paltherr <paltherr@epfl.ch> | 2003-12-03 11:51:50 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-12-03 11:51:50 +0000 |
commit | c8437e055e2c499f558ed881e1c3cd2da33f0abd (patch) | |
tree | 2a963a312f5bc2348858b5c1b29c9fd3eaafe93f /sources | |
parent | 18f69a76c24a0b70228960214ae16b4ba9ff8ff8 (diff) | |
download | scala-c8437e055e2c499f558ed881e1c3cd2da33f0abd.tar.gz scala-c8437e055e2c499f558ed881e1c3cd2da33f0abd.tar.bz2 scala-c8437e055e2c499f558ed881e1c3cd2da33f0abd.zip |
- Added Switch node
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scala/tools/scalai/Code.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sources/scala/tools/scalai/Code.java b/sources/scala/tools/scalai/Code.java index b8029f0089..dcd3ec3d3e 100644 --- a/sources/scala/tools/scalai/Code.java +++ b/sources/scala/tools/scalai/Code.java @@ -29,6 +29,7 @@ public class Code { public case If(Code cond, Code thenp, Code elsep); public case Or(Code lf, Code rg); public case And(Code lf, Code rg); + public case Switch(Code test, int[] tags, Code[] bodies, Code otherwise); public case IsScala(Code target, Symbol symbol); public case IsJava(Code target, Class clasz); @@ -91,6 +92,17 @@ public class Code { case And(Code lf, Code rg): return "And(" + lf + "," + rg + ")"; + case Switch(Code test, int[] tags, Code[] bodies, Code otherwise): + StringBuffer buffer = new StringBuffer(); + buffer.append("Switch(" + test + ",\n"); + for (int i = 0; i < bodies.length; i++) { + buffer.append(tags[i]).append(" => ").append(bodies[i]); + buffer.append(",\n"); + } + buffer.append("_ => ").append(otherwise); + buffer.append(")"); + return buffer.toString(); + case IsScala(Code target, Symbol symbol): return "IsScala(" + target + "," + symbol + ")"; |