internal override PythonVariable BindReference(PythonNameBinder binder, PythonReference reference) {
PythonVariable variable;
// First try variables local to this scope
if (TryGetVariable(reference.Name, out variable)) {
if (variable.Kind == VariableKind.Global) {
AddReferencedGlobal(reference.Name);
}
return variable;
}
// Try to bind in outer scopes
for (ScopeStatement parent = Parent; parent != null; parent = parent.Parent) {
if (parent.TryBindOuter(this, reference, out variable)) {
return variable;
}
}
return null;
}