diff options
author | Christian <c@ethdev.com> | 2014-12-05 22:35:05 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-12-05 22:35:05 +0800 |
commit | 25273778dccd65e78a196f7f999b5ea792e414e5 (patch) | |
tree | a700974b119890b16c42c10c85e7feb5a4a19383 | |
parent | d4a958e1fe96174f8fab09b5360106895c40e09a (diff) | |
download | dexon-solidity-25273778dccd65e78a196f7f999b5ea792e414e5.tar dexon-solidity-25273778dccd65e78a196f7f999b5ea792e414e5.tar.gz dexon-solidity-25273778dccd65e78a196f7f999b5ea792e414e5.tar.bz2 dexon-solidity-25273778dccd65e78a196f7f999b5ea792e414e5.tar.lz dexon-solidity-25273778dccd65e78a196f7f999b5ea792e414e5.tar.xz dexon-solidity-25273778dccd65e78a196f7f999b5ea792e414e5.tar.zst dexon-solidity-25273778dccd65e78a196f7f999b5ea792e414e5.zip |
Renamed url to identifier and added some comments.
-rw-r--r-- | AST.h | 10 | ||||
-rw-r--r-- | ASTPrinter.cpp | 2 | ||||
-rw-r--r-- | CompilerStack.cpp | 6 | ||||
-rw-r--r-- | CompilerStack.h | 2 | ||||
-rw-r--r-- | NameAndTypeResolver.cpp | 1 |
5 files changed, 12 insertions, 9 deletions
@@ -98,19 +98,21 @@ private: /** * Import directive for referencing other files / source objects. + * Example: import "abc.sol" + * Source objects are identified by a string which can be a file name but does not have to be. */ class ImportDirective: public ASTNode { public: - ImportDirective(Location const& _location, ASTPointer<ASTString> const& _url): - ASTNode(_location), m_url(_url) {} + ImportDirective(Location const& _location, ASTPointer<ASTString> const& _identifier): + ASTNode(_location), m_identifier(_identifier) {} virtual void accept(ASTVisitor& _visitor) override; - ASTString const& getURL() const { return *m_url; } + ASTString const& getIdentifier() const { return *m_identifier; } private: - ASTPointer<ASTString> m_url; + ASTPointer<ASTString> m_identifier; }; /** diff --git a/ASTPrinter.cpp b/ASTPrinter.cpp index c62378fd..3d09fd9a 100644 --- a/ASTPrinter.cpp +++ b/ASTPrinter.cpp @@ -45,7 +45,7 @@ void ASTPrinter::print(ostream& _stream) bool ASTPrinter::visit(ImportDirective& _node) { - writeLine("ImportDirective \"" + _node.getURL() + "\""); + writeLine("ImportDirective \"" + _node.getIdentifier() + "\""); printSourcePart(_node); return goDeeper(); } diff --git a/CompilerStack.cpp b/CompilerStack.cpp index 62172384..20b0b3e5 100644 --- a/CompilerStack.cpp +++ b/CompilerStack.cpp @@ -201,12 +201,12 @@ void CompilerStack::resolveImports() for (ASTPointer<ASTNode> const& node: _source->ast->getNodes()) if (ImportDirective const* import = dynamic_cast<ImportDirective*>(node.get())) { - string const& url = import->getURL(); - if (!m_sources.count(url)) + string const& id = import->getIdentifier(); + if (!m_sources.count(id)) BOOST_THROW_EXCEPTION(ParserError() << errinfo_sourceLocation(import->getLocation()) << errinfo_comment("Source not found.")); - toposort(&m_sources[url]); + toposort(&m_sources[id]); } sourceOrder.push_back(_source); }; diff --git a/CompilerStack.h b/CompilerStack.h index 34178841..bedb4cc3 100644 --- a/CompilerStack.h +++ b/CompilerStack.h @@ -66,7 +66,7 @@ public: /// Returns a list of the contract names in the sources. std::vector<std::string> getContractNames(); - /// Compiles the source units that were prevously added and parsed. + /// Compiles the source units that were previously added and parsed. void compile(bool _optimize = false); /// Parses and compiles the given source code. /// @returns the compiled bytecode diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp index 08deb66a..3715df6a 100644 --- a/NameAndTypeResolver.cpp +++ b/NameAndTypeResolver.cpp @@ -40,6 +40,7 @@ NameAndTypeResolver::NameAndTypeResolver(std::vector<Declaration*> const& _globa void NameAndTypeResolver::registerDeclarations(SourceUnit& _sourceUnit) { + // The helper registers all declarations in m_scopes as a side-effect of its construction. DeclarationRegistrationHelper registrar(m_scopes, _sourceUnit); } |