From fe8f38a7a47241f4f910ef229e6655de7648c98b Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 9 May 2018 14:55:36 +0200 Subject: Assert integrity of empty IndexAccessPath structure. --- libsolidity/parsing/Parser.cpp | 10 ++++++++++ libsolidity/parsing/Parser.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'libsolidity') diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 38ef32d5..d1be13a5 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1098,6 +1098,16 @@ ASTPointer Parser::parseSimpleStatement(ASTPointer const& } } +bool Parser::IndexAccessedPath::empty() const +{ + if (!indices.empty()) + { + solAssert(!path.empty(), ""); + } + return path.empty() && indices.empty(); +} + + pair Parser::tryParseIndexAccessedPath() { // These two cases are very hard to distinguish: diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h index 902312e8..08653364 100644 --- a/libsolidity/parsing/Parser.h +++ b/libsolidity/parsing/Parser.h @@ -151,7 +151,7 @@ private: { std::vector> path; std::vector, SourceLocation>> indices; - bool empty() const { return path.empty() && indices.empty(); } + bool empty() const; }; std::pair tryParseIndexAccessedPath(); -- cgit