Type Expr::getType(bool check) const throw (TypeCheckingException) {
ExprManagerScope ems(*this);
Assert(d_node != NULL, "Unexpected NULL expression pointer!");
+ CheckArgument(!d_node->isNull(), this, "Can't get type of null expression!");
return d_exprManager->getType(*this, check);
}
}
}
} else {
+ // f is not null-- meaning this is a definition not a declaration
if(!topLevel) {
// must be top-level; doesn't make sense to write something
// like e.g. FORALL(x:INT = 4): [...]
i != i_end;
++i) {
PARSER_STATE->checkDeclaration(*i, CHECK_UNDECLARED, SYM_VARIABLE);
+ Expr func = EXPR_MANAGER->mkVar(*i, f.getType());
PARSER_STATE->defineFunction(*i, f);
- Command* decl = new DefineFunctionCommand(*i, Expr(), f);
+ Command* decl = new DefineFunctionCommand(*i, func, f);
seq->addCommand(decl);
}
}
Expr func = c->getFunction();
const vector<Expr>& formals = c->getFormals();
Expr formula = c->getFormula();
- out << func << " : " << func.getType() << " = LAMBDA(";
- vector<Expr>::const_iterator i = formals.begin();
- while(i != formals.end()) {
- out << (*i) << ":" << (*i).getType();
- if(++i != formals.end()) {
- out << ", ";
+ out << func << " : " << func.getType() << " = ";
+ if(formals.size() > 0) {
+ out << "LAMBDA(";
+ vector<Expr>::const_iterator i = formals.begin();
+ while(i != formals.end()) {
+ out << (*i) << ":" << (*i).getType();
+ if(++i != formals.end()) {
+ out << ", ";
+ }
}
+ out << "): ";
}
- out << "): " << formula << ";";
+ out << formula << ";";
}
static void toStream(std::ostream& out, const DeclareTypeCommand* c) throw() {