MCPcopy Create free account
hub / github.com/SeaOfNodes/Simple / xmeet

Method xmeet

chapter18/src/main/java/com/seaofnodes/simple/type/Type.java:153–169  ·  view source on GitHub ↗
(Type t)

Source from the content-addressed store, hash-verified

151 // Handle cases where 'this.is_simple()' and unequal to 't'.
152 // Subclassed xmeet calls can assert that '!t.is_simple()'.
153 Type xmeet(Type t) {
154 assert is_simple(); // Should be overridden in subclass
155 // ANY meet anything is thing; thing meet ALL is ALL
156 if( _type==TBOT || t._type==TTOP ) return this;
157 if( _type==TTOP || t._type==TBOT ) return t;
158
159 // RHS TypeNil vs NIL/XNIL
160 if( _type== TNIL ) return t instanceof TypeNil ptr ? ptr.meet0() : (t._type==TXNIL ? TypePtr.PTR : BOTTOM);
161 if( _type== TXNIL ) return t instanceof TypeNil ptr ? ptr.meetX() : (t._type== TNIL ? TypePtr.PTR : BOTTOM);
162 // 'this' is only {TCTRL,TXCTRL}
163 // Other non-simple RHS things bottom out
164 if( !t.is_simple() ) return BOTTOM;
165 // If RHS is NIL/XNIL
166 if( t._type==TNIL || t._type==TXNIL ) return BOTTOM;
167 // Both are {TCTRL,TXCTRL} and unequal to each other
168 return _type==TCTRL || t._type==TCTRL ? CONTROL : XCONTROL;
169 }
170
171 public Type dual() {
172 return switch( _type ) {

Callers 1

meetMethod · 0.95

Calls 3

is_simpleMethod · 0.95
meet0Method · 0.45
meetXMethod · 0.45

Tested by

no test coverage detected