public static void Append(AstType t) { if (t == null) _astData.Append("(NullType) "); else t.GenerateAstData(); }
public MethodRec(AstId id, AstType type) { _id = id; _rtype = type; _params = new List<VarRec>(); _locals = new List<VarRec>(); }
public VarRec(AstId id, AstType type, int kind, int idx, AstExp e) { _id = id; _type = type; _kind = kind; _idx = idx; _init = e; }
public VarRec(AstId id, AstType type, int kind, int idx) { _id = id; _type = type; _kind = kind; _idx = idx; _init = null; }
public AstMethodDecl(AstType at, AstId i, AstFormalList afl, AstVarDeclList avl, AstStmtList asl) { t=at; mid=i; fl=afl; vl=avl; sl=asl; }
public AstVarDecl(AstType at, AstId i, AstExp ae) { t = at; var = i; e = ae; }
public AstNewArray(AstType t, int i) { et = t; size = i; }
private bool isIntType(AstType t) { return (null != (t as AstBasicType)) && (((AstBasicType)t).typ == AstBasicType.Int); }
/* throws Exception */ private bool compatible(AstType t1, AstType t2) { if (t1 == t2) return true; else if ((null != (t1 as AstBasicType)) && (null != (t2 as AstBasicType))) { int bt1 = ((AstBasicType)t1).typ; int bt2 = ((AstBasicType)t2).typ; if (bt1 == bt2) return true; } else if ((null != (t1 as AstObjType)) && (null != (t2 as AstObjType))) { AstId cid1 = ((AstObjType) t1).cid; AstId cid2 = ((AstObjType) t2).cid; if (cid1.s.Equals(cid2.s)) { return true; } else { ClassRec c = symTable.GetClass(cid2); while ((c = c.Parent()) != null) { if (cid1.s.Equals(c.Id().s)) return true; } } } else if ((null != (t1 as AstArrayType)) && (null != (t2 as AstArrayType))) { return compatible(((AstArrayType) t1).et, ((AstArrayType) t2).et); } return false; }
public AstArrayType(AstType t) { et = t; }