diff options
author | paltherr <paltherr@epfl.ch> | 2003-11-06 14:03:54 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-11-06 14:03:54 +0000 |
commit | e721ad85bbb88951a6a84e9427f576d492cfbae9 (patch) | |
tree | 7710a692b4c6774215b89afb2db9543a6d814021 /sources/scalac/atree | |
parent | 8e697fc00d89d4027baf2217c373c3ff11eec36a (diff) | |
download | scala-e721ad85bbb88951a6a84e9427f576d492cfbae9.tar.gz scala-e721ad85bbb88951a6a84e9427f576d492cfbae9.tar.bz2 scala-e721ad85bbb88951a6a84e9427f576d492cfbae9.zip |
- Removed atree/ACodeFactory.java
- Added atree/ATreeFactory.java
Diffstat (limited to 'sources/scalac/atree')
-rw-r--r-- | sources/scalac/atree/ATreeFactory.java (renamed from sources/scalac/atree/ACodeFactory.java) | 133 |
1 files changed, 115 insertions, 18 deletions
diff --git a/sources/scalac/atree/ACodeFactory.java b/sources/scalac/atree/ATreeFactory.java index 141814fd12..be6d0e563a 100644 --- a/sources/scalac/atree/ACodeFactory.java +++ b/sources/scalac/atree/ATreeFactory.java @@ -12,8 +12,8 @@ import scalac.ast.Tree; import scalac.symtab.Symbol; import scalac.symtab.Type; -/** This class implements an attributed code factory. */ -public class ACodeFactory { +/** This class implements an attributed tree factory. */ +public class ATreeFactory { //######################################################################## // Public Fields @@ -21,59 +21,68 @@ public class ACodeFactory { /** The unique Void node */ public final ACode Void = ACode.Void; + /** The unique UNIT constant */ + public final AConstant UNIT = AConstant.UNIT; + + /** The unique NULL constant */ + public final AConstant NULL = AConstant.NULL; + + /** The unique ZERO constant */ + public final AConstant ZERO = AConstant.ZERO; + //######################################################################## - // Public Methods + // Public Methods - Building code - /** Creates a This node. */ + /** Builds a This node. */ public ACode This(Tree t, Symbol clasz) { ACode.This code = ACode.This(clasz); code.pos = t.pos; return code; } - /** Creates a Constant node. */ + /** Builds a Constant node. */ public ACode Constant(Tree t, AConstant constant) { ACode.Constant code = ACode.Constant(constant); code.pos = t.pos; return code; } - /** Creates a Load node. */ + /** Builds a Load node. */ public ACode Load(Tree t, ALocation location) { ACode.Load code = ACode.Load(location); code.pos = t.pos; return code; } - /** Creates a Store node. */ + /** Builds a Store node. */ public ACode Store(Tree t, ALocation location, ACode value) { ACode.Store code = ACode.Store(location, value); code.pos = t.pos; return code; } - /** Creates an Apply node. */ + /** Builds an Apply node. */ public ACode Apply(Tree t, AFunction function, Type[] targs,ACode[] vargs){ ACode.Apply code = ACode.Apply(function, targs, vargs); code.pos = t.pos; return code; } - /** Creates an IsAs node. */ + /** Builds an IsAs node. */ public ACode IsAs(Tree t, ACode value, Type type, boolean cast) { ACode.IsAs code = ACode.IsAs(value, type, cast); code.pos = t.pos; return code; } - /** Creates an If node. */ + /** Builds an If node. */ public ACode If(Tree t, ACode test, ACode success, ACode failure) { ACode.If code = ACode.If(test, success, failure); code.pos = t.pos; return code; } - /** Creates a Switch node. */ + /** Builds a Switch node. */ public ACode Switch(Tree t, ACode test, int[][] tags, ACode[] bodies, ACode other) { @@ -82,49 +91,49 @@ public class ACodeFactory { return code; } - /** Creates a Synchronized node. */ + /** Builds a Synchronized node. */ public ACode Synchronized(Tree t, ACode lock, ACode value) { ACode.Synchronized code = ACode.Synchronized(lock, value); code.pos = t.pos; return code; } - /** Creates a Block node. */ + /** Builds a Block node. */ public ACode Block(Tree t, Symbol[] locals,ACode[] statements,ACode value){ ACode.Block code = ACode.Block(locals, statements, value); code.pos = t.pos; return code; } - /** Creates a Label node. */ + /** Builds a Label node. */ public ACode Label(Tree t, Symbol label, Symbol[] locals, ACode value) { ACode.Label code = ACode.Label(label, locals, value); code.pos = t.pos; return code; } - /** Creates a Goto node. */ + /** Builds a Goto node. */ public ACode Goto(Tree t, Symbol label, ACode[] vargs) { ACode.Goto code = ACode.Goto(label, vargs); code.pos = t.pos; return code; } - /** Creates a Return node. */ + /** Builds a Return node. */ public ACode Return(Tree t, Symbol function, ACode value) { ACode.Return code = ACode.Return(function, value); code.pos = t.pos; return code; } - /** Creates a Throw node. */ + /** Builds a Throw node. */ public ACode Throw(Tree t, ACode value) { ACode.Throw code = ACode.Throw(value); code.pos = t.pos; return code; } - /** Creates a Drop node. */ + /** Builds a Drop node. */ public ACode Drop(Tree t, ACode value, Type type) { ACode.Drop code = ACode.Drop(value, type); code.pos = t.pos; @@ -132,4 +141,92 @@ public class ACodeFactory { } //######################################################################## + // Public Methods - Building constants + + /** Builds a BOOLEAN constant of given value. */ + public AConstant BOOLEAN(Boolean value) { + return BOOLEAN(value.booleanValue()); + } + + /** Builds a BOOLEAN constant of given value. */ + public AConstant BOOLEAN(boolean value) { + return AConstant.BOOLEAN(value); + } + + /** Builds a BYTE constant of given value. */ + public AConstant BYTE(Byte value) { + return BYTE(value.byteValue()); + } + + /** Builds a BYTE constant of given value. */ + public AConstant BYTE(byte value) { + return AConstant.BYTE(value); + } + + /** Builds a SHORT constant of given value. */ + public AConstant SHORT(Short value) { + return SHORT(value.shortValue()); + } + + /** Builds a SHORT constant of given value. */ + public AConstant SHORT(short value) { + return AConstant.SHORT(value); + } + + /** Builds a CHAR constant of given value. */ + public AConstant CHAR(Character value) { + return CHAR(value.charValue()); + } + + /** Builds a CHAR constant of given value. */ + public AConstant CHAR(char value) { + return AConstant.CHAR(value); + } + + /** Builds an INT constant of given value. */ + public AConstant INT(Integer value) { + return INT(value.intValue()); + } + + /** Builds an INT constant of given value. */ + public AConstant INT(int value) { + return AConstant.INT(value); + } + + /** Builds a LONG constant of given value. */ + public AConstant LONG(Long value) { + return LONG(value.longValue()); + } + + /** Builds a LONG constant of given value. */ + public AConstant LONG(long value) { + return AConstant.LONG(value); + } + + /** Builds a FLOAT constant of given value. */ + public AConstant FLOAT(Float value) { + return FLOAT(value.floatValue()); + } + + /** Builds a FLOAT constant of given value. */ + public AConstant FLOAT(float value) { + return AConstant.FLOAT(value); + } + + /** Builds a DOUBLE constant of given value. */ + public AConstant DOUBLE(Double value) { + return DOUBLE(value.doubleValue()); + } + + /** Builds a DOUBLE constant of given value. */ + public AConstant DOUBLE(double value) { + return AConstant.DOUBLE(value); + } + + /** Builds a STRING constant of given value. */ + public AConstant STRING(String value) { + return AConstant.STRING(value); + } + + //######################################################################## } |