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

Public Member Functions

String str ()
 
final String toString ()
 

Package Functions

HMType _fresh (HashSet< HMVar > nongen, HashMap< HMType, HMType > vars)
 
abstract SB _str (SB sb, VBitSet vbs, boolean debug)
 
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 158 of file HM1.java.

Member Function Documentation

◆ _fresh()

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

Definition at line 171 of file HM1.java.

171  {
172  HMType t2 = find();
173  if( t2 instanceof HMVar ) {
174  return t2.occurs_in(nongen) //
175  ? t2 // Keep same var
176  : vars.computeIfAbsent(t2, e -> new HMVar(((HMVar)t2)._t));
177  } else {
178  Oper op = (Oper)t2;
179  HMType[] args = new HMType[op._args.length];
180  for( int i=0; i<args.length; i++ )
181  args[i] = op._args[i]._fresh(nongen,vars);
182  return new Oper(op._name,args);
183  }
184  }

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

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

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

◆ _str()

abstract SB com.cliffc.aa.HM.HM1.HMType._str ( SB  sb,
VBitSet  vbs,
boolean  debug 
)
abstractpackage

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

Referenced by com.cliffc.aa.HM.HM1.HMVar._str(), com.cliffc.aa.HM.HM1.Oper._str(), com.cliffc.aa.HM.HM1.HMType.str(), and com.cliffc.aa.HM.HM1.HMType.toString().

Here is the caller graph for this function:

◆ find()

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

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

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

Here is the caller graph for this function:

◆ fresh()

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

Definition at line 167 of file HM1.java.

167  {
168  HashMap<HMType,HMType> vars = new HashMap<>();
169  return _fresh(nongen,vars);
170  }

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

Referenced by com.cliffc.aa.HM.HM1.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.HM1.HMType.is_top ( )
package

Definition at line 165 of file HM1.java.

165 { return _u==null; }

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

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

Here is the caller graph for this function:

◆ occurs_in() [1/2]

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

Definition at line 186 of file HM1.java.

186  {
187  for( HMVar x : nongen ) if( occurs_in_type(x) ) return true;
188  return false;
189  }

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

Referenced by com.cliffc.aa.HM.HM1.HMType._fresh(), and com.cliffc.aa.HM.HM1.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.HM1.HMType.occurs_in ( HMType[]  args)
package

Definition at line 190 of file HM1.java.

190  {
191  for( HMType x : args ) if( occurs_in_type(x) ) return true;
192  return false;
193  }

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

Here is the call graph for this function:

◆ occurs_in_type()

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

Definition at line 194 of file HM1.java.

194  {
195  assert is_top();
196  HMType y = v.find();
197  if( y==this )
198  return true;
199  if( y instanceof Oper )
200  return occurs_in(((Oper)y)._args);
201  return false;
202  }

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

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

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

◆ str()

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

Definition at line 163 of file HM1.java.

163 { return _str(new SB(),new VBitSet(),false).toString(); }

References com.cliffc.aa.HM.HM1.HMType._str(), and com.cliffc.aa.util.SB.toString().

Here is the call graph for this function:

◆ toString()

final String com.cliffc.aa.HM.HM1.HMType.toString ( )

Definition at line 162 of file HM1.java.

162 { return _str(new SB(),new VBitSet(),true).toString(); }

References com.cliffc.aa.HM.HM1.HMType._str(), and com.cliffc.aa.util.SB.toString().

Here is the call graph for this function:

◆ union()

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

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

Referenced by com.cliffc.aa.HM.HM1.Apply.hm(), com.cliffc.aa.HM.HM1.HMVar.union(), and com.cliffc.aa.HM.HM1.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.HM1.HMType._str
abstract SB _str(SB sb, VBitSet vbs, boolean debug)
com.cliffc.aa.HM.HM1.HMType._fresh
HMType _fresh(HashSet< HMVar > nongen, HashMap< HMType, HMType > vars)
Definition: HM1.java:171
com.cliffc.aa.HM.HM1.HMType.occurs_in_type
boolean occurs_in_type(HMType v)
Definition: HM1.java:194
com.cliffc.aa.HM.HM1.HMType.is_top
boolean is_top()
Definition: HM1.java:165
com.cliffc.aa.util.VBitSet
Definition: VBitSet.java:5
com.cliffc.aa.util.SB
Tight/tiny StringBuilder wrapper.
Definition: SB.java:8
com.cliffc.aa.HM.HM1.HMType.occurs_in
boolean occurs_in(HashSet< HMVar >nongen)
Definition: HM1.java:186
com.cliffc.aa.HM.HM1.HMType._u
HMType _u
Definition: HM1.java:159
com.cliffc.aa.util.SB.toString
String toString()
Definition: SB.java:62
com.cliffc.aa.HM.HM1.HMType.find
abstract HMType find()