diff options
author | chriseth <chris@ethereum.org> | 2016-10-11 22:29:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-11 22:29:32 +0800 |
commit | 821fe6e916deb096009b54f4a228b7a8a596933a (patch) | |
tree | cb3d66644a2876239570bf6e68cab0e81385ff9d /libsolidity | |
parent | aa18a6bd2b91a94edf44f36d8f48c4c3f1e16ec9 (diff) | |
parent | ab1f4632aaa8017f80c371eded76497832719404 (diff) | |
download | dexon-solidity-821fe6e916deb096009b54f4a228b7a8a596933a.tar.gz dexon-solidity-821fe6e916deb096009b54f4a228b7a8a596933a.tar.zst dexon-solidity-821fe6e916deb096009b54f4a228b7a8a596933a.zip |
Merge pull request #1181 from ethereum/formal_ignore_pragma
formal: ignore pragmas during Why3 code generation
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/formal/Why3Translator.cpp | 14 | ||||
-rw-r--r-- | libsolidity/formal/Why3Translator.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/libsolidity/formal/Why3Translator.cpp b/libsolidity/formal/Why3Translator.cpp index f3831b40..813fa3ab 100644 --- a/libsolidity/formal/Why3Translator.cpp +++ b/libsolidity/formal/Why3Translator.cpp @@ -757,6 +757,20 @@ bool Why3Translator::visit(Literal const& _literal) return false; } +bool Why3Translator::visit(PragmaDirective const& _pragma) +{ + if (_pragma.tokens().empty()) + error(_pragma, "Not supported"); + else if (_pragma.literals().empty()) + error(_pragma, "Not supported"); + else if (_pragma.literals()[0] != "solidity") + error(_pragma, "Not supported"); + else if (_pragma.tokens()[0] != Token::Identifier) + error(_pragma, "A literal 'solidity' is not an identifier. Strange"); + + return false; +} + bool Why3Translator::isStateVariable(VariableDeclaration const* _var) const { return contains(m_currentContract.stateVariables, _var); diff --git a/libsolidity/formal/Why3Translator.h b/libsolidity/formal/Why3Translator.h index 22bfff89..4fdac385 100644 --- a/libsolidity/formal/Why3Translator.h +++ b/libsolidity/formal/Why3Translator.h @@ -94,6 +94,7 @@ private: virtual bool visit(IndexAccess const& _node) override; virtual bool visit(Identifier const& _node) override; virtual bool visit(Literal const& _node) override; + virtual bool visit(PragmaDirective const& _node) override; virtual bool visitNode(ASTNode const& _node) override { |