diff options
author | buraq <buraq@epfl.ch> | 2003-12-02 15:35:23 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2003-12-02 15:35:23 +0000 |
commit | a24fb5cd32797d39c26d49d50e221090a3516598 (patch) | |
tree | bd0d2b2b64162227cf0781ab04d3a80a46b205e0 /sources/scalac/ast/TreeGen.java | |
parent | b9fb541ab25c57c9c0817ecddd03b8e3bc8ca885 (diff) | |
download | scala-a24fb5cd32797d39c26d49d50e221090a3516598.tar.gz scala-a24fb5cd32797d39c26d49d50e221090a3516598.tar.bz2 scala-a24fb5cd32797d39c26d49d50e221090a3516598.zip |
added debugprint code creation
Diffstat (limited to 'sources/scalac/ast/TreeGen.java')
-rw-r--r-- | sources/scalac/ast/TreeGen.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java index 1df5678920..c1fc1ebeea 100644 --- a/sources/scalac/ast/TreeGen.java +++ b/sources/scalac/ast/TreeGen.java @@ -725,12 +725,16 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { return If(cond.pos, cond, thenpart, elsepart); } - /** Builds a Switch node with given components and type. */ + /** Builds a Switch node with given components and type. + * @param tags a <b>sorted</b> array of tags + */ public Switch Switch(int pos, Tree test, int[] tags, Tree[] bodies, Tree otherwise, Type type) { - for (int i = 0; i < bodies.length; i++) + for (int i = 0; i < bodies.length; i++) { assert assertTreeSubTypeOf(bodies[i], type); + assert (i==0) || ( tags[i-1] < tags[i] ) : "expecting sorted tags"; + } assert assertTreeSubTypeOf(otherwise, type); Switch tree = make.Switch(pos, test, tags, bodies, otherwise); tree.setType(type); @@ -1167,4 +1171,20 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { } + // for insert debug printing code + + public Tree Console_print(int pos, String str) { + return Console_print( pos, mkStringLit( pos, str )); + } + + public Tree Console_print(int pos, Tree arg) { + Symbol sym = global.definitions.getModule( Names.scala_Console ); + return Apply( Select( pos, + mkRef( pos, sym), + global.definitions.CONSOLE_PRINT()), + new Tree[] { + arg + }); + } + } |