예제 #1
0
        public ScriptFunctionDefinition(AstNodeArgs args)
            : base(args)
        {
            var funcName = ChildNodes[1] as TokenAst;
            var index    = 0;

            if (funcName != null)
            {
                Name = funcName.Text;
            }
            else
            //Function expression
            {
                Name  = null;
                index = 1;
            }

            if (ChildNodes.Count == 5 - index)
            {
                _contract   = ChildNodes[3 - index] as ScriptFuncContract;
                _parameters = ChildNodes[3 - index] as ScriptFuncParameters;
            }

            if (ChildNodes.Count == 6 - index)
            {
                _parameters = ChildNodes[2 - index] as ScriptFuncParameters;
                _globalList = ChildNodes[3 - index] as ScriptGlobalList;
                _contract   = ChildNodes[4 - index] as ScriptFuncContract;
            }

            _body = (ScriptCompoundStatement)ChildNodes[ChildNodes.Count - 1];
            _body.ShouldCreateScope = false;

            if (_contract != null)
            {
                _contract._function = this;
            }
        }
예제 #2
0
 public ScriptGlobalList(AstNodeArgs args)
   : base(args)
 {
   Parameters = ChildNodes[1] as ScriptFuncParameters;
 }
예제 #3
0
 public ScriptGlobalList(AstNodeArgs args)
     : base(args)
 {
     Parameters = ChildNodes[1] as ScriptFuncParameters;
 }