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

Method substitute

src/main/java/wycc/util/AbstractHeap.java:411–417  ·  view source on GitHub ↗

Create a new syntactic item by replacing all occurrences of one item ( from ) with another ( to ). In the case that there is no change to the item (or any of its children) then the original item is returned untouched. Specifically, the exact same reference will be returned.

(Item item, Item from, Item to)

Source from the content-addressed store, hash-verified

409 * @return
410 */
411 public static Item substitute(Item item, Item from, Item to) {
412 Item nItem = substitute(item, from, to, new IdentityHashMap<>());
413 if(nItem != item) {
414 item.getHeap().allocate(nItem);
415 }
416 return nItem;
417 }
418
419 /**
420 * Helper method for above.

Callers

nothing calls this directly

Calls 5

allocateMethod · 0.65
getHeapMethod · 0.65
getMethod · 0.65
getAllMethod · 0.65
cloneMethod · 0.65

Tested by

no test coverage detected