emitLdelem(MSILArrayElemType(elemType)); return items.StackItem(MSILType.BOOL);
MSILType mType = MSILArrayElemType(elemType); emitLdelem(mType); return items.StackItem(mType);
    private Item genApply(Tree fun, Tree[] args, MSILType resType) {	boolean tmpLastExpr = lastExpr; lastExpr = false;	Symbol sym = fun.symbol();	switch (fun) {	case Ident(_):	    Label l = (Label)sym2label.get(sym);	    if (l != null) {		lastExpr = false;		for (int i = 0; i < args.length; i++)		    genLoad(args[i], msilType(args[i].type));		for (int i = args.length; i > 0; i--)		    code.Emit(OpCodes.Starg_S, i);		code.Emit(OpCodes.Br, l);		willReturn = false;		return items.VoidItem();	    }	    lastExpr = tmpLastExpr;	    emitThis();	    return check(invokeMethod(sym, args, resType, true));	case Select(Tree qualifier, _):	    // scala.Any.==	    if (sym == defs.ANY_EQEQ) {		return genEq(qualifier, args[0]);	    }	    // scala.Any.!=	    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	    if (sym == tc.SYM_SUBSTRING_INT_INT) {		assert args.length == 2;		genLoad(qualifier, MSILType.STRING);		genLoad(args[0], MSILType.I4);		code.Emit(OpCodes.Dup);		code.Emit(OpCodes.Neg);		genLoad(args[1], MSILType.I4);		code.Emit(OpCodes.Add);		code.Emit(OpCodes.Call, tc.SUBSTRING_INT_INT);		return items.StackItem(MSILType.STRING);	    }	    if (sym == tc.SYM_COMPARE_TO_IGNORE_CASE) {		assert args.length == 1;		genLoad(qualifier, MSILType.STRING);		genLoad(args[0], MSILType.STRING);		code.Emit(OpCodes.Ldc_I4_1);		code.Emit(OpCodes.Call, tc.COMPARE_TO_IGNORE_CASE);		return items.StackItem(MSILType.STRING);	    }	    if (isPrimitiveArrayOp(sym)) {		Primitive prim = primitives.getPrimitive(sym);		loadArgs(args, tc.getMethod(sym).GetParameters());		Type elemType = getArrayElemType(prim);		switch (prim) {		case ZARRAY_LENGTH: case BARRAY_LENGTH: case SARRAY_LENGTH:		case CARRAY_LENGTH: case IARRAY_LENGTH: case LARRAY_LENGTH:		case FARRAY_LENGTH: case DARRAY_LENGTH: case OARRAY_LENGTH:		    code.Emit(OpCodes.Ldlen);		    return items.StackItem(MSILType.I4);		case NEW_ZARRAY:		case NEW_BARRAY:		case NEW_SARRAY:		case NEW_CARRAY:		case NEW_IARRAY:		case NEW_LARRAY:		case NEW_FARRAY:		case NEW_DARRAY:		    //case NEW_OARRAY:		    code.Emit(OpCodes.Newarr, elemType);		    return items.StackItem(MSILType.ARRAY(msilType(elemType)));		case ZARRAY_GET: case BARRAY_GET: case SARRAY_GET:		case CARRAY_GET: case IARRAY_GET: case LARRAY_GET:		case FARRAY_GET: case DARRAY_GET: case OARRAY_GET:		    emitLdelem(MSILArrayElemType(elemType));		    return items.StackItem(MSILType.BOOL);		case ZARRAY_SET: case BARRAY_SET: case SARRAY_SET:		case CARRAY_SET: case IARRAY_SET: case LARRAY_SET:		case FARRAY_SET: case DARRAY_SET: case OARRAY_SET:		    emitStelem(MSILArrayElemType(elemType));		    return items.VoidItem();		}	    }  	    if (isPrimitiveOp(sym)) {		assert args.length <= 1;		Tree right = args.length > 0 ? args[0] : Tree.Empty;		return primitiveOp(qualifier, sym, right, resType); 	    }	    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(_, _):	    case ThisType(_):		MethodBase method = tc.getMethod(sym);		boolean virtualCall = false;		if (!method.IsStatic() || becomesStatic(sym)) {		    // FIXME: after the Super attribution is correct		    switch (qualifier) {		    case Super(_, _):			load(items.SelfItem(tc.getType(currentClass)));			break;		    default:			genLoad(qualifier, msilType(qualifier));			virtualCall = true;		    }		}		lastExpr = tmpLastExpr;		return check(invokeMethod(sym, args, resType, virtualCall));	    default:		throw new ApplicationError(Debug.show(fun));	    } // switch(qualifier.type) 	case TypeApply(Tree tfun, Tree[] targs):	    final Symbol tsym = tfun.symbol();	    if (primitives.isPrimitive(tsym)) {		return primitiveOp(((Select)tfun).qualifier,				   tsym, targs[0], resType);	    }	    throw new ApplicationError(Debug.show(fun));	default:	    throw new ApplicationError(Debug.show(fun));	} // switch (fun)    } //genApply()