diff options
author | schinz <schinz@epfl.ch> | 2005-03-14 16:11:21 +0000 |
---|---|---|
committer | schinz <schinz@epfl.ch> | 2005-03-14 16:11:21 +0000 |
commit | 105ddb769e97e0f2957648ab5826c9e326fe781f (patch) | |
tree | a6f4310450fc57542ecb895714330da8a1d380d9 /sources/scalac/atree/AConstant.java | |
parent | 26743f690b55e5eb7ecd922e99030ffcc26826b7 (diff) | |
download | scala-105ddb769e97e0f2957648ab5826c9e326fe781f.tar.gz scala-105ddb769e97e0f2957648ab5826c9e326fe781f.tar.bz2 scala-105ddb769e97e0f2957648ab5826c9e326fe781f.zip |
- added a new kind of literal, SYMBOL_NAME, whi...
- added a new kind of literal, SYMBOL_NAME, which is a string literal
whose value is the name of the attached symbol
Diffstat (limited to 'sources/scalac/atree/AConstant.java')
-rw-r--r-- | sources/scalac/atree/AConstant.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sources/scalac/atree/AConstant.java b/sources/scalac/atree/AConstant.java index 9bb2eb29b4..2dcc80bbaf 100644 --- a/sources/scalac/atree/AConstant.java +++ b/sources/scalac/atree/AConstant.java @@ -9,6 +9,7 @@ package scalac.atree; import scalac.util.Debug; +import scalac.symtab.Symbol; /** This class represents a constant. */ public class AConstant { @@ -26,6 +27,7 @@ public class AConstant { public case FLOAT(float value); public case DOUBLE(double value); public case STRING(String value); + public case SYMBOL_NAME(Symbol value); public case NULL; public case ZERO; @@ -54,6 +56,7 @@ public class AConstant { case DOUBLE(_): return ATypeKind.R8; case STRING(_): + case SYMBOL_NAME(_): return ATypeKind.STR; case NULL: return ATypeKind.NULL; @@ -252,6 +255,8 @@ public class AConstant { return String.valueOf(value); case STRING(String value): return value; + case SYMBOL_NAME(Symbol value): + return value.name.toString(); case NULL: return String.valueOf(null); default: @@ -335,6 +340,13 @@ public class AConstant { default: return false; } + case SYMBOL_NAME(Symbol ivalue): + switch (that) { + case SYMBOL_NAME(Symbol avalue): + return ivalue == avalue; + default: + return false; + } case NULL: return false; case ZERO: @@ -370,6 +382,8 @@ public class AConstant { return (int)(bits ^ (bits >>> 32)); case STRING(String value): return value.hashCode(); + case SYMBOL_NAME(Symbol value): + return value.hashCode(); case NULL: return 0; case ZERO: |