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];
    }
Пример #2
0
        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 };
        }
Пример #3
0
        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];
            }
        }
Пример #4
0
        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
            };
        }
Пример #5
0
 /// <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);
 }
Пример #6
0
 protected static bool CheckCondition(ScriptAst cond, IScriptContext context)
 {
   cond.Evaluate(context);
   return (bool)context.Result;
 }
Пример #7
0
 public ScriptUsingStatement(AstNodeArgs args)
     : base(args)
 {
   _name = args.ChildNodes[1] as ScriptQualifiedName;
   _statement = args.ChildNodes[2] as ScriptAst;
 }
Пример #8
0
 public ScriptUsingStatement(AstNodeArgs args)
     : base(args)
 {
     _name      = args.ChildNodes[1] as ScriptQualifiedName;
     _statement = args.ChildNodes[2] as ScriptAst;
 }
Пример #9
0
 protected static bool CheckCondition(ScriptAst cond, IScriptContext context)
 {
     cond.Evaluate(context);
     return((bool)context.Result);
 }