[Pydev-cvs] org.python.pydev/src/org/python/pydev/editor/codecompletion/revisited/visitors Scope.jav
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2006-04-08 21:22:31
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/revisited/visitors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32685/src/org/python/pydev/editor/codecompletion/revisited/visitors Modified Files: Scope.java Log Message: Index: Scope.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codecompletion/revisited/visitors/Scope.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Scope.java 20 Mar 2006 19:37:57 -0000 1.12 --- Scope.java 8 Apr 2006 21:22:25 -0000 1.13 *************** *** 19,23 **** --- 19,27 ---- import org.python.pydev.parser.jython.ast.ClassDef; import org.python.pydev.parser.jython.ast.FunctionDef; + import org.python.pydev.parser.jython.ast.Name; + import org.python.pydev.parser.jython.ast.NameTokType; import org.python.pydev.parser.visitors.NodeUtils; + import org.python.pydev.parser.visitors.scope.ASTEntry; + import org.python.pydev.parser.visitors.scope.SequencialASTIteratorVisitor; /** *************** *** 99,102 **** --- 103,120 ---- } + public List<ASTEntry> getOcurrences(String occurencesFor) { + List<ASTEntry> ret = new ArrayList<ASTEntry>(); + + SequencialASTIteratorVisitor visitor = SequencialASTIteratorVisitor.create(this.scope.get(0)); + Iterator<ASTEntry> iterator = visitor.getIterator(new Class[]{Name.class, NameTokType.class}); + while(iterator.hasNext()){ + ASTEntry entry = iterator.next(); + if (occurencesFor.equals(entry.getName())){ + ret.add(entry); + } + } + return ret; + } + /** * @param endLine tokens will only be recognized if its beginLine is higher than this parameter. *************** *** 168,171 **** --- 186,190 ---- return null; } + } |