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

Class Recursive

src/main/java/wyil/lang/WyilFile.java:6667–6724  ·  view source on GitHub ↗

Represents a recursive link. That is a backlink into the type itself. @return

Source from the content-addressed store, hash-verified

6665 * @return
6666 */
6667 public static class Recursive extends AbstractType implements Type {
6668
6669 public Recursive(Ref<Type> reference) {
6670 super(TYPE_recursive, reference);
6671 }
6672
6673 @Override
6674 public boolean isWriteable() {
6675 return false;
6676 }
6677
6678 @Override
6679 public boolean isReadable() {
6680 return false;
6681 }
6682
6683 public Type getHead() {
6684 Ref<Type> r = (Ref<Type>) get(0);
6685 return r.get();
6686 }
6687
6688 public void setHead(Ref<Type> ref) {
6689 operands[0] = ref;
6690 }
6691
6692 @Override
6693 public Recursive substitute(java.util.function.Function<Object, Syntactic.Item> binding) {
6694 return this;
6695 }
6696
6697 @Override
6698 public Recursive clone(Syntactic.Item[] operands) {
6699 return new Recursive((Ref<Type>) operands[0]);
6700 }
6701
6702 @Override
6703 public String toString() {
6704 Type head = getHead();
6705 if (head instanceof Type.Atom || head instanceof Type.Nominal) {
6706 return "?" + head;
6707 } else if (head.getHeap() != null) {
6708 return "?" + head.getIndex();
6709 } else {
6710 return "?";
6711 }
6712 }
6713
6714 @Override
6715 public String toCanonicalString() {
6716 throw new UnsupportedOperationException();
6717 }
6718 public static final Descriptor DESCRIPTOR_0 = new Descriptor(Operands.ONE, Data.ZERO, "TYPE_recursive") {
6719 @Override
6720 public Syntactic.Item construct(int opcode, Syntactic.Item[] operands, byte[] data) {
6721 return new Recursive((Ref<Type>) operands[0]);
6722 }
6723 };
6724 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected