diff options
author | Morgan Deters <mdeters@gmail.com> | 2012-08-04 18:45:13 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2012-08-04 18:45:13 +0000 |
commit | 1467abb8bd69050c2518f87a1775590cd5a9882e (patch) | |
tree | 30c269deec8189fde2b8db2abd4bee9600ad8a2f /src/expr | |
parent | c956906a5dc4cb51b4676c3bba80159cbe76fdbc (diff) |
isConst() rule for datatypes
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/node.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/expr/node.h b/src/expr/node.h index cada443a1..b5186f2ed 100644 --- a/src/expr/node.h +++ b/src/expr/node.h @@ -1271,19 +1271,25 @@ template <bool ref_count> inline bool NodeTemplate<ref_count>::isConst() const { assertTNodeNotExpired(); + Debug("isConst") << "Node::isConst() for " << getKind() << " with " << getNumChildren() << " children" << std::endl; if(isNull()) { return false; } switch(getMetaKind()) { case kind::metakind::CONSTANT: + Debug("isConst") << "Node::isConst() returning true, it's a CONSTANT" << std::endl; return true; case kind::metakind::VARIABLE: + Debug("isConst") << "Node::isConst() returning false, it's a VARIABLE" << std::endl; return false; default: if(getAttribute(IsConstComputedAttr())) { - return getAttribute(IsConstAttr()); + bool bval = getAttribute(IsConstAttr()); + Debug("isConst") << "Node::isConst() returning cached value " << bval << std::endl; + return bval; } else { bool bval = expr::TypeChecker::computeIsConst(NodeManager::currentNM(), *this); + Debug("isConst") << "Node::isConst() computed value " << bval << std::endl; const_cast< NodeTemplate<ref_count>* >(this)->setAttribute(IsConstAttr(), bval); const_cast< NodeTemplate<ref_count>* >(this)->setAttribute(IsConstComputedAttr(), true); return bval; |