Skip to content

Commit 4a47cf5

Browse files
committed
Do not crash when parsing property hook default values
1 parent 8799999 commit 4a47cf5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Parser.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,6 +2316,7 @@ private function parseBinaryExpressionOrHigher($precedence, $parentNode) {
23162316
// the original operator, and the newly constructed exponentiation-expression as the operand.
23172317
$shouldOperatorTakePrecedenceOverUnary = false;
23182318
switch ($token->kind) {
2319+
case TokenKind::OpenBraceToken:
23192320
case TokenKind::AsteriskAsteriskToken:
23202321
$shouldOperatorTakePrecedenceOverUnary = $leftOperand instanceof UnaryExpression;
23212322
break;
@@ -3187,6 +3188,11 @@ private function parsePostfixExpressionRest($expression, $allowUpdateExpression
31873188
)) {
31883189
return $expression;
31893190
}
3191+
3192+
// property hooks ...
3193+
if ($tokenKind === TokenKind::OpenBraceToken) {
3194+
return $expression;
3195+
}
31903196
if ($tokenKind === TokenKind::ColonColonToken) {
31913197
$expression = $this->parseScopedPropertyAccessExpression($expression, null);
31923198
return $this->parsePostfixExpressionRest($expression);

0 commit comments

Comments
 (0)