public override INamespaceSet GetMember(Node node, AnalysisUnit unit, string name) { if (unit.ProjectState.LanguageVersion.Is6x() && name == "next" || unit.ProjectState.LanguageVersion.Is7x() && name == "__next__") { if (_next == null) { var next = this._type.GetMember(unit.ProjectEntry.MyScope.InterpreterContext, name); if (next != null) { _next = new NextBoundMethod((BuiltinMethodInfo)unit.ProjectState.GetNamespaceFromObjects(next), this); } } if (_next != null) { return _next.SelfSet; } } else if (name == "__iter__") { if (_iter == null) { var iter = this._type.GetMember(unit.ProjectEntry.MyScope.InterpreterContext, name); if (iter != null) { _iter = new IterBoundBuiltinMethodInfo((BuiltinMethodInfo)unit.ProjectState.GetNamespaceFromObjects(iter), this); } } if (_iter != null) { return _iter.SelfSet; } } return base.GetMember(node, unit, name); }
public override INamespaceSet GetMember(Node node, AnalysisUnit unit, string name) { if (name == "__iter__") { if (_iterMethod == null) { var iterImpl = (base.GetMember(node, unit, name).FirstOrDefault() as BuiltinMethodInfo) ?? new IterBuiltinMethodInfo(JType, ProjectState); _iterMethod = new IterBoundBuiltinMethodInfo(this, iterImpl); } return _iterMethod; } return base.GetMember(node, unit, name); }