@Override public boolean hasLastingDefinition(PDOMBinding binding) throws CoreException { if (fileBeingUpdated == null) { return binding.hasDefinition(); } // Definitions in fileBeingUpdated will soon go away, so look for a definition elsewhere. for (PDOMName name = binding.getFirstDefinition(); name != null; name = name.getNextInBinding()) { if (!fileBeingUpdated.getPDOM().equals(name.getPDOM()) || fileBeingUpdated.getRecord() != name.getFileRecord()) { return true; } } return false; }
/** Visit bindings via the cache. */ public static void acceptViaCache( IPDOMCPPClassType ct, IPDOMVisitor visitor, boolean includeNestedInAnonymous) throws CoreException { final long record = ct.getRecord(); CharArrayObjectMap<List<PDOMBinding>> map = getBindingMap(ct); for (List<PDOMBinding> list : map.values()) { for (PDOMBinding node : list) { if (includeNestedInAnonymous || node.getParentNodeRec() == record) { if (visitor.visit(node)) { node.accept(visitor); } visitor.leave(node); } } } }
@Override public boolean visit(IPDOMNode node) throws CoreException { if (node instanceof PDOMBinding) { final PDOMBinding binding = (PDOMBinding) node; final char[] nchars = binding.getNameCharArray(); List<PDOMBinding> list = fResult.get(nchars); if (list == null) { list = new ArrayList<>(); fResult.put(nchars, list); } list.add(binding); if (binding instanceof ICompositeType && ((ICompositeType) binding).isAnonymous()) { return true; // visit children } } return false; }