IronPython.Compiler.Ast.FunctionDefinition.TryBindOuter C# (CSharp) Метод

TryBindOuter() приватный Метод

private TryBindOuter ( ScopeStatement from, PythonReference reference, PythonVariable &variable ) : bool
from ScopeStatement
reference PythonReference
variable PythonVariable
Результат bool
        internal override bool TryBindOuter(ScopeStatement from, PythonReference reference, out PythonVariable variable) {
            // Functions expose their locals to direct access
            ContainsNestedFreeVariables = true;
            if (TryGetVariable(reference.Name, out variable)) {
                variable.AccessedInNestedScope = true;

                if (variable.Kind == VariableKind.Local || variable.Kind == VariableKind.Parameter) {
                    from.AddFreeVariable(variable, true);

                    for (ScopeStatement scope = from.Parent; scope != this; scope = scope.Parent) {
                        scope.AddFreeVariable(variable, false);
                    }

                    AddCellVariable(variable);
                } else {
                    from.AddReferencedGlobal(reference.Name);
                }
                return true;
            }
            return false;
        }