Expr::Expr() :
d_node(new Node),
d_exprManager(NULL) {
+ // We do not need to wrap this in an ExprManagerScope as `new Node` is backed
+ // by NodeValue::null which is a static outside of a NodeManager.
}
Expr::Expr(ExprManager* em, Node* node) :
d_node(node),
d_exprManager(em) {
+ // We do not need to wrap this in an ExprManagerScope as this only initializes
+ // pointers
}
Expr::Expr(const Expr& e) :
- d_node(new Node(*e.d_node)),
+ d_node(NULL),
d_exprManager(e.d_exprManager) {
+ ExprManagerScope ems(*this);
+ d_node = new Node(*e.d_node);
}
Expr::~Expr() {
return Type(d_nodeManager, new TypeNode(typeNode));
}
-Type::Type(NodeManager* nm, TypeNode* node) :
- d_typeNode(node),
- d_nodeManager(nm) {
+Type::Type(NodeManager* nm, TypeNode* node)
+ : d_typeNode(node), d_nodeManager(nm) {
+ // This does not require a NodeManagerScope as this is restricted to be an
+ // internal only pointer initialization call.
}
-Type::~Type() {
- NodeManagerScope nms(d_nodeManager);
- delete d_typeNode;
+Type::Type() : d_typeNode(new TypeNode), d_nodeManager(NULL) {
+ // This does not require a NodeManagerScope as `new TypeNode` is backed by a
+ // static expr::NodeValue::null().
}
-Type::Type() :
- d_typeNode(new TypeNode),
- d_nodeManager(NULL) {
+Type::Type(const Type& t) : d_typeNode(NULL), d_nodeManager(t.d_nodeManager) {
+ NodeManagerScope nms(d_nodeManager);
+ d_typeNode = new TypeNode(*t.d_typeNode);
}
-Type::Type(const Type& t) :
- d_typeNode(new TypeNode(*t.d_typeNode)),
- d_nodeManager(t.d_nodeManager) {
+Type::~Type() {
+ NodeManagerScope nms(d_nodeManager);
+ delete d_typeNode;
}
bool Type::isNull() const {