| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 863bfc4 commit 578fa0f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2983,12 +2983,15 @@ ParserBase<Impl>::ParseCoalesceExpression(ExpressionT expression) { | |||
| 2983 | 2983 | bool first_nullish = true; | |
| 2984 | 2984 | while (peek() == Token::NULLISH) { | |
| 2985 | 2985 | SourceRange right_range; | |
| 2986 | - SourceRangeScope right_range_scope(scanner(), &right_range); | ||
| 2987 | - Consume(Token::NULLISH); | ||
| 2988 | - int pos = peek_position(); | ||
| 2989 | - | ||
| 2990 | - // Parse BitwiseOR or higher. | ||
| 2991 | - ExpressionT y = ParseBinaryExpression(6); | ||
| 2986 | + int pos; | ||
| 2987 | + ExpressionT y; | ||
| 2988 | + { | ||
| 2989 | + SourceRangeScope right_range_scope(scanner(), &right_range); | ||
| 2990 | + Consume(Token::NULLISH); | ||
| 2991 | + pos = peek_position(); | ||
| 2992 | + // Parse BitwiseOR or higher. | ||
| 2993 | + y = ParseBinaryExpression(6); | ||
| 2994 | + } | ||
| 2992 | 2995 | if (first_nullish) { | |
| 2993 | 2996 | expression = | |
| 2994 | 2997 | factory()->NewBinaryOperation(Token::NULLISH, expression, y, pos); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1177,4 +1177,22 @@ a(true); // 0500 | |||
| 1177 | 1177 | {"start":0,"end":401,"count":2}, | |
| 1178 | 1178 | {"start":154,"end":254,"count":0}]); | |
| 1179 | 1179 | ||
| 1180 | + TestCoverage( | ||
| 1181 | + "https://crbug.com/v8/11231 - nullish coalescing", | ||
| 1182 | + ` | ||
| 1183 | + const a = true // 0000 | ||
| 1184 | + const b = false // 0050 | ||
| 1185 | + const c = undefined // 0100 | ||
| 1186 | + const d = a ?? 99 // 0150 | ||
| 1187 | + const e = 33 // 0200 | ||
| 1188 | + const f = b ?? (c ?? 99) // 0250 | ||
| 1189 | + const g = 33 // 0300 | ||
| 1190 | + const h = c ?? (c ?? 'hello') // 0350 | ||
| 1191 | + const i = c ?? b ?? 'hello' // 0400 | ||
| 1192 | + `, | ||
| 1193 | + [{"start":0,"end":449,"count":1}, | ||
| 1194 | + {"start":162,"end":167,"count":0}, | ||
| 1195 | + {"start":262,"end":274,"count":0}, | ||
| 1196 | + {"start":417,"end":427,"count":0}]); | ||
| 1197 | + | ||
| 1180 | 1198 | %DebugToggleBlockCoverage(false); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments