public override AstNode Visit(ExpressionStatement node) { // Begin the node. builder.BeginNode(node); // Get the expression. Expression expr = node.GetExpression(); // Visit it. expr.Accept(this); // Get his type. IChelaType type = expr.GetNodeType(); // Ignore void expression. if(type == ChelaType.GetVoidType()) return builder.EndNode(); // Special treatment for reference expressions. if(type.IsReference()) { ReferenceType refType = (ReferenceType) type; type = refType.GetReferencedType(); if(expr.GetNodeValue() != null) { // Remove the variable reference. Variable variable = (Variable)expr.GetNodeValue(); uint args = GetVariableParameters(node, variable); for(uint i = 0; i < args; i++) builder.CreatePop(); } else { // Remove the reference. builder.CreatePop(); } } else { // Pop the expression value. builder.CreatePop(); } return builder.EndNode(); }
public override AstNode Visit(ExpressionStatement node) { // Get the expression. Expression expr = node.GetExpression(); // Visit it. expr.Accept(this); return node; }