/// <summary> /// Execute /// </summary> public object VisitThrow(ThrowExpr expr) { var message = ""; if (expr.Exp != null) { var result = expr.Exp.Evaluate(this) as LObject; if (result != LObjects.Null) message = result.GetValue().ToString(); } throw new LangException("TypeError", message, expr.Ref.ScriptName, expr.Ref.Line); }
public Expr OnParseThrow() { var tokenIt = this._parser.TokenIt; var initiatorToken = tokenIt.NextToken; var expr = new ThrowExpr(); // <codeThrow> tokenIt.Expect(Tokens.Throw); expr.Exp = this._parser.ParseExpression(Terminators.ExpStatementEnd, true, false, true, true, false); // </codeThrow> this._parser.SetupContext(expr, initiatorToken); return expr; }