tests for forthcoming functionality, cleanup and refactoring

This commit is contained in:
Dmitry Jemerov
2009-12-25 18:48:41 +03:00
parent f27cd6f234
commit 0ad756b935
2 changed files with 14 additions and 1 deletions
@@ -36,5 +36,8 @@ public interface PyFile extends PyElement, PsiFile, PyDocStringOwner {
@return an URL of file, maybe bogus if virtual file is not present.
*/
@NotNull
String getUrl();
String getUrl();
@Nullable
PyFunction findTopLevelFunction(String name);
}
@@ -68,6 +68,16 @@ public class PyFileImpl extends PsiFileBase implements PyFile, PyExpression {
return fname;
}
public PyFunction findTopLevelFunction(String name) {
final List<PyFunction> functions = getTopLevelFunctions();
for (PyFunction function : functions) {
if (name.equals(function.getName())) {
return function;
}
}
return null;
}
public Icon getIcon(int flags) {
return PythonFileType.INSTANCE.getIcon();
}