Split DocStringParsing in two stages

one requiring type info in the next step
This commit is contained in:
Mathias Baumann
2021-06-07 14:49:46 +02:00
parent 1f8f1a3db9
commit aae9d347aa
4 changed files with 77 additions and 46 deletions
+11 -5
View File
@@ -416,11 +416,6 @@ bool CompilerStack::analyze()
if (source->ast && !syntaxChecker.checkSyntax(*source->ast))
noErrors = false;
DocStringTagParser docStringTagParser(m_errorReporter);
for (Source const* source: m_sourceOrder)
if (source->ast && !docStringTagParser.parseDocStrings(*source->ast))
noErrors = false;
m_globalContext = make_shared<GlobalContext>();
// We need to keep the same resolver during the whole process.
NameAndTypeResolver resolver(*m_globalContext, m_evmVersion, m_errorReporter);
@@ -437,6 +432,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;
// Requires DocStringTagParser
for (Source const* source: m_sourceOrder)
if (source->ast && !resolver.resolveNamesAndTypes(*source->ast))
return false;
@@ -446,6 +447,11 @@ 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;
// Next, we check inheritance, overrides, function collisions and other things at
// contract or function level.
// This also calculates whether a contract is abstract, which is needed by the