aa
com.cliffc.aa.type.TypeStr Class Reference
Inheritance diagram for com.cliffc.aa.type.TypeStr:
[legend]
Collaboration diagram for com.cliffc.aa.type.TypeStr:
[legend]

Public Member Functions

boolean above_center ()
 
TypeObj crush ()
 
boolean cycle_equals (Type o)
 
boolean equals (Object o)
 
String getstr ()
 
boolean is_con ()
 
byte isBitShape (Type t)
 
boolean may_be_con ()
 
boolean may_nil ()
 
Type meet_nil (Type t)
 
boolean must_nil ()
 
SB str (SB sb, VBitSet dups, TypeMem mem, boolean debug)
 
TypeObj update (Access fin, String fld, Type val)
 
TypeObj update (TypeInt idx, Type val)
 
void walk (Predicate< Type > p)
 
TypeStr widen ()
 

Static Public Member Functions

static TypeStr con (String con)
 
static void init ()
 
static TypeStr make (boolean any, String con)
 
static TypeStr make (String name, boolean any, String con)
 

Static Public Attributes

static final TypeStr ABC = make(false,"abc")
 
static final TypeObj ISUSED
 
static final TypeObj OBJ
 
static final TypeStr STR = make(false,null)
 
static final TypeObj UNUSED
 
static final TypeObj XOBJ
 
static final TypeStr XSTR = STR.dual()
 

Protected Member Functions

init (byte type, String name, boolean any, boolean use)
 
TypeStr xdual ()
 
Type xmeet (Type t)
 

Package Functions

int compute_hash ()
 
TypeObj flatten_fields ()
 
boolean is_display ()
 
TypeStr rdual ()
 
TypeObj remove_other_flds (String fld, Type live)
 

Static Package Functions

 [static initializer]
 
static void init1 (HashMap< String, Type > types)
 

Package Attributes

boolean _any
 
boolean _use
 

Static Package Attributes

static final TypeStr[] TYPES = new TypeStr[]{STR,ABC,DEF}
 

Private Member Functions

TypeStr init (String name, boolean any, String con)
 

Private Attributes

String _con
 

Static Private Attributes

static final TypeStr DEF = con("def")
 

Detailed Description

Definition at line 14 of file TypeStr.java.

Member Function Documentation

◆ [static initializer]()

com.cliffc.aa.type.TypeStr.[static initializer]
staticpackage

◆ above_center()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.above_center
inherited

Definition at line 77 of file TypeObj.java.

77 { return _any; }

◆ compute_hash()

int com.cliffc.aa.type.TypeStr.compute_hash ( )
package

Definition at line 21 of file TypeStr.java.

21 { return super.compute_hash() + (_con==null ? 0 : _con.hashCode()); }

References com.cliffc.aa.type.TypeStr._con.

Referenced by com.cliffc.aa.type.TypeStr.rdual().

Here is the caller graph for this function:

◆ con()

static TypeStr com.cliffc.aa.type.TypeStr.con ( String  con)
static

◆ crush()

TypeObj com.cliffc.aa.type.TypeStr.crush ( )

Definition at line 97 of file TypeStr.java.

97 { return this; }

◆ cycle_equals()

boolean com.cliffc.aa.type.TypeStr.cycle_equals ( Type  o)

Definition at line 27 of file TypeStr.java.

27 { return equals(o); }

References com.cliffc.aa.type.TypeStr.equals().

Here is the call graph for this function:

◆ equals()

boolean com.cliffc.aa.type.TypeStr.equals ( Object  o)

Definition at line 22 of file TypeStr.java.

22  {
23  if( this==o ) return true;
24  if( !(o instanceof TypeStr) || !super.equals(o) ) return false;
25  return Util.eq(_con,((TypeStr)o)._con);
26  }

References com.cliffc.aa.type.TypeStr._con, and com.cliffc.aa.util.Util.eq().

Referenced by com.cliffc.aa.type.TypeStr.cycle_equals().

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

