diff options
author | mihaylov <mihaylov@epfl.ch> | 2004-06-08 09:25:44 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2004-06-08 09:25:44 +0000 |
commit | b0b5b5fc12aab119453520185414ebf31dfdcc66 (patch) | |
tree | ac430385c40d4f557c5e3afcbc0bc2a4770381bf /sources/scalac | |
parent | 794a8601bf92ae031f6c9d56826971fe109ea37a (diff) | |
download | scala-b0b5b5fc12aab119453520185414ebf31dfdcc66.tar.gz scala-b0b5b5fc12aab119453520185414ebf31dfdcc66.tar.bz2 scala-b0b5b5fc12aab119453520185414ebf31dfdcc66.zip |
- Perform the primitive type conversion instead...
- Perform the primitive type conversion instead of calling the static
methods of class RunTime (just moved the code that implements it where
it can take effect)
Diffstat (limited to 'sources/scalac')
-rw-r--r-- | sources/scalac/backend/msil/GenMSIL.java | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/sources/scalac/backend/msil/GenMSIL.java b/sources/scalac/backend/msil/GenMSIL.java index 4483840792..c4cc878bb2 100644 --- a/sources/scalac/backend/msil/GenMSIL.java +++ b/sources/scalac/backend/msil/GenMSIL.java @@ -754,10 +754,16 @@ public final class GenMSIL { : items.StackItem(retType); return coerce(i, resType); } - //throw Debug.abort("" + Debug.show(sym)); assert sym.isStatic() : Debug.show(sym); lastExpr = tmpLastExpr; - //emitThis(); + + MSILType convTo = primitiveConvert(sym); + if (convTo != null) { + assert args.length == 1; + genLoad(args[0], convTo); + return items.StackItem(convTo); + } + return check(invokeMethod(sym, args, resType, true)); case Select(Tree qualifier, _): @@ -769,9 +775,8 @@ public final class GenMSIL { if (sym == defs.ANY_BANGEQ) { return negate(genEq(qualifier, args[0])); } - // java.lang.String.substring(int, int) - // needs emulation due to diffenerent semantics - // from System.String.Substring + // java.lang.String.substring(int start, int end) needs conversion + // to System.String.Substring(int start, int length) if (sym == tc.SYM_SUBSTRING_INT_INT) { assert args.length == 2; genLoad(qualifier, MSILType.STRING); @@ -855,13 +860,6 @@ public final class GenMSIL { } } - MSILType convTo = primitiveConvert(sym); - if (convTo != null) { - assert args.length == 1; - genLoad(args[0], convTo); - return items.StackItem(convTo); - } - switch (qualifier.type) { case TypeRef(_, _, _): case SingleType(_, _): @@ -1277,7 +1275,7 @@ public final class GenMSIL { return msilType(t).asPrimitive(); //case NULL: case ARRAY(_): - throw Debug.abort("primitiveType: cannot convert " + mtype); + throw Debug.abort("cannot convert " + mtype); default: return mtype; } @@ -2075,6 +2073,15 @@ final class MSILType { return !isReferenceType(); } + public boolean isEnum() { + switch (this) { + case REF(Type t): + return t.BaseType == pp.ENUM; + default: + return false; + } + } + public boolean isType(Type type) { return equals(fromType(type)); } |