public override void Visit(ArrayIndexingExpression node) { var arrayType = node.ArrayExpr.Type; if (!(arrayType is ErrorType) && !(arrayType is ArrayType)) { // Only arrays can be indexed. Resolving errors are ignored. ReportError( ErrorTypes.TypeError, String.Format("Cannot index into expression of type {0}.", arrayType.Name), node); } var indexType = node.IndexExpr.Type; if (!indexType.IsAssignableTo(_parent._symbolTable.ResolveType(MiniJavaInfo.IntType).Type)) { // Array must be indexed with an expression that evaluates into an int value. ReportError(ErrorTypes.TypeError, "Invalid array index.", node); } }
public override void Visit(ArrayIndexingExpression node) { HandleExpressionOrStatementNode(node); }