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

Method xmeet

chapter21/src/main/java/com/seaofnodes/simple/type/Type.java:154–170  ·  view source on GitHub ↗
(Type t)

Source from the content-addressed store, hash-verified

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