aa
com.cliffc.aa.HM.HM2.HMType Class Referenceabstract
Inheritance diagram for com.cliffc.aa.HM.HM2.HMType:
[legend]
Collaboration diagram for com.cliffc.aa.HM.HM2.HMType:
[legend]

Public Member Functions

String str ()
 

Package Functions

HMType _fresh (HashSet< HMVar > nongen, HashMap< HMType, HMType > vars)
 
abstract String _str ()
 
abstract HMType find ()
 
HMType fresh (HashSet< HMVar > nongen)
 
boolean is_top ()
 
boolean occurs_in (HashSet< HMVar >nongen)
 
boolean occurs_in (HMType[] args)
 
boolean occurs_in_type (HMType v)
 
abstract HMType union (HMType t)
 

Package Attributes

HMType _u
 

Detailed Description

Definition at line 174 of file HM2.java.

Member Function Documentation

◆ _fresh()

HMType com.cliffc.aa.HM.HM2.HMType._fresh ( HashSet< HMVar nongen,
HashMap< HMType, HMType vars 
)
package

Definition at line 186 of file HM2.java.

186  {
187  HMType t2 = find();
188  if( t2 instanceof HMVar ) {
189  return t2.occurs_in(nongen) //
190  ? t2 // Keep same var
191  : vars.computeIfAbsent(t2, e -> new HMVar(((HMVar)t2)._t));
192  } else {
193  Oper op = (Oper)t2;
194  HMType[] args = new HMType[op._args.length];
195  for( int i=0; i<args.length; i++ )
196  args[i] = op._args[i]._fresh(nongen,vars);
197  return new Oper(op._name,args);
198  }
199  }

References com.cliffc.aa.HM.HM2.Oper._args, com.cliffc.aa.HM.HM2.HMType._fresh(), com.cliffc.aa.HM.HM2.Oper._name, com.cliffc.aa.HM.HM2.HMType.find(), and com.cliffc.aa.HM.HM2.HMType.occurs_in().

Referenced by com.cliffc.aa.HM.HM2.HMType._fresh(), and com.cliffc.aa.HM.HM2.HMType.fresh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _str()

abstract String com.cliffc.aa.HM.HM2.HMType._str ( )
abstractpackage

Reimplemented in com.cliffc.aa.HM.HM2.Oper, and com.cliffc.aa.HM.HM2.HMVar.

Referenced by com.cliffc.aa.HM.HM2.HMType.str().

Here is the caller graph for this function:

◆ find()

abstract HMType com.cliffc.aa.HM.HM2.HMType.find ( )
abstractpackage

Reimplemented in com.cliffc.aa.HM.HM2.Oper, and com.cliffc.aa.HM.HM2.HMVar.

Referenced by com.cliffc.aa.HM.HM2.HMType._fresh(), com.cliffc.aa.HM.HM2.HMType.occurs_in_type(), com.cliffc.aa.HM.HM2.HMType.str(), and com.cliffc.aa.HM.HM2.HMVar.union().

Here is the caller graph for this function:

◆ fresh()

HMType com.cliffc.aa.HM.HM2.HMType.fresh ( HashSet< HMVar nongen)
package

Definition at line 182 of file HM2.java.

182  {
183  HashMap<HMType,HMType> vars = new HashMap<>();
184  return _fresh(nongen,vars);
185  }

References com.cliffc.aa.HM.HM2.HMType._fresh().

Referenced by com.cliffc.aa.HM.HM2.Ident.hm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_top()

boolean com.cliffc.aa.HM.HM2.HMType.is_top ( )
package

Definition at line 180 of file HM2.java.

180 { return _u==null; }

References com.cliffc.aa.HM.HM2.HMType._u.

Referenced by com.cliffc.aa.HM.HM2.HMType.occurs_in_type(), and com.cliffc.aa.HM.HM2.HMVar.type().

Here is the caller graph for this function:

◆ occurs_in() [1/2]

boolean com.cliffc.aa.HM.HM2.HMType.occurs_in ( HashSet< HMVar nongen)
package

Definition at line 201 of file HM2.java.

201  {
202  for( HMVar x : nongen ) if( occurs_in_type(x) ) return true;
203  return false;
204  }

References com.cliffc.aa.HM.HM2.HMType.occurs_in_type().

Referenced by com.cliffc.aa.HM.HM2.HMType._fresh(), and com.cliffc.aa.HM.HM2.HMType.occurs_in_type().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ occurs_in() [2/2]

boolean com.cliffc.aa.HM.HM2.HMType.occurs_in ( HMType[]  args)
package

Definition at line 205 of file HM2.java.

205  {
206  for( HMType x : args ) if( occurs_in_type(x) ) return true;
207  return false;
208  }

References com.cliffc.aa.HM.HM2.HMType.occurs_in_type().

Here is the call graph for this function:

◆ occurs_in_type()

boolean com.cliffc.aa.HM.HM2.HMType.occurs_in_type ( HMType  v)
package

Definition at line 209 of file HM2.java.

209  {
210  assert is_top();
211  HMType y = v.find();
212  if( y==this )
213  return true;
214  if( y instanceof Oper )
215  return occurs_in(((Oper)y)._args);
216  return false;
217  }

References com.cliffc.aa.HM.HM2.HMType.find(), com.cliffc.aa.HM.HM2.HMType.is_top(), and com.cliffc.aa.HM.HM2.HMType.occurs_in().

Referenced by com.cliffc.aa.HM.HM2.HMType.occurs_in(), and com.cliffc.aa.HM.HM2.HMVar.union().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ str()

String com.cliffc.aa.HM.HM2.HMType.str ( )

Definition at line 178 of file HM2.java.

178 { return find()._str(); }

References com.cliffc.aa.HM.HM2.HMType._str(), and com.cliffc.aa.HM.HM2.HMType.find().

Referenced by com.cliffc.aa.HM.HM2.Oper._str().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ union()

abstract HMType com.cliffc.aa.HM.HM2.HMType.union ( HMType  t)
abstractpackage

Reimplemented in com.cliffc.aa.HM.HM2.Oper, and com.cliffc.aa.HM.HM2.HMVar.

Referenced by com.cliffc.aa.HM.HM2.Apply.hm(), com.cliffc.aa.HM.HM2.HMVar.union(), and com.cliffc.aa.HM.HM2.Oper.union().

Here is the caller graph for this function:

Member Data Documentation

◆ _u


The documentation for this class was generated from the following file:
com.cliffc.aa.HM.HM2.HMType._u
HMType _u
Definition: HM2.java:175
com.cliffc.aa.HM.HM2.HMType.is_top
boolean is_top()
Definition: HM2.java:180
com.cliffc.aa.HM.HM2.HMType._fresh
HMType _fresh(HashSet< HMVar > nongen, HashMap< HMType, HMType > vars)
Definition: HM2.java:186
com.cliffc.aa.HM.HM2.HMType.occurs_in
boolean occurs_in(HashSet< HMVar >nongen)
Definition: HM2.java:201
com.cliffc.aa.HM.HM2.HMType.find
abstract HMType find()
com.cliffc.aa.HM.HM2.HMType.occurs_in_type
boolean occurs_in_type(HMType v)
Definition: HM2.java:209
com.cliffc.aa.HM.HM2.HMType._str
abstract String _str()