Design 2 example (2)
class TypeCheckVisitor implements ASTVisitor
{
visitAssign(Assign a)
{
Type ltype = a.getLeft().getType();
Type rtype = a.getRight().getType();
if (! Ltype.isSuperOf(rtype)) {
errors.add(...);
}
}
...
}