/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This file is part of SimpleC. * * See the file "SimpleC-LICENSE" for Copyright information and * * the terms and conditions for copying, distribution and * * modification of SimpleC. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package org.sablecc.simplec; class Ref extends Type { Variable ref = new Variable(Bottom.instance); Variable lam = new Variable(Bottom.instance); void unify(Type t) { Variable ref1 = ref.ecr(); Variable ref2 = ((Ref) t).ref.ecr(); Variable lam1 = lam.ecr(); Variable lam2 = ((Ref) t).lam.ecr(); if(ref1 != ref2) { ref1.join(ref2); } if(lam1 != lam2) { lam1.join(lam2); } } public String toString() { StringBuffer s = new StringBuffer(); s.append("REF("); if(ref.ecr().type == Bottom.instance) { s.append("bottom"); } else { s.append("T" + ref.ecr().number); } s.append(","); if(lam.ecr().type == Bottom.instance) { s.append("bottom"); } else { s.append("T" + lam.ecr().number); } s.append(")"); return s.toString(); } }