public void CompileArray(Emitter.Emitter emitter) { // make sure it's an array var type = emitter.GetArrayItemType(ExpressionPrefix.GetExpressionType(emitter)); if (type == "") Error(Resources.errIndexingNotAnArray); // make sure expression type matches array type var exprType = Expression.GetExpressionType(emitter); if (!emitter.TypeIsParent(type, exprType)) Error(String.Format(Resources.errAssignTypeMismatch, exprType, type)); ExpressionPrefix.Compile(emitter); Index.Compile(emitter); if (type == "complex") { // special case of valuetypes var typeRef = emitter.ResolveType(type); emitter.EmitLoadIndexAddress(typeRef); Expression.Compile(emitter); emitter.EmitSaveObject(typeRef); } else { Expression.Compile(emitter); emitter.EmitSaveIndex(type); } }