private IrisType ProcessArrayAccess(FilePosition fp, Symbol symbol, SymbolLoadMode mode) { IrisType symbolType = symbol.Type; IrisType resultType = IrisType.Invalid; if (symbolType != IrisType.Invalid) { if (!symbolType.IsArray) { AddError(fp, string.Format("Symbol '{0}' is not an array, but is being used as an array.", _lexeme)); } else { EmitLoadSymbol(symbol, SymbolLoadMode.Dereference); resultType = symbol.Type.GetElementType(); } } FilePosition indexerPosition = _lexer.TokenStartPosition; IrisType indexerType = ParseExpression(); if (indexerType != IrisType.Integer) { AddError(indexerPosition, "Expecting integer value as array index."); } Expect(Token.ChrCloseBracket); if (resultType != IrisType.Invalid) { if (mode == SymbolLoadMode.ElementAddress) { MethodGenerator.LoadElementAddress(resultType); resultType = resultType.MakeByRefType(); } else if (mode == SymbolLoadMode.Element) { MethodGenerator.LoadElement(resultType); } } return(resultType); }