◆ flatten_fields()

TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.flatten_fields
packageinherited

Definition at line 74 of file TypeObj.java.

74 { return this; }

◆ getstr()

String com.cliffc.aa.type.TypeStr.getstr ( )

Definition at line 52 of file TypeStr.java.

52 { assert _con!=null; return _con; }

References com.cliffc.aa.type.TypeStr._con.

Referenced by com.cliffc.aa.node.NewStrNode.AddStrStr.value().

Here is the caller graph for this function:

◆ init() [1/3]

static void com.cliffc.aa.type.TypeStr.init ( )
static

Definition at line 43 of file TypeStr.java.

43 {} // Used to force class init

◆ init() [2/3]

O com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.init ( byte  type,
String  name,
boolean  any,
boolean  use 
)
protectedinherited

Definition at line 19 of file TypeObj.java.

19  {
20  super.init(type,name);
21  _any=any;
22  _use=use;
23  return (O)this;
24  }

◆ init() [3/3]

TypeStr com.cliffc.aa.type.TypeStr.init ( String  name,
boolean  any,
String  con 
)
private

Definition at line 16 of file TypeStr.java.

16  {
17  super.init(TSTR,name,any,any);
18  _con = con;
19  return this;
20  }

References com.cliffc.aa.type.TypeStr._con, com.cliffc.aa.type.TypeStr.con(), and com.cliffc.aa.type.TypeStr.init().

Referenced by com.cliffc.aa.type.TypeStr.init(), com.cliffc.aa.type.TypeStr.make(), and com.cliffc.aa.type.TypeStr.xdual().

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

◆ init1()

static void com.cliffc.aa.type.TypeStr.init1 ( HashMap< String, Type types)
staticpackage

Definition at line 50 of file TypeStr.java.

50 { types.put("str",TypeMemPtr.STRPTR); }

References com.cliffc.aa.type.TypeMemPtr.STRPTR.

Referenced by com.cliffc.aa.type.Type< TypeFlt >.init0().

Here is the caller graph for this function:

◆ is_con()

boolean com.cliffc.aa.type.TypeStr.is_con ( )

Definition at line 94 of file TypeStr.java.

94 { return _con != null; }

References com.cliffc.aa.type.TypeStr._con.

Referenced by com.cliffc.aa.node.NewStrNode.AddStrStr.value().

Here is the caller graph for this function:

◆ is_display()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.is_display
packageinherited

Definition at line 50 of file TypeObj.java.

50 { return false; }

◆ isBitShape()

byte com.cliffc.aa.type.TypeStr.isBitShape ( Type  t)

Definition at line 105 of file TypeStr.java.

105  {
106  if( t._type==TNIL || t._type==Type.TSTR || t._type == TOBJ ) return 0;
107  return 99;
108  }

References com.cliffc.aa.type.Type< T extends Type< T >._type, and com.cliffc.aa.type.Type< T extends Type< T >.TSTR.

◆ make() [1/2]

static TypeStr com.cliffc.aa.type.TypeStr.make ( boolean  any,
String  con 
)
static

Definition at line 41 of file TypeStr.java.

41 { return make("",any,con); }

References com.cliffc.aa.type.TypeStr.con(), and com.cliffc.aa.type.TypeStr.make().

Referenced by com.cliffc.aa.type.TypeStr.make().

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

◆ make() [2/2]

static TypeStr com.cliffc.aa.type.TypeStr.make ( String  name,
boolean  any,
String  con 
)
static

Definition at line 36 of file TypeStr.java.

36  {
37  TypeStr t1 = POOLS[TSTR].malloc();
38  return t1.init(name,any,con).hashcons_free();
39  }

References com.cliffc.aa.type.TypeStr.con(), and com.cliffc.aa.type.TypeStr.init().

Referenced by com.cliffc.aa.type.TypeStr.con(), com.cliffc.aa.node.NewStrNode.AddStrStr.value(), com.cliffc.aa.node.NewStrNode.ConvertI64Str.valueobj(), com.cliffc.aa.node.NewStrNode.ConvertF64Str.valueobj(), and com.cliffc.aa.type.TypeStr.xmeet().

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

◆ may_be_con()

boolean com.cliffc.aa.type.TypeStr.may_be_con ( )

Definition at line 93 of file TypeStr.java.

93 { return super.may_be_con() || _con != null; }

References com.cliffc.aa.type.TypeStr._con.

◆ may_nil()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.may_nil
inherited

Definition at line 81 of file TypeObj.java.

81 { return false; }

◆ meet_nil()

Type com.cliffc.aa.type.TypeStr.meet_nil ( Type  t)

Definition at line 95 of file TypeStr.java.

95 { return this; }

◆ must_nil()

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.must_nil
inherited

Definition at line 80 of file TypeObj.java.

80 { return false; }

◆ rdual()

TypeStr com.cliffc.aa.type.TypeStr.rdual ( )
package

Definition at line 55 of file TypeStr.java.

55  {
56  if( _dual != null ) return _dual;
57  TypeStr dual = _dual = xdual();
58  dual._dual = this;
59  dual._hash = dual.compute_hash();
60  return dual;
61  }

References com.cliffc.aa.type.TypeStr.compute_hash(), and com.cliffc.aa.type.TypeStr.xdual().

Here is the call graph for this function:

◆ remove_other_flds()

TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.remove_other_flds ( String  fld,
Type  live 
)
packageinherited

Definition at line 75 of file TypeObj.java.

75 { return UNUSED; }

◆ str()

SB com.cliffc.aa.type.TypeStr.str ( SB  sb,
VBitSet  dups,
TypeMem  mem,
boolean  debug 
)

Definition at line 28 of file TypeStr.java.

28  {
29  if( _any ) sb.p('~');
30  if( _con == null ) sb.p("str");
31  else sb.p('"').p(_con).p('"');
32  return sb;
33  }

References com.cliffc.aa.type.TypeObj< TypeStr >._any, com.cliffc.aa.type.TypeStr._con, and com.cliffc.aa.util.SB.p().

Here is the call graph for this function:

◆ update() [1/2]

TypeObj com.cliffc.aa.type.TypeStr.update ( Access  fin,
String  fld,
Type  val 
)

Definition at line 91 of file TypeStr.java.

91 { return this; }

◆ update() [2/2]

TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.update ( TypeInt  idx,
Type  val 
)
inherited

Definition at line 69 of file TypeObj.java.

69  {
70  if( this==ISUSED || this==OBJ ) return this;
71  return TypeAry.ARY.dual().update(idx,val);
72  }

◆ walk()

void com.cliffc.aa.type.TypeStr.walk ( Predicate< Type p)

Definition at line 110 of file TypeStr.java.

110 { p.test(this); }

◆ widen()

TypeStr com.cliffc.aa.type.TypeStr.widen ( )

Definition at line 109 of file TypeStr.java.

109 { return STR; }

References com.cliffc.aa.type.TypeStr.STR.

◆ xdual()

TypeStr com.cliffc.aa.type.TypeStr.xdual ( )
protected

Definition at line 54 of file TypeStr.java.

54 { return _con == null ? new TypeStr().init(_name, !_any,_con) : this; }

References com.cliffc.aa.type.TypeObj< TypeStr >._any, com.cliffc.aa.type.TypeStr._con, and com.cliffc.aa.type.TypeStr.init().

Referenced by com.cliffc.aa.type.TypeStr.rdual().

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

◆ xmeet()

Type com.cliffc.aa.type.TypeStr.xmeet ( Type  t)
protected

Definition at line 62 of file TypeStr.java.

62  {
63  switch( t._type ) {
64  case TSTR: break;
65  case TARY:
66  case TLIVE:
67  case TSTRUCT:return OBJ;
68  case TOBJ: return t.xmeet(this);
69  case TFUNSIG:
70  case TTUPLE:
71  case TFUNPTR:
72  case TMEMPTR:
73  case TFLT:
74  case TINT:
75  case TRPC:
76  case TMEM: return ALL;
77  default: throw typerr(t);
78  }
79  TypeStr ts = (TypeStr)t;
80  boolean any = _any&ts._any;
81  String con = null;
82  if( ts._any && ts._con==null ) con = _con;
83  else if( _any && _con==null ) con = ts._con;
84  else if( Util.eq(_con,ts._con) ) con = _con;
85  else any=false;
86  return make("",any,con);
87  }

References com.cliffc.aa.type.TypeObj< TypeStr >._any, com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._any, com.cliffc.aa.type.TypeStr._con, com.cliffc.aa.type.Type< T extends Type< T >._type, com.cliffc.aa.type.TypeStr.con(), com.cliffc.aa.util.Util.eq(), com.cliffc.aa.type.TypeStr.make(), com.cliffc.aa.type.TypeObj< TypeStr >.OBJ, and com.cliffc.aa.type.Type< T extends Type< T >.xmeet().

Here is the call graph for this function:

Member Data Documentation

◆ _any

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._any
packageinherited

Definition at line 16 of file TypeObj.java.

◆ _con

◆ _use

boolean com.cliffc.aa.type.TypeObj< O extends TypeObj< O >._use
packageinherited

Definition at line 17 of file TypeObj.java.

◆ ABC

◆ DEF

final TypeStr com.cliffc.aa.type.TypeStr.DEF = con("def")
staticprivate

Definition at line 48 of file TypeStr.java.

◆ ISUSED

final TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.ISUSED
staticinherited

Definition at line 45 of file TypeObj.java.

◆ OBJ

final TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.OBJ
staticinherited

Definition at line 44 of file TypeObj.java.

◆ STR

◆ TYPES

final TypeStr [] com.cliffc.aa.type.TypeStr.TYPES = new TypeStr[]{STR,ABC,DEF}
staticpackage

Definition at line 49 of file TypeStr.java.

◆ UNUSED

final TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.UNUSED
staticinherited

Definition at line 46 of file TypeObj.java.

◆ XOBJ

final TypeObj com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.XOBJ
staticinherited

Definition at line 47 of file TypeObj.java.

◆ XSTR

final TypeStr com.cliffc.aa.type.TypeStr.XSTR = STR.dual()
static

Definition at line 46 of file TypeStr.java.

Referenced by com.cliffc.aa.node.NewStrNode.dead_type().


The documentation for this class was generated from the following file:
com.cliffc.aa.type.TypeObj< TypeStr >::_any
boolean _any
Definition: TypeObj.java:16
com.cliffc.aa.type.TypeStr.xdual
TypeStr xdual()
Definition: TypeStr.java:54
com.cliffc.aa.type.TypeStr.make
static TypeStr make(String name, boolean any, String con)
Definition: TypeStr.java:36
com.cliffc.aa.type.TypeStr._con
String _con
Definition: TypeStr.java:15
com.cliffc.aa.type.TypeObj< TypeStr >::OBJ
static final TypeObj OBJ
Definition: TypeObj.java:44
com.cliffc.aa.type.TypeObj< TypeStr >::UNUSED
static final TypeObj UNUSED
Definition: TypeObj.java:46
com.cliffc.aa.type.TypeObj< TypeStr >::ISUSED
static final TypeObj ISUSED
Definition: TypeObj.java:45
com.cliffc.aa.type.TypeStr.con
static TypeStr con(String con)
Definition: TypeStr.java:42
com.cliffc.aa.type.TypeStr.STR
static final TypeStr STR
Definition: TypeStr.java:45
com.cliffc.aa.type.TypeObj< TypeStr >::_use
boolean _use
Definition: TypeObj.java:17
com.cliffc.aa.type.TypeObj.xmeet
Type xmeet(Type t)
Definition: TypeObj.java:53
com.cliffc.aa.type.TypeStr.equals
boolean equals(Object o)
Definition: TypeStr.java:22