예제 #1
0
 public override void RebuildScope(FunctionInfo functionInfo, Dictionary <string, VariableDescriptor> transferedVariables, int scopeBias)
 {
     _initializer?.RebuildScope(functionInfo, transferedVariables, scopeBias);
     _condition?.RebuildScope(functionInfo, transferedVariables, scopeBias);
     _body?.RebuildScope(functionInfo, transferedVariables, scopeBias);
     _post?.RebuildScope(functionInfo, transferedVariables, scopeBias);
 }
예제 #2
0
파일: With.cs 프로젝트: lulzzz/sito
        public override void RebuildScope(FunctionInfo functionInfo, Dictionary <string, VariableDescriptor> transferedVariables, int scopeBias)
        {
            _scope?.RebuildScope(functionInfo, transferedVariables, scopeBias);

            var tempVariables = new Dictionary <string, VariableDescriptor>();

            _body?.RebuildScope(functionInfo, tempVariables, scopeBias + 1);

            if (!(_body is CodeBlock block))
            {
                return;
            }

            var variables = new List <VariableDescriptor>();

            foreach (var variable in tempVariables)
            {
                if ((variable.Value is ParameterDescriptor) || !(variable.Value.initializer is FunctionDefinition))
                {
                    transferedVariables.Add(variable.Key, variable.Value);
                }
                else
                {
                    variables.Add(variable.Value);
                }
            }

            block._variables = variables.ToArray();
            block._suppressScopeIsolation = block._variables.Length == 0
                ? SuppressScopeIsolationMode.Suppress
                : SuppressScopeIsolationMode.DoNotSuppress;
        }
예제 #3
0
        public override void RebuildScope(FunctionInfo functionInfo, Dictionary <string, VariableDescriptor> transferedVariables, int scopeBias)
        {
            body.RebuildScope(functionInfo, transferedVariables, scopeBias);

            if (catchBody != null)
            {
                VariableDescriptor variableToRestore = null;
                if (transferedVariables != null)
                {
                    transferedVariables.TryGetValue(catchVariableDesc.name, out variableToRestore);
                    transferedVariables[catchVariableDesc.name] = catchVariableDesc;
                }

                catchBody.RebuildScope(functionInfo, transferedVariables, scopeBias);

                if (transferedVariables != null)
                {
                    if (variableToRestore != null)
                    {
                        transferedVariables[variableToRestore.name] = variableToRestore;
                    }
                    else
                    {
                        transferedVariables.Remove(catchVariableDesc.name);
                    }
                }
            }

            finallyBody?.RebuildScope(functionInfo, transferedVariables, scopeBias);
        }
예제 #4
0
파일: Switch.cs 프로젝트: viceice/NiL.JS
        public override void RebuildScope(FunctionInfo functionInfo, Dictionary <string, VariableDescriptor> transferedVariables, int scopeBias)
        {
            image.RebuildScope(functionInfo, transferedVariables, scopeBias);

            for (var i = 0; i < cases.Length; i++)
            {
                if (cases[i].statement != null)
                {
                    cases[i].statement.RebuildScope(functionInfo, transferedVariables, scopeBias);
                }
            }

            for (var i = 0; i < lines.Length; i++)
            {
                lines[i]?.RebuildScope(functionInfo, transferedVariables, scopeBias);
            }
        }
예제 #5
0
        public override void RebuildScope(FunctionInfo functionInfo, Dictionary <string, VariableDescriptor> transferedVariables, int scopeBias)
        {
            if (_reexportSourceModuleName != null)
            {
                return;
            }

            if (_internalDefinition != null)
            {
                _internalDefinition.RebuildScope(functionInfo, transferedVariables, scopeBias);
            }
            else
            {
                for (var i = 0; i < _map.Count; i++)
                {
                    _map[i].Value.RebuildScope(functionInfo, transferedVariables, scopeBias);
                }
            }
        }
예제 #6
0
파일: ForOf.cs 프로젝트: roecher/NiL.JS
 public override void RebuildScope(FunctionInfo functionInfo, Dictionary <string, VariableDescriptor> transferedVariables, int scopeBias)
 {
     _variable.RebuildScope(functionInfo, transferedVariables, scopeBias);
     _source.RebuildScope(functionInfo, transferedVariables, scopeBias);
     _body?.RebuildScope(functionInfo, transferedVariables, scopeBias);
 }
예제 #7
0
 public override void RebuildScope(FunctionInfo functionInfo, Dictionary <string, VariableDescriptor> transferedVariables, int scopeBias)
 {
     statement.RebuildScope(functionInfo, transferedVariables, scopeBias);
 }