diff options
-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)); } |