public ScriptFlowControlStatement(AstNodeArgs args) : base(args) { var oper = ChildNodes[0] as TokenAst; _operation = oper.Text; Debug.Assert(oper.Text == "return" || oper.Text == "break" || oper.Text == "continue" || oper.Text == "throw"); if (_operation == "return" || _operation == "throw") _expression = (ScriptExpr)ChildNodes[1]; }
public ScriptMetaExpr(AstNodeArgs args) : base(args) { var progArgs = new AstNodeArgs { ChildNodes = new AstNodeList { ChildNodes[1] }, Span = args.Span, Term = args.Term }; _metaProg = new ScriptProg(progArgs) { Parent = this }; }
public ScriptFlowControlStatement(AstNodeArgs args) : base(args) { var oper = ChildNodes[0] as TokenAst; _operation = oper.Text; Debug.Assert(oper.Text == "return" || oper.Text == "break" || oper.Text == "continue" || oper.Text == "throw"); if (_operation == "return" || _operation == "throw") { _expression = (ScriptExpr)ChildNodes[1]; } }
/// <summary> /// Returns source code for given node /// </summary> /// <param name="node">Node</param> /// <returns>source code</returns> internal string Code(ScriptAst node) { return SourceCode.Substring(node.Span.Start.Position, node.Span.Length); }
protected static bool CheckCondition(ScriptAst cond, IScriptContext context) { cond.Evaluate(context); return (bool)context.Result; }
public ScriptUsingStatement(AstNodeArgs args) : base(args) { _name = args.ChildNodes[1] as ScriptQualifiedName; _statement = args.ChildNodes[2] as ScriptAst; }
protected static bool CheckCondition(ScriptAst cond, IScriptContext context) { cond.Evaluate(context); return((bool)context.Result); }