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

Method xmeet

chapter24/src/main/java/com/seaofnodes/simple/type/Type.java:273–290  ·  view source on GitHub ↗
(Type t)

Source from the content-addressed store, hash-verified

271 // Handle cases where 'this.is_simple()' and unequal to 't'.
272 // Subclassed xmeet calls can assert that '!t.is_simple()'.
273 Type xmeet(Type t) {
274 assert is_simple(); // Should be overridden in subclass
275 // ANY meet anything is thing; thing meet ALL is ALL
276 if( _type==TBOT || t._type==TTOP ) return this;
277 if( _type==TTOP || t._type==TBOT ) return t;
278
279 // RHS TypeNil vs NIL/XNIL
280 if( _type== TNIL ) return t instanceof TypeNil ptr ? ptr.meet0() : (t._type==TXNIL ? TypePtr.PTR : BOTTOM);
281 if( _type== TXNIL ) return t instanceof TypeNil ptr ? ptr.meetX() : (t._type== TNIL ? TypePtr.PTR : BOTTOM);
282
283 // 'this' is only {TCTRL,TXCTRL}
284 // Other non-simple RHS things bottom out
285 if( !t.is_simple() ) return BOTTOM;
286 // If RHS is NIL/XNIL
287 if( t._type==TNIL || t._type==TXNIL ) return BOTTOM;
288 // Both are {TCTRL,TXCTRL} and unequal to each other
289 return _type==TCTRL || t._type==TCTRL ? CONTROL : XCONTROL;
290 }
291
292
293 // The dual is pre-computed on creation and available "for free" thereafter

Callers 1

meetMethod · 0.95

Calls 3

is_simpleMethod · 0.95
meet0Method · 0.45
meetXMethod · 0.45

Tested by

no test coverage detected