public override void Visit(ArrayLookupExpressionNode node) { Console.WriteLine(this.indentation + "<Array>[<Index>]"); indentation = indentation + " "; Console.WriteLine(this.indentation + "Array"); indentation = indentation + " "; node.arrayExpression.Accept(this); indentation = indentation.Substring(0, indentation.Length - 3); Console.WriteLine(this.indentation + "Index"); indentation = indentation + " "; node.indexExpression.Accept(this); indentation = indentation.Substring(0, indentation.Length - 6); }
public override void Visit(ArrayLookupExpressionNode node) { GetValueOfIdentifier(((IdentifierExpressionNode)node.arrayExpression).identifier.name, "edx"); Gen("push", "edx"); node.indexExpression.Accept(this); Gen("pop", "edx"); Gen("mov", "eax", "[edx+4*eax+4]"); }
public virtual void Visit(ArrayLookupExpressionNode node) { node.arrayExpression.Accept(this); node.indexExpression.Accept(this); }
public override void Visit(ArrayLookupExpressionNode node) { if (!AreTypeCompatible(node.arrayExpression.GetType(), typeof(IdentifierExpressionNode))) throw new Exception("Array Lookup Expression must be an Identifier!"); node.arrayExpression.Accept(this); node.indexExpression.Accept(this); if (!AreTypeCompatible(node.arrayExpression.ExpressionType.GetType(), typeof(ArrayType))) throw new Exception("Array Identifier '" + ((IdentifierExpressionNode)node.arrayExpression).identifier.name + "' is not an array!"); if (!AreTypeCompatible(node.indexExpression.ExpressionType.GetType(), typeof(IntType))) throw new Exception("Index Expression's Type is not Int!"); node.ExpressionType = IntType.Instance; }