Internals: Introduce Ast{class}::Super and cleanup. No functional change intended (but possible if was wrong base used earlier)

This commit is contained in:
Wilson Snyder
2026-09-05 10:45:39 -04:00
parent 3493e409b8
commit 35c1a244a8
3 changed files with 197 additions and 195 deletions
+2 -2
View File
@@ -2671,7 +2671,7 @@ public:
const string& fsmTag() const { return m_fsmTag; }
bool sameNode(const AstNode* samep) const override {
const AstCoverOtherDecl* const asamep = VN_DBG_AS(samep, CoverOtherDecl);
return AstNodeCoverDecl::sameNode(samep) && linescov() == asamep->linescov();
return Super::sameNode(samep) && linescov() == asamep->linescov();
}
};
class AstCoverToggleDecl final : public AstNodeCoverDecl {
@@ -2693,7 +2693,7 @@ public:
const VNumRange& range() const { return m_range; }
bool sameNode(const AstNode* samep) const override {
const AstCoverToggleDecl* const asamep = VN_DBG_AS(samep, CoverToggleDecl);
return AstNodeCoverDecl::sameNode(samep) && range() == asamep->range();
return Super::sameNode(samep) && range() == asamep->range();
}
};
+192 -192
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -1096,6 +1096,7 @@ def write_ast_macros(filename):
# kind=ptr['kind'])
emitBlock('''\
using Super = Ast{s};
Ast{t}* unlinkFrBack(VNRelinker* linkerp = nullptr) {{
return static_cast<Ast{t}*>(AstNode::unlinkFrBack(linkerp));
}}
@@ -1116,7 +1117,8 @@ def write_ast_macros(filename):
void dumpTreeJsonOpGen(std::ostream& str, const string& indent) const override;
void dumpJsonGen(std::ostream& str) const;
''',
t=node.name)
t=node.name,
s=(node.superClass.name if node.superClass else 'AstNode'))
if node.ptrs:
emitBlock('''\
void cloneRelinkGen() override;