public override AstNode VisitArrayLookup(ArrayLookup ast) { Visit(ast.Array); ArrayType arrayType = ast.Array.ExpressionType as ArrayType; if (arrayType == null) { AddError(c_SE_ExpressionNotArray, ast.IndexSpan); } else if (arrayType.ElementType != PrimaryType.Int) { AddError(c_SE_NotSupported, ast.IndexSpan, "Arrays rather than int[] are not operatable"); } Visit(ast.Index); if (ast.Index.ExpressionType != PrimaryType.Int) { AddError(c_SE_InvalidCast, ast.IndexSpan, ast.Index.ExpressionType.Name, PrimaryType.Int.Name); } ast.ExpressionType = arrayType == null ? PrimaryType.Unknown : arrayType.ElementType; return(ast); }
public override AstNode VisitArrayLookup(ArrayLookup ast) { //push array to e-stack Visit(ast.Array); //push index Visit(ast.Index); m_ilgen.Emit(OpCodes.Ldelem_I4); return(ast); }
public override AstNode VisitArrayLookup(ArrayLookup ast) { //push array to e-stack Visit(ast.Array); //push index Visit(ast.Index); m_ilgen.Emit(OpCodes.Ldelem_I4); return ast; }
public override AstNode VisitArrayLookup(ArrayLookup ast) { Visit(ast.Array); ArrayType arrayType = ast.Array.ExpressionType as ArrayType; if (arrayType == null) { m_errorManager.AddError(c_SE_ExpressionNotArray, ast.IndexSpan); } else if (arrayType.ElementType != PrimaryType.Int) { m_errorManager.AddError(c_SE_NotSupported, ast.IndexSpan, "Arrays rather than int[] are not operatable"); } Visit(ast.Index); if (ast.Index.ExpressionType != PrimaryType.Int) { m_errorManager.AddError(c_SE_InvalidCast, ast.IndexSpan, ast.Index.ExpressionType.Name, PrimaryType.Int.Name); } ast.ExpressionType = arrayType == null ? PrimaryType.Unknown : arrayType.ElementType; return ast; }
public virtual AstNode VisitArrayLookup(ArrayLookup ast) { return(ast); }