Go to the documentation of this file. 1 package com.cliffc.aa.type;
6 import org.jetbrains.annotations.NotNull;
8 import java.util.function.Predicate;
15 public @NotNull String
_fld;
30 @Override
public boolean equals( Object o ) {
31 if(
this==o )
return true;
32 if( !(o instanceof
TypeFld) )
return false;
37 if(
this==o )
return true;
38 if( !(o instanceof
TypeFld) )
return false;
62 private static final String[]
ARGS =
new String[]{
"^",
"x",
"y",
"z"};
63 private static final String[]
TUPS =
new String[]{
"^",
"0",
"1",
"2"};
81 if(
this==tf )
return this;
88 return make(fld,t,access,order);
99 return malloc(fld,
null,access,order);
119 Access dual() {
return values[(
"6453120".charAt(ordinal()))-
'0']; }
120 private static final String[] FMEET = {
131 private static final String[] SHORTS =
new String[]{
"==",
":=",
"=",
"~=",
"!:=!",
"!=!",
"!~=!"};
132 private static final String[] LONGS =
new String[]{
"read-only",
"read/write",
"final",
"noaccess",
"!:=!",
"!=!",
"!~=!"};
133 @Override
public String
toString() {
return LONGS[ordinal()]; }
134 public SB str(
SB sb,
boolean debug) {
return sb.
p(SHORTS[ordinal()]); }
139 public static final String
fldTop =
"\\";
140 public static final String
fldBot =
"." ;
142 private static String
sdual(String s) {
148 private static String
smeet( String s0, String s1 ) {
149 if(
Util.
eq(s0,s1) )
return s0;
156 private static final int oTop = -1;
157 private static final int oBot = -2;
158 private static int odual(
int order ) {
163 private static int omeet(
int o0,
int o1 ) {
164 if( o0==o1 )
return o0;
165 if( o0==
oTop )
return o1;
166 if( o1==
oTop )
return o0;
174 assert !(t instanceof
TypeFld);
175 if(
_t==t)
return this;
181 assert !(t instanceof
TypeFld);
182 if(
_t==t &&
_access==access )
return this;
193 @SuppressWarnings(
"unchecked")
194 @Override
public void walk( Predicate<Type> p ) {
if( p.test(
this) )
_t.
walk(p); }
198 for(
int i=0; i<flds.length; i++ )
static final String[] TUPS
static TypeFld make_tup(Type t, int order)
static String sdual(String s)
RuntimeException typerr(Type t)
Memory type; the state of all of memory; memory edges order memory ops.
static boolean eq(String s0, String s1)
static TypeFld malloc(String fld, Type t, int order)
TypeFld setX(Type t, Access access)
an implementation of language AA
static final TypeFld NO_DISP
static TypeFld cmeet(TypeFld f0, TypeFld f1)
static String smeet(String s0, String s1)
A memory-based collection of optionally named fields.
static TypeFld make(String fld, Type t, int order)
SB str(SB sb, VBitSet dups, TypeMem mem, boolean debug)
TypeFld make_from(Type t, Access a)
boolean cycle_equals(Type t)
static TypeFld make(String fld, Type t, Access access, int order)
boolean cycle_equals(Type o)
static int odual(int order)
static final String fldBot
static final String[] ARGS
Type make_from(Type head, TypeMem map, VBitSet visit)
static boolean isDigit(char c)
static final String fldTop
SB str(SB sb, boolean debug)
static final Access[] values
Tight/tiny StringBuilder wrapper.
static TypeFld malloc(String fld, Type t, Access access, int order)
void walk(Predicate< Type > p)
TypeFld make_from(Type head, TypeMem mem, VBitSet visit)
void walk(Predicate< Type > p)
static final Pool[] POOLS
TypeFld init( @NotNull String fld, Type t, Access access, int order)
SB str(SB sb, VBitSet dups, TypeMem mem, boolean debug)
static TypeFld make_arg(Type t, int order)
static int fld_find(TypeFld[] flds, String fld)
TypeFld make_from(Type t)
static int omeet(int o0, int o1)