diff options
author | buraq <buraq@epfl.ch> | 2003-10-02 16:21:54 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2003-10-02 16:21:54 +0000 |
commit | 041659f9cce428b73dd0895864cc4328796753a8 (patch) | |
tree | 8d49e0e2c475d389534c5d25830e75b86653a917 | |
parent | ae0b5fd298099b69c20f92761c2dc083fb591822 (diff) | |
download | scala-041659f9cce428b73dd0895864cc4328796753a8.tar.gz scala-041659f9cce428b73dd0895864cc4328796753a8.tar.bz2 scala-041659f9cce428b73dd0895864cc4328796753a8.zip |
added methods for constructing Cons and Nil
-rw-r--r-- | sources/scalac/ast/TreeGen.java | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java index b0977665d2..dc9f8c8005 100644 --- a/sources/scalac/ast/TreeGen.java +++ b/sources/scalac/ast/TreeGen.java @@ -127,10 +127,16 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { /** Builds an integer literal */ public Tree mkIntLit(int pos, int value) { - return make.Literal(pos, new Integer(value)). - setType(definitions.INT_TYPE); + return mkIntLit( pos, new Integer(value)); } + /** Builds an integer literal */ + public Tree mkIntLit(int pos, Integer value) { + return make.Literal(pos, value) + .setType(definitions.INT_TYPE); + } + + /** Builds a long literal. */ public Tree mkLongLit(int pos, long value) { return make.Literal(pos, new Long(value)). @@ -799,4 +805,20 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { return Block(new Tree[]{tmpdef, expr}); } } + + // refactoring duplicate code of LambdaLift and CodeFactory + + public Tree Nil(int pos) { + return mkRef(pos, global.definitions.getModule(Names.scala_Nil)); + } + + public Tree Cons(int pos, Type elemtpe, Tree hd, Tree tl) { + return New(mkPrimaryConstr(pos, + global.definitions + .getClass( Names.scala_COLONCOLON ), + new Type[] { elemtpe }, + new Tree[] { hd, tl })); + + } + } |