private void ExecuteReturnStmt(Ast.ReturnStmt stmt, ScriptEnv env) { if (stmt.Value != null) { env.Output.ScalarResult = EvaluateExpr(stmt.Value, env); } env.DidReturn = true; }
private Ast.Stmt ParseReturnStmt(TokenQueue q) { var stmt = new Ast.ReturnStmt { SourceToken = q.SourceToken }; q.Take("return"); if (PeekExpr(q)) { stmt.Value = ParseExpr(q); } ConsumeSemicolon(q); return(stmt); }