/** * Add all of the non-synthetic getters and setters defined in the given compilation unit that * have no corresponding accessor to one of the given collections. * * @param getters the map to which getters are to be added * @param setters the list to which setters are to be added * @param unit the compilation unit defining the accessors that are potentially being added */ private void collectAccessors( HashMap<String, PropertyAccessorElement> getters, ArrayList<PropertyAccessorElement> setters, CompilationUnitElement unit) { for (PropertyAccessorElement accessor : unit.getAccessors()) { if (accessor.isGetter()) { if (!accessor.isSynthetic() && accessor.getCorrespondingSetter() == null) { getters.put(accessor.getDisplayName(), accessor); } } else { if (!accessor.isSynthetic() && accessor.getCorrespondingGetter() == null) { setters.add(accessor); } } } }
public void test_empty() throws Exception { Source librarySource = addSource("/lib.dart", "library lib;"); LibraryElement element = buildLibrary(librarySource); assertNotNull(element); assertEquals("lib", element.getName()); assertNull(element.getEntryPoint()); assertLength(0, element.getImportedLibraries()); assertLength(0, element.getImports()); assertNull(element.getLibrary()); assertLength(0, element.getPrefixes()); assertLength(0, element.getParts()); CompilationUnitElement unit = element.getDefiningCompilationUnit(); assertNotNull(unit); assertEquals("lib.dart", unit.getName()); assertEquals(element, unit.getLibrary()); assertLength(0, unit.getAccessors()); assertLength(0, unit.getFields()); assertLength(0, unit.getFunctions()); assertLength(0, unit.getTypeAliases()); assertLength(0, unit.getTypes()); }