Search in sources :

Example 1 with VisitorDesugar

use of boa.compiler.transforms.VisitorDesugar in project compiler by boalang.

the class TypeCheckingVisitor method visit.

/** {@inheritDoc} */
@Override
public void visit(final VisitorExpression n, final SymbolTable env) {
    n.env = env;
    n.getType().accept(this, env);
    for (final Statement s : n.getBody().getStatements()) if (!(s instanceof VisitStatement))
        throw new TypeCheckException(s, "only 'before' or 'after' visit statements are allowed inside visitor bodies");
    visitorChecker.start(n);
    n.getBody().accept(this, env);
    n.type = n.getType().type;
    final VisitorDesugar desugar = new VisitorDesugar();
    desugar.start(n);
}
Also used : VisitorDesugar(boa.compiler.transforms.VisitorDesugar) TypeCheckException(boa.compiler.TypeCheckException)

Aggregations

TypeCheckException (boa.compiler.TypeCheckException)1 VisitorDesugar (boa.compiler.transforms.VisitorDesugar)1