コード例 #1
0
 @Override
 public void visitElement(PsiElement element) {
   if (element.getChildren().length == 0) {
     myResult.append(element.getText());
   } else {
     super.visitElement(element);
   }
 }
コード例 #2
0
 @Override
 public void visitPyReferenceExpression(PyReferenceExpression node) {
   super.visitPyReferenceExpression(node);
   final PsiElement result = node.getReference().resolve();
   if (result != null && PsiTreeUtil.getParentOfType(result, ScopeOwner.class) == myScope) {
     if (result instanceof PyParameter && myScope instanceof PyFunction) {
       final PyFunction function = (PyFunction) myScope;
       final PyParameter[] parameters = function.getParameterList().getParameters();
       if (parameters.length > 0 && result == parameters[0]) {
         final PyFunction.Modifier modifier = function.getModifier();
         if (modifier != PyFunction.Modifier.STATICMETHOD) {
           // 'self' is not a local scope dependency
           return;
         }
       }
     }
     hasLocalScopeDependencies = true;
   }
 }