From aebce8a1d5aa8bf06719341432f487acd347d297 Mon Sep 17 00:00:00 2001 From: RJ Catalano Date: Tue, 15 Dec 2015 12:22:52 -0600 Subject: [PATCH] now is compiling and passing soltest...but I think there may be a few more things to do --- libsolidity/ast/AST.h | 4 +++- libsolidity/parsing/Parser.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 372f78a28..964c83fae 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -1150,10 +1150,12 @@ public: virtual void accept(ASTConstVisitor& _visitor) const override; std::vector> const& components() const { return m_components; } + bool isInlineArray() const { return m_isArray; } private: std::vector> m_components; - bool isInlineArray() const { return m_isArray; } + bool m_isArray; + }; /** diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 149948f7f..cb5968e9e 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1037,11 +1037,13 @@ ASTPointer Parser::parsePrimaryExpression() case Token::LParen: case Token::LBrack: { - // Tuple or parenthesized expression. - // Special cases: () is empty tuple type, (x) is not a real tuple, (x,) is one-dimensional tuple + // Tuple/parenthesized expression or inline array/bracketed expression. + // Special cases: ()/[] is empty tuple/array type, (x)/[] is not a real tuple/array, + // (x,) is one-dimensional tuple m_scanner->next(); vector> components; - Token::Value oppositeToken = (token == LParen ? Token::RParen : Token::RBrack); + Token::Value oppositeToken = (token == Token::LParen ? Token::RParen : Token::RBrack); + bool isArray = (token == Token::LParen ? false : true); if (m_scanner->currentToken() != Token::RParen) while (true) @@ -1057,7 +1059,7 @@ ASTPointer Parser::parsePrimaryExpression() } nodeFactory.markEndPosition(); expectToken(oppositeToken); - return nodeFactory.createNode(components); + return nodeFactory.createNode(components, isArray); } default: