aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/CompilerStack.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-26 22:13:36 +0800
committerchriseth <c@ethdev.com>2015-10-26 22:24:36 +0800
commitb4f561680a2a5169d1245271245e2b71822cb73a (patch)
tree6e3acecc9bbe825400e4297a32ff641df27d1943 /libsolidity/interface/CompilerStack.cpp
parentd6e77ce0e1da577e5f2c000f89b4fba3505d84a0 (diff)
downloaddexon-solidity-b4f561680a2a5169d1245271245e2b71822cb73a.tar
dexon-solidity-b4f561680a2a5169d1245271245e2b71822cb73a.tar.gz
dexon-solidity-b4f561680a2a5169d1245271245e2b71822cb73a.tar.bz2
dexon-solidity-b4f561680a2a5169d1245271245e2b71822cb73a.tar.lz
dexon-solidity-b4f561680a2a5169d1245271245e2b71822cb73a.tar.xz
dexon-solidity-b4f561680a2a5169d1245271245e2b71822cb73a.tar.zst
dexon-solidity-b4f561680a2a5169d1245271245e2b71822cb73a.zip
Store docstrings in AST annotations.
Diffstat (limited to 'libsolidity/interface/CompilerStack.cpp')
-rw-r--r--libsolidity/interface/CompilerStack.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index 775c7eb6..6b55b408 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -28,6 +28,7 @@
#include <libsolidity/analysis/GlobalContext.h>
#include <libsolidity/analysis/NameAndTypeResolver.h>
#include <libsolidity/analysis/TypeChecker.h>
+#include <libsolidity/analysis/DocStringAnalyser.h>
#include <libsolidity/codegen/Compiler.h>
#include <libsolidity/interface/CompilerStack.h>
#include <libsolidity/interface/InterfaceHandler.h>
@@ -114,6 +115,12 @@ bool CompilerStack::parse()
resolveImports();
+ bool noErrors = true;
+ DocStringAnalyser docStringAnalyser(m_errors);
+ for (Source const* source: m_sourceOrder)
+ if (!docStringAnalyser.analyseDocStrings(*source->ast))
+ noErrors = false;
+
m_globalContext = make_shared<GlobalContext>();
NameAndTypeResolver resolver(m_globalContext->declarations(), m_errors);
for (Source const* source: m_sourceOrder)
@@ -131,8 +138,6 @@ bool CompilerStack::parse()
m_contracts[contract->name()].contract = contract;
}
- InterfaceHandler interfaceHandler;
- bool typesFine = true;
for (Source const* source: m_sourceOrder)
for (ASTPointer<ASTNode> const& node: source->ast->nodes())
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
@@ -142,15 +147,15 @@ bool CompilerStack::parse()
TypeChecker typeChecker(m_errors);
if (typeChecker.checkTypeRequirements(*contract))
{
- contract->setDevDocumentation(interfaceHandler.devDocumentation(*contract));
- contract->setUserDocumentation(interfaceHandler.userDocumentation(*contract));
+ contract->setDevDocumentation(InterfaceHandler::devDocumentation(*contract));
+ contract->setUserDocumentation(InterfaceHandler::userDocumentation(*contract));
}
else
- typesFine = false;
+ noErrors = false;
m_contracts[contract->name()].contract = contract;
}
- m_parseSuccessful = typesFine;
+ m_parseSuccessful = noErrors;
return m_parseSuccessful;
}
@@ -287,7 +292,7 @@ string const& CompilerStack::metadata(string const& _contractName, Documentation
// caches the result
if (!*doc)
- doc->reset(new string(currentContract.interfaceHandler->documentation(*currentContract.contract, _type)));
+ doc->reset(new string(InterfaceHandler::documentation(*currentContract.contract, _type)));
return *(*doc);
}
@@ -428,8 +433,5 @@ CompilerStack::Source const& CompilerStack::source(string const& _sourceName) co
return it->second;
}
-CompilerStack::Contract::Contract(): interfaceHandler(make_shared<InterfaceHandler>()) {}
-
-
}
}