private void Print(PrintAst ast) { var expression = GetValue(Exec(ast.Expression)); Console.WriteLine(expression); }
public void Visit(PrintAst ast) { ast.Expression.Visit(this); if (ResolvingTypes) { if (ast.Expression.AstSymbolType == null) { throw new InvalidSyntax("Undefined expression in print statement"); } if (ast.Expression.AstSymbolType.ExpressionType == ExpressionTypes.Void) { throw new InvalidSyntax("Cannot print a void expression"); } if (ast.Expression.AstSymbolType.ExpressionType == ExpressionTypes.Method) { var returnAst = (ast.Expression.AstSymbolType.Src as MethodDeclr); if (returnAst != null) { var retStatement = returnAst.ReturnAst; if (retStatement == null) { throw new InvalidSyntax("Cannot print a void expression"); } } } } }
public void Visit(PrintAst ast) { Exec(ast); }
public void Visit(PrintAst ast) { PrintWrap("Print", () => ast.Expression.Visit(this)); }