From 17eeef6369433979688abbb7382c0db4a587d257 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Mon, 5 Jun 2023 19:40:18 +0200 Subject: [PATCH] Use separate instances of the stateless DocStringTagParser during analysis. --- libsolidity/interface/CompilerStack.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index e9bbc0aa5..dd160807b 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -475,10 +475,12 @@ bool CompilerStack::analyze() resolver.warnHomonymDeclarations(); - DocStringTagParser docStringTagParser(m_errorReporter); - for (Source const* source: m_sourceOrder) - if (source->ast && !docStringTagParser.parseDocStrings(*source->ast)) - noErrors = false; + { + DocStringTagParser docStringTagParser(m_errorReporter); + for (Source const* source: m_sourceOrder) + if (source->ast && !docStringTagParser.parseDocStrings(*source->ast)) + noErrors = false; + } // Requires DocStringTagParser for (Source const* source: m_sourceOrder) @@ -490,10 +492,13 @@ bool CompilerStack::analyze() if (source->ast && !declarationTypeChecker.check(*source->ast)) return false; - // Requires DeclarationTypeChecker to have run - for (Source const* source: m_sourceOrder) - if (source->ast && !docStringTagParser.validateDocStringsUsingTypes(*source->ast)) - noErrors = false; + { + // Requires DeclarationTypeChecker to have run + DocStringTagParser docStringTagParser(m_errorReporter); + for (Source const* source: m_sourceOrder) + if (source->ast && !docStringTagParser.validateDocStringsUsingTypes(*source->ast)) + noErrors = false; + } // Next, we check inheritance, overrides, function collisions and other things at // contract or function level.