33#include < slang/ast/ASTVisitor.h>
44#include < unordered_map>
55
6- class FunctionArgMapper : public ASTVisitor <FunctionArgMapper, true , true , true > {
6+ class FunctionArgMapper final : public ASTVisitor<FunctionArgMapper, true , true , true > {
77 // Builds vector that maps the argument in definition to all calls
88 public:
99 std::vector<SetRemover::RemovalSet> removals;
@@ -135,11 +135,10 @@ SetRemover makeFunctionArgRemover(std::shared_ptr<SyntaxTree> tree) {
135135 return SetRemover (std::move (mapper.removals ));
136136}
137137
138- class PortMapper : public ASTVisitor <PortMapper, true , true , true > {
138+ class PortMapper final : public ASTVisitor<PortMapper, true , true , true > {
139139 // Builds vector that maps the definitions and usages of ports
140140 public:
141141 class FindConnectionSyntax : public SyntaxVisitor <FindConnectionSyntax> {
142- public:
143142 // PortConnection symbol does not have getSyntax() or sourceRange() methods.
144143 // This visitor finds sourceRange by locating PortConnectionSyntax that contains the same
145144 // expression as symbol
@@ -150,6 +149,8 @@ class PortMapper : public ASTVisitor<PortMapper, true, true, true> {
150149 } state;
151150
152151 SourceRange exprLoc;
152+
153+ public:
153154 SourceRange connLoc;
154155 FindConnectionSyntax (const PortConnection* symbol)
155156 : connLoc(SourceRange::NoLocation), state(WAIT_FOR_EXPR) {
@@ -227,7 +228,7 @@ SetRemover makePortsRemover(std::shared_ptr<SyntaxTree> tree) {
227228 return SetRemover (std::move (mapper.removals ));
228229}
229230
230- class ExternMapper : public ASTVisitor <ExternMapper, true , true , true > {
231+ class ExternMapper final : public ASTVisitor<ExternMapper, true , true , true > {
231232 // Builds vector that maps the declarations (prototypes) and definitions (implementations) of
232233 // extern methods
233234 public:
@@ -245,11 +246,8 @@ class ExternMapper : public ASTVisitor<ExternMapper, true, true, true> {
245246 void handle (const MethodPrototypeSymbol& proto) {
246247 SourceRange protoLocation = SourceRange::NoLocation;
247248 SourceRange implLocation = SourceRange::NoLocation;
248- if (proto.getSyntax ()) {
249- protoLocation = proto.getSyntax ()->sourceRange ();
250- } else {
251- exit (1 );
252- }
249+ ASSERT (proto.getSyntax (), " MethodPrototypeSymbol should have syntax node" );
250+ protoLocation = proto.getSyntax ()->sourceRange ();
253251
254252 auto impl = proto.getSubroutine ();
255253 if (impl && impl->getSyntax ()) {
@@ -272,7 +270,7 @@ SetRemover makeExternRemover(std::shared_ptr<SyntaxTree> tree) {
272270 return SetRemover (std::move (mapper.removals ));
273271}
274272
275- class StructFieldMapper : public ASTVisitor <StructFieldMapper, true , true , true > {
273+ class StructFieldMapper final : public ASTVisitor<StructFieldMapper, true , true , true > {
276274 // Builds vector that maps the definitions and initializations of struct fields
277275 public:
278276 std::vector<SetRemover::RemovalSet> removals;
0 commit comments