コード例 #1
0
  public boolean hasWriteAccess() {
    if (myHasWriteAccess != null) return myHasWriteAccess.booleanValue();

    myFile.accept(
        new GroovyRecursiveElementVisitor() {
          @Override
          public void visitAssignmentExpression(GrAssignmentExpression expression) {
            if (isRefToMe(expression.getLValue())) {
              myHasWriteAccess = true;
            }
            super.visitAssignmentExpression(expression);
          }

          @Override
          public void visitTypeDefinition(GrTypeDefinition typeDefinition) {
            // don't go inside type definitions
          }

          @Override
          public void visitElement(GroovyPsiElement element) {
            if (myHasWriteAccess == null) {
              super.visitElement(element);
            }
          }
        });

    if (myHasWriteAccess == null) myHasWriteAccess = false;
    return myHasWriteAccess.booleanValue();
  }
コード例 #2
0
 public GrBindingVariable(final GroovyFile file, String name, Boolean isWriteAccess) {
   super(file.getManager(), name, CommonClassNames.JAVA_LANG_OBJECT, file);
   myFile = file;
   myHasWriteAccess = isWriteAccess;
 }