aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerStack.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-18 21:39:16 +0800
committerChristian <c@ethdev.com>2014-12-18 21:39:16 +0800
commitf744c34ccc30e053eb61aecb5621f4e8060a8b0c (patch)
tree112a0d2a426501c10c3c6554e9dd9d176ff15935 /CompilerStack.h
parenta98afc8eaa20146359dd212fc2eb0bd0fe18d893 (diff)
downloaddexon-solidity-f744c34ccc30e053eb61aecb5621f4e8060a8b0c.tar.gz
dexon-solidity-f744c34ccc30e053eb61aecb5621f4e8060a8b0c.tar.zst
dexon-solidity-f744c34ccc30e053eb61aecb5621f4e8060a8b0c.zip
Possibility to replace source and obtain ContractDefinition by name.
Diffstat (limited to 'CompilerStack.h')
-rw-r--r--CompilerStack.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/CompilerStack.h b/CompilerStack.h
index 5ad6f0a6..358c8fb7 100644
--- a/CompilerStack.h
+++ b/CompilerStack.h
@@ -57,7 +57,8 @@ public:
CompilerStack(): m_parseSuccessful(false) {}
/// Adds a source object (e.g. file) to the parser. After this, parse has to be called again.
- void addSource(std::string const& _name, std::string const& _content);
+ /// @returns true if a source object by the name already existed and was replaced.
+ bool addSource(std::string const& _name, std::string const& _content);
void setSource(std::string const& _sourceCode);
/// Parses all source units that were added
void parse();
@@ -86,9 +87,13 @@ public:
/// Can be one of 3 types defined at @c DocumentationType
std::string const& getJsonDocumentation(std::string const& _contractName, DocumentationType _type) const;
- /// Returns the previously used scanner, useful for counting lines during error reporting.
+ /// @returns the previously used scanner, useful for counting lines during error reporting.
Scanner const& getScanner(std::string const& _sourceName = "") const;
+ /// @returns the parsed source unit with the supplied name.
SourceUnit const& getAST(std::string const& _sourceName = "") const;
+ /// @returns the parsed contract with the supplied name. Throws an exception if the contract
+ /// does not exist.
+ ContractDefinition const& getContractDefinition(std::string const& _contractName) const;
/// Compile the given @a _sourceCode to bytecode. If a scanner is provided, it is used for
/// scanning the source code - this is useful for printing exception information.