Merge pull request #10019 from ethereum/exp-associativity

[BREAKING] Exp associativity
This commit is contained in:
chriseth
2020-10-13 17:03:18 +02:00
committed by GitHub
7 changed files with 101 additions and 40 deletions
+7 -1
View File
@@ -1614,7 +1614,13 @@ ASTPointer<Expression> Parser::parseBinaryExpression(
{
Token op = m_scanner->currentToken();
m_scanner->next();
ASTPointer<Expression> right = parseBinaryExpression(precedence + 1);
static_assert(TokenTraits::hasExpHighestPrecedence(), "Exp does not have the highest precedence");
// Parse a**b**c as a**(b**c)
ASTPointer<Expression> right = (op == Token::Exp) ?
parseBinaryExpression(precedence) :
parseBinaryExpression(precedence + 1);
nodeFactory.setEndPositionFromNode(right);
expression = nodeFactory.createNode<BinaryOperation>(expression, op, right);
}