protected ASTImplicitStmtNode findExistingImplicitStatement(final ScopingNode scope) { try { scope.accept( new GenericASTVisitor() { @Override public void visitASTImplicitStmtNode(ASTImplicitStmtNode node) { if (node.getImplicitToken().getEnclosingScope() == scope) throw new Notification(node); } }); } catch (Notification n) { return (ASTImplicitStmtNode) n.getResult(); } return null; }
private List<Conflict> findAllPotentiallyConflictingUnboundSubprogramCalls() { final List<Conflict> conflictingDef = new ArrayList<Conflict>(); for (ScopingNode importingScope : scopeItselfAndAllScopesThatImport(scopeOfDefinitionToCheck)) { pm.subTask( Messages.bind( Messages.FortranResourceRefactoring_CheckingForSubprogramBindingConflictsIn, importingScope.describe())); importingScope.accept( new GenericASTVisitor() { @Override public void visitASTVarOrFnRefNode(ASTVarOrFnRefNode node) { if (node.getName() != null && node.getName().getName() != null) checkForConflict(node.getName().getName()); } @Override public void visitASTCallStmtNode(ASTCallStmtNode node) { if (node.getSubroutineName() != null) checkForConflict(node.getSubroutineName()); } private void checkForConflict(Token name) { if (name.getLogicalFile() != null) for (String newName : newNames) if (name != null && name.getText().equals(newName) && name.resolveBinding().isEmpty()) conflictingDef.add(new Conflict(newName, name.getTokenRef())); } }); } return conflictingDef; }