Ejemplo n.º 1
0
 void CreateFieldForClosedVars(JSFunctionImp funcImp)
 {
     foreach (var decl in funcImp.Declarations)
         if (decl.IsClosedOn)
             funcImp.SetField(decl.Name, new mdr.DVar()); //Only declarations that are closed on will become a filed.
     foreach (var f in funcImp.SubFunctions)
     {
         f.SetType(funcImp.DType);
         CreateFieldForClosedVars(f);
     }
 }
Ejemplo n.º 2
0
        public void Execute(JSFunctionImp funcImp)
        {
            var oldFuncImp = _currFuncImp;
            _currFuncImp = funcImp;

            Visit(funcImp.Ast);
            foreach (var f in _currFuncImp.SubFunctions)
                Execute(f);

            if (_currFuncImp.ParentFunction == null) //This is either the program or function declaration
                CreateFieldForClosedVars(_currFuncImp);

            _currFuncImp = oldFuncImp;
            _currFuncImp = funcImp;
        }
Ejemplo n.º 3
0
 void CreateFieldForClosedVars(JSFunctionImp funcImp)
 {
     foreach (var decl in funcImp.Declarations)
     {
         if (decl.IsClosedOn)
         {
             funcImp.SetField(decl.Name, new mdr.DVar()); //Only declarations that are closed on will become a filed.
         }
     }
     foreach (var f in funcImp.SubFunctions)
     {
         f.SetType(funcImp.DType);
         CreateFieldForClosedVars(f);
     }
 }
Ejemplo n.º 4
0
        public void Execute(JSFunctionImp funcImp)
        {
            var oldFuncImp = _currFuncImp;

            _currFuncImp = funcImp;

            Visit(funcImp.Ast);
            foreach (var f in _currFuncImp.SubFunctions)
            {
                Execute(f);
            }

            if (_currFuncImp.ParentFunction == null) //This is either the program or function declaration
            {
                CreateFieldForClosedVars(_currFuncImp);
            }

            _currFuncImp = oldFuncImp;
            _currFuncImp = funcImp;
        }
Ejemplo n.º 5
0
        public void Execute(JSFunctionImp funcImp)
        {
            var oldFuncImp = _currFuncImp;
            _currFuncImp = funcImp;

            Visit(funcImp.AST);

            //TODO: here we can decide whether to go further down the hierarchy
            foreach (var f in _currFuncImp.SubFunctions)
            {
                // Only analyze functions which have already been parsed. Laziness won't work without this; otherwise, when we analyze the
                // top-level function, we parse and analyze everything!
                if (f.IsParsed)
                    f.Analyze();
            }

            //if (_currFuncImp.ParentFunction == null) //This is either the program or function declaration
            //    CreateFieldForClosedVars(_currFuncImp);

            _currFuncImp = oldFuncImp;
        }
Ejemplo n.º 6
0
        public void Execute(JSFunctionImp funcImp)
        {
            var oldFuncImp = _currFuncImp;

            _currFuncImp = funcImp;

            Visit(funcImp.AST);

            //TODO: here we can decide whether to go further down the hierarchy
            foreach (var f in _currFuncImp.SubFunctions)
            {
                // Only analyze functions which have already been parsed. Laziness won't work without this; otherwise, when we analyze the
                // top-level function, we parse and analyze everything!
                if (f.IsParsed)
                {
                    f.Analyze();
                }
            }

            //if (_currFuncImp.ParentFunction == null) //This is either the program or function declaration
            //    CreateFieldForClosedVars(_currFuncImp);

            _currFuncImp = oldFuncImp;
        }
Ejemplo n.º 7
0
 public Symbols(JSFunctionImp funcImp, mdr.DFunction func, mdr.DObject dis)
 {
     FuncImp = funcImp;
     Func    = func;
     This    = dis;
 }