if(Node::fromExpr(from_e).getAttribute(VarNameAttr(), name)) {
// temporarily set the node manager to NULL; this gets around
// a check that mkVar isn't called internally
- NodeManagerScope nullScope(NULL);
if(n.getKind() == kind::BOUND_VAR_LIST || n.getKind() == kind::BOUND_VARIABLE) {
+ NodeManagerScope nullScope(NULL);
to_e = to->mkBoundVar(name, type);// FIXME thread safety
} else if(n.getKind() == kind::VARIABLE) {
- to_e = to->mkVar(name, type);// FIXME thread safety
+ bool isGlobal;
+ Node::fromExpr(from_e).getAttribute(GlobalVarAttr(), isGlobal);
+ NodeManagerScope nullScope(NULL);
+ to_e = to->mkVar(name, type, isGlobal);// FIXME thread safety
} else if(n.getKind() == kind::SKOLEM) {
// skolems are only available at the Node level (not the Expr level)
TypeNode typeNode = TypeNode::fromType(type);
// TODO: hide this attribute behind a NodeManager interface.
namespace attr {
struct VarNameTag { };
+ struct GlobalVarTag { };
struct SortArityTag { };
struct DatatypeTupleTag { };
struct DatatypeRecordTag { };
}/* CVC4::expr::attr namespace */
typedef Attribute<attr::VarNameTag, std::string> VarNameAttr;
+typedef Attribute<attr::GlobalVarTag(), bool> GlobalVarAttr;
typedef Attribute<attr::SortArityTag, uint64_t> SortArityAttr;
/** Attribute true for datatype types that are replacements for tuple types */
typedef expr::Attribute<expr::attr::DatatypeTupleTag, TypeNode> DatatypeTupleAttr;
setAttribute(n, TypeAttr(), type);
setAttribute(n, TypeCheckedAttr(), true);
setAttribute(n, expr::VarNameAttr(), name);
+ setAttribute(n, expr::GlobalVarAttr(), isGlobal);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewVar(n, isGlobal);
}
setAttribute(*n, TypeAttr(), type);
setAttribute(*n, TypeCheckedAttr(), true);
setAttribute(*n, expr::VarNameAttr(), name);
+ setAttribute(*n, expr::GlobalVarAttr(), isGlobal);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewVar(*n, isGlobal);
}
Node n = NodeBuilder<0>(this, kind::VARIABLE);
setAttribute(n, TypeAttr(), type);
setAttribute(n, TypeCheckedAttr(), true);
+ setAttribute(n, expr::GlobalVarAttr(), isGlobal);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewVar(n, isGlobal);
}
Node* n = NodeBuilder<0>(this, kind::VARIABLE).constructNodePtr();
setAttribute(*n, TypeAttr(), type);
setAttribute(*n, TypeCheckedAttr(), true);
+ setAttribute(*n, expr::GlobalVarAttr(), isGlobal);
for(std::vector<NodeManagerListener*>::iterator i = d_listeners.begin(); i != d_listeners.end(); ++i) {
(*i)->nmNotifyNewVar(*n, isGlobal);
}