Exemplo n.º 1
0
        internal override void AnalyzeWorker(DDG ddg, CancellationToken cancel)
        {
            if (((FunctionEnvironmentRecord)_env).AnalysisValue.DeclaringVersion != ProjectEntry.AnalysisVersion)
            {
                // we were enqueued and a new version became available, don't re-analyze against
                // the old version.
                return;
            }

            var args      = _callArgs;
            var funcScope = (FunctionEnvironmentRecord)Environment;
            var function  = Function;

            // Set the specialized versions of the locals
            foreach (var local in _specializedLocals)
            {
                local.DefiningScope.ReplaceVariable(local.Name, local.Specialized);
            }

            var originalThis = funcScope._this;

            funcScope._this   = _this;
            function._curArgs = args;

            // Propagate the call types into the variables...
            AddArgumentTypes(funcScope, _callArgs.This, args.Args);

            var unifiedReturn = function.ReturnValue;

            function.ReturnValue = _returnValue;

            function.FunctionObject.Walk(new FunctionAssignmentWalker(funcScope, ProjectEntry));

            try {
                base.AnalyzeWorker(ddg, cancel);
            } finally {
                function._curArgs    = null;
                funcScope._this      = originalThis;
                function.ReturnValue = unifiedReturn;
                function.ReturnValue.AddTypes(this, _returnValue.GetTypesNoCopy(this), false);
                _this.CopyTo(originalThis);

                // restore the locals, merging types back into the shared...
                foreach (var variable in _specializedLocals)
                {
                    var newVar = variable.Specialized;
                    var oldVar = variable.Shared;

                    newVar.CopyTo(oldVar);

                    variable.DefiningScope.ReplaceVariable(variable.Name, oldVar);
                }
            }
        }
Exemplo n.º 2
0
        internal override void AnalyzeWorker(DDG ddg, CancellationToken cancel)
        {
            ModuleTree module = _table.RequireModule(this, _dependency, _tree);

            if (module == null)
            {
                return;
            }

            AddChildVisibilitiesExcludingNodeModules(module);
        }
Exemplo n.º 3
0
        internal override void AnalyzeWorker(DDG ddg, CancellationToken cancel)
        {
            if (Function.ArgumentsVariable != null &&
                !ddg.Scope.ContainsVariable("arguments"))
            {
                ddg.Scope.AddVariable("arguments", Function.ArgumentsVariable);
            }

            // Set the scope to within the function
            ddg.Scope = Environment;

            Ast.Body.Walk(ddg);
        }