diff options
author | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-03-07 12:52:10 +0100 |
---|---|---|
committer | Miguel Garcia <miguelalfredo.garcia@epfl.ch> | 2012-03-07 12:52:10 +0100 |
commit | 3e4620c3b961c63d38fe5bedd095009e6c53102a (patch) | |
tree | 01880f7c2c883064d0d281842bc2308f3f2acf33 /src/compiler | |
parent | 4c6ca5684b77ad63561dabfce1b23efe3bdbacac (diff) | |
download | scala-3e4620c3b961c63d38fe5bedd095009e6c53102a.tar.gz scala-3e4620c3b961c63d38fe5bedd095009e6c53102a.tar.bz2 scala-3e4620c3b961c63d38fe5bedd095009e6c53102a.zip |
same story: inspector method beats pattern matching
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index dc8526c73a..f4b0c4cd66 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1402,24 +1402,18 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with val className = javaName(cls) jcode emitNEW className - case CREATE_ARRAY(elem, 1) => elem match { - case REFERENCE(_) | ARRAY(_) => - jcode emitANEWARRAY javaType(elem).asInstanceOf[JReferenceType] - case _ => - jcode emitNEWARRAY javaType(elem) - } + case CREATE_ARRAY(elem, 1) => + if(elem.isRefOrArrayType) { jcode emitANEWARRAY javaType(elem).asInstanceOf[JReferenceType] } + else { jcode emitNEWARRAY javaType(elem) } case CREATE_ARRAY(elem, dims) => jcode.emitMULTIANEWARRAY(javaType(ArrayN(elem, dims)).asInstanceOf[JReferenceType], dims) case IS_INSTANCE(tpe) => tpe match { - case REFERENCE(cls) => - jcode emitINSTANCEOF new JObjectType(javaName(cls)) - case ARRAY(elem) => - jcode emitINSTANCEOF new JArrayType(javaType(elem)) - case _ => - abort("Unknown reference type in IS_INSTANCE: " + tpe) + case REFERENCE(cls) => jcode emitINSTANCEOF new JObjectType(javaName(cls)) + case ARRAY(elem) => jcode emitINSTANCEOF new JArrayType(javaType(elem)) + case _ => abort("Unknown reference type in IS_INSTANCE: " + tpe) } case CHECK_CAST(tpe) => |