MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / getDeclaration

Method getDeclaration

src/main/java/wyil/lang/WyilFile.java:325–338  ·  view source on GitHub ↗
(Identifier name, Type signature, Class<S> kind)

Source from the content-addressed store, hash-verified

323 }
324
325 public <S extends Decl.Named> S getDeclaration(Identifier name, Type signature, Class<S> kind) {
326 List<S> matches = super.getSyntacticItems(kind);
327 for (int i = 0; i != matches.size(); ++i) {
328 S match = matches.get(i);
329 if (match.getName().equals(name)) {
330 if (signature != null && signature.equals(match.getType())) {
331 return match;
332 } else if (signature == null) {
333 return match;
334 }
335 }
336 }
337 throw new IllegalArgumentException("unknown declarataion (" + name + "," + signature + ")");
338 }
339
340 @Override
341 public <T extends Syntactic.Item> void replace(T from, T to) {

Callers

nothing calls this directly

Calls 6

getSyntacticItemsMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
getNameMethod · 0.65
getTypeMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected