aa
com.cliffc.aa.node.Node.ErrMsg Class Reference
Inheritance diagram for com.cliffc.aa.node.Node.ErrMsg:
[legend]
Collaboration diagram for com.cliffc.aa.node.Node.ErrMsg:
[legend]

Public Member Functions

 ErrMsg (Parse loc, String msg, Level lvl)
 
int compareTo (ErrMsg msg)
 
boolean equals (Object obj)
 
int hashCode ()
 
String toString ()
 

Static Public Member Functions

static ErrMsg asserterr (Parse loc, Type actual, Type t0mem, Type expected)
 
static ErrMsg badGC (Parse loc)
 
static ErrMsg field (Parse loc, String msg, String fld, boolean closure, TypeObj to)
 
static ErrMsg forward_ref (Parse loc, FunPtrNode fun)
 
static ErrMsg forward_ref (Parse loc, String name)
 
static ErrMsg niladr (Parse loc, String msg, String fld)
 
static ErrMsg syntax (Parse loc, String msg)
 
static ErrMsg trailingjunk (Parse loc)
 
static ErrMsg typerr (Parse loc, Type actual, Type t0mem, Type expected)
 
static ErrMsg typerr (Parse loc, Type actual, Type t0mem, Type expected, Level lvl)
 
static ErrMsg typerr (Parse loc, Type actual, Type t0mem, Type[] expecteds)
 
static ErrMsg unresolved (Parse loc, String msg)
 

Public Attributes

Parse _loc
 
final Level _lvl
 
final String _msg
 
int _order
 

Static Public Attributes

static final ErrMsg BADARGS = new ErrMsg(null,"bad arguments",Level.BadArgs)
 
static final ErrMsg FAST = new ErrMsg(null,"fast",Level.Syntax)
 

Detailed Description

Definition at line 888 of file Node.java.

Constructor & Destructor Documentation

◆ ErrMsg()

Member Function Documentation

◆ asserterr()

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.asserterr ( Parse  loc,
Type  actual,
Type  t0mem,
Type  expected 
)
static

Definition at line 926 of file Node.java.

926  {
927  return typerr(loc,actual,t0mem,expected,Level.Assert);
928  }

References com.cliffc.aa.node.Node.Level.Assert, and com.cliffc.aa.node.Node.ErrMsg.typerr().

Referenced by com.cliffc.aa.node.AssertNode.err().

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

◆ badGC()

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.badGC ( Parse  loc)
static

Definition at line 938 of file Node.java.

938  {
939  return new ErrMsg(loc,"Cannot mix GC and non-GC types",Level.MixedPrimGC);
940  }

References com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), and com.cliffc.aa.node.Node.Level.MixedPrimGC.

Referenced by com.cliffc.aa.node.PhiNode.err().

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

◆ compareTo()

int com.cliffc.aa.node.Node.ErrMsg.compareTo ( ErrMsg  msg)

Definition at line 948 of file Node.java.

948  {
949  int cmp = _lvl.compareTo(msg._lvl);
950  if( cmp != 0 ) return cmp;
951  return _order - msg._order;
952  //cmp = _loc.compareTo(msg._loc);
953  //if( cmp != 0 ) return cmp;
954  //return _msg.compareTo(msg._msg);
955  }

References com.cliffc.aa.node.Node.ErrMsg._lvl, and com.cliffc.aa.node.Node.ErrMsg._order.

◆ equals()

boolean com.cliffc.aa.node.Node.ErrMsg.equals ( Object  obj)

Definition at line 956 of file Node.java.

956  {
957  if( this==obj ) return true;
958  if( !(obj instanceof ErrMsg) ) return false;
959  ErrMsg err = (ErrMsg)obj;
960  if( _lvl!=err._lvl || !_msg.equals(err._msg) ) return false;
961  // Spread a missing loc; cheaty but only a little bit.
962  // TODO: track down missing loc in Parser
963  if( _loc==null && err._loc!=null ) _loc=err._loc;
964  if( _loc!=null && err._loc==null ) err._loc=_loc;
965  return _loc==err._loc || _loc.equals(err._loc);
966  }

References com.cliffc.aa.node.Node.ErrMsg._loc, com.cliffc.aa.node.Node.ErrMsg._lvl, com.cliffc.aa.node.Node.ErrMsg._msg, com.cliffc.aa.Parse.equals(), com.cliffc.aa.node.Node.err(), and com.cliffc.aa.node.Node.ErrMsg.ErrMsg().

Referenced by com.cliffc.aa.node.ErrNode.equals().

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

◆ field()

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.field ( Parse  loc,
String  msg,
String  fld,
boolean  closure,
TypeObj  to 
)
static

Definition at line 929 of file Node.java.

929  {
930  SB sb = new SB().p(msg).p(closure ? " val '" : " field '.").p(fld).p("'");
931  if( to != null && !closure ) to.str(sb.p(" in "),new VBitSet(),null,false);
932  return new ErrMsg(loc,sb.toString(),Level.Field);
933  }

References com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), com.cliffc.aa.node.Node.Level.Field, com.cliffc.aa.util.SB.p(), com.cliffc.aa.type.TypeObj< O extends TypeObj< O >.str(), and com.cliffc.aa.util.SB.toString().

Referenced by com.cliffc.aa.node.StoreNode.bad(), and com.cliffc.aa.node.LoadNode.bad().

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

◆ forward_ref() [1/2]

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.forward_ref ( Parse  loc,
FunPtrNode  fun 
)
static

Definition at line 896 of file Node.java.

896 { return forward_ref(loc,fun._name); }

References com.cliffc.aa.node.FunPtrNode._name, and com.cliffc.aa.node.Node.ErrMsg.forward_ref().

Referenced by com.cliffc.aa.node.CallNode.err(), com.cliffc.aa.node.FunPtrNode.forward_ref(), com.cliffc.aa.node.Node.ErrMsg.forward_ref(), and com.cliffc.aa.Parse.inc().

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

◆ forward_ref() [2/2]

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.forward_ref ( Parse  loc,
String  name 
)
static

Definition at line 897 of file Node.java.

897  {
898  return new ErrMsg(loc,"Unknown ref '"+name+"'",Level.ForwardRef);
899  }

References com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), and com.cliffc.aa.node.Node.Level.ForwardRef.

Here is the call graph for this function:

◆ hashCode()

int com.cliffc.aa.node.Node.ErrMsg.hashCode ( )

Definition at line 967 of file Node.java.

967  {
968  return (_loc==null ? 0 : _loc.hashCode())+_msg.hashCode()+_lvl.hashCode();
969  }

References com.cliffc.aa.node.Node.ErrMsg._loc, com.cliffc.aa.node.Node.ErrMsg._lvl, com.cliffc.aa.node.Node.ErrMsg._msg, and com.cliffc.aa.Parse.hashCode().

Referenced by com.cliffc.aa.node.ErrNode.hashCode().

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

◆ niladr()

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.niladr ( Parse  loc,
String  msg,
String  fld 
)
static

Definition at line 934 of file Node.java.

934  {
935  String f = fld==null ? msg : msg+" field '."+fld+"'";
936  return new ErrMsg(loc,f,Level.NilAdr);
937  }

References com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), and com.cliffc.aa.node.Node.Level.NilAdr.

Referenced by com.cliffc.aa.node.MemPrimNode.err(), com.cliffc.aa.node.StoreNode.err(), and com.cliffc.aa.node.LoadNode.err().

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

◆ syntax()

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.syntax ( Parse  loc,
String  msg 
)
static

Definition at line 900 of file Node.java.

900  {
901  return new ErrMsg(loc,msg,Level.Syntax);
902  }

References com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), and com.cliffc.aa.node.Node.Level.Syntax.

Referenced by com.cliffc.aa.node.MemPrimNode.LValueWriteFinal.err(), com.cliffc.aa.node.CallNode.err(), and com.cliffc.aa.Parse.stmt().

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

◆ toString()

String com.cliffc.aa.node.Node.ErrMsg.toString ( )

Definition at line 945 of file Node.java.

945  {
946  return _loc==null ? _msg : _loc.errLocMsg(_msg);
947  }

References com.cliffc.aa.node.Node.ErrMsg._loc, com.cliffc.aa.node.Node.ErrMsg._msg, and com.cliffc.aa.Parse.errLocMsg().

Here is the call graph for this function:

◆ trailingjunk()

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.trailingjunk ( Parse  loc)
static

Definition at line 941 of file Node.java.

941  {
942  return new ErrMsg(loc,"Syntax error; trailing junk",Level.TrailingJunk);
943  }

References com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), and com.cliffc.aa.node.Node.Level.TrailingJunk.

Referenced by com.cliffc.aa.Parse.gather_errors().

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

◆ typerr() [1/3]

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.typerr ( Parse  loc,
Type  actual,
Type  t0mem,
Type  expected 
)
static

Definition at line 906 of file Node.java.

906 { return typerr(loc,actual,t0mem,expected,Level.TypeErr); }

References com.cliffc.aa.node.Node.Level.TypeErr, and com.cliffc.aa.node.Node.ErrMsg.typerr().

Referenced by com.cliffc.aa.node.Node.ErrMsg.asserterr(), com.cliffc.aa.node.MemPrimNode.err(), com.cliffc.aa.node.ParmNode.err(), com.cliffc.aa.node.IntrinsicNode.err(), com.cliffc.aa.node.PrimNode.err(), com.cliffc.aa.node.PrimNode.ConvertTypeName.err(), com.cliffc.aa.node.CallNode.err(), and com.cliffc.aa.node.Node.ErrMsg.typerr().

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

◆ typerr() [2/3]

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.typerr ( Parse  loc,
Type  actual,
Type  t0mem,
Type  expected,
Level  lvl 
)
static

Definition at line 907 of file Node.java.

907  {
908  TypeMem tmem = t0mem instanceof TypeMem ? (TypeMem)t0mem : null;
909  VBitSet vb = new VBitSet();
910  SB sb = actual.str(new SB(),vb, tmem, false).p(" is not a ");
911  vb.clear();
912  expected.str(sb,vb,null,false); // Expected is already a complex ptr, does not depend on memory
913  if( actual==Type.ALL && lvl==Level.TypeErr ) lvl=Level.AllTypeErr; // ALLs have failed earlier, so this is a lower priority error report
914  return new ErrMsg(loc,sb.toString(),lvl);
915  }

References com.cliffc.aa.type.Type< T extends Type< T >.ALL, com.cliffc.aa.node.Node.Level.AllTypeErr, com.cliffc.aa.util.SB.clear(), com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), com.cliffc.aa.util.SB.p(), com.cliffc.aa.type.Type< T extends Type< T >.str(), com.cliffc.aa.util.SB.toString(), and com.cliffc.aa.node.Node.Level.TypeErr.

Here is the call graph for this function:

◆ typerr() [3/3]

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.typerr ( Parse  loc,
Type  actual,
Type  t0mem,
Type[]  expecteds 
)
static

Definition at line 916 of file Node.java.

916  {
917  TypeMem tmem = t0mem instanceof TypeMem ? (TypeMem)t0mem : null;
918  VBitSet vb = new VBitSet();
919  SB sb = actual.str(new SB(),vb, tmem,false);
920  sb.p( expecteds.length==1 ? " is not a " : " is none of (");
921  vb.clear();
922  for( Type expect : expecteds ) expect.str(sb,vb,null,false).p(',');
923  sb.unchar().p(expecteds.length==1 ? "" : ")");
924  return new ErrMsg(loc,sb.toString(),Level.TypeErr);
925  }

References com.cliffc.aa.util.SB.clear(), com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), com.cliffc.aa.util.SB.p(), com.cliffc.aa.type.Type< T extends Type< T >.str(), com.cliffc.aa.util.SB.toString(), com.cliffc.aa.node.Node.Level.TypeErr, and com.cliffc.aa.util.SB.unchar().

Here is the call graph for this function:

◆ unresolved()

static ErrMsg com.cliffc.aa.node.Node.ErrMsg.unresolved ( Parse  loc,
String  msg 
)
static

Definition at line 903 of file Node.java.

903  {
904  return new ErrMsg(loc,msg,Level.UnresolvedCall);
905  }

References com.cliffc.aa.node.Node.ErrMsg.ErrMsg(), and com.cliffc.aa.node.Node.Level.UnresolvedCall.

Referenced by com.cliffc.aa.node.CallNode.err().

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

Member Data Documentation

◆ _loc

◆ _lvl

◆ _msg

◆ _order

int com.cliffc.aa.node.Node.ErrMsg._order

◆ BADARGS

final ErrMsg com.cliffc.aa.node.Node.ErrMsg.BADARGS = new ErrMsg(null,"bad arguments",Level.BadArgs)
static

Definition at line 894 of file Node.java.

Referenced by com.cliffc.aa.node.PrimNode.err().

◆ FAST


The documentation for this class was generated from the following file:
com.cliffc.aa.type.TypeMem
Memory type; the state of all of memory; memory edges order memory ops.
Definition: TypeMem.java:53
com.cliffc.aa.Parse.hashCode
int hashCode()
Definition: Parse.java:1497
com.cliffc.aa.type.Type
an implementation of language AA
Definition: Type.java:94
com.cliffc.aa.util.SB.clear
SB clear()
Definition: SB.java:61
com.cliffc.aa.node.Node.ErrMsg.typerr
static ErrMsg typerr(Parse loc, Type actual, Type t0mem, Type expected)
Definition: Node.java:906
com.cliffc.aa.node.Node.err
ErrMsg err(boolean fast)
Definition: Node.java:526
com.cliffc.aa.node.Node.ErrMsg._msg
final String _msg
Definition: Node.java:890
com.cliffc.aa.type.Type.str
SB str(SB sb, VBitSet dups, TypeMem mem, boolean debug)
Definition: Type.java:131
com.cliffc.aa.node.Node.ErrMsg._order
int _order
Definition: Node.java:892
com.cliffc.aa.util.SB.unchar
SB unchar()
Definition: SB.java:58
com.cliffc.aa.type.Type.ALL
static final Type ALL
Definition: Type.java:324
com.cliffc.aa.Parse.equals
boolean equals(Object loc)
Definition: Parse.java:1491
com.cliffc.aa.node.Node.ErrMsg._lvl
final Level _lvl
Definition: Node.java:891
com.cliffc.aa.Parse.errLocMsg
String errLocMsg(String s)
Definition: Parse.java:1466
com.cliffc.aa.util.VBitSet
Definition: VBitSet.java:5
com.cliffc.aa.type.TypeObj.str
SB str(SB sb, VBitSet dups, TypeMem mem, boolean debug)
Definition: TypeObj.java:34
com.cliffc.aa.util.SB
Tight/tiny StringBuilder wrapper.
Definition: SB.java:8
com.cliffc.aa.util.SB.p
SB p(String s)
Definition: SB.java:13
com.cliffc.aa.node.Node.ErrMsg.ErrMsg
ErrMsg(Parse loc, String msg, Level lvl)
Definition: Node.java:895
com.cliffc.aa.node.Node.ErrMsg._loc
Parse _loc
Definition: Node.java:889
com.cliffc.aa.node.Node.ErrMsg.forward_ref
static ErrMsg forward_ref(Parse loc, FunPtrNode fun)
Definition: Node.java:896
com.cliffc.aa.util.SB.toString
String toString()
Definition: SB.java:62