Commit 4271732
repl: support standalone blocks
Enable support for standalone block statements.
```js
node 🙈 ₹ git:(upstream ⚡ bare-block) ./node
> { var x = 3; console.log(x); }
3
undefined
> {}
{}
> { x:1, y:"why not", z: function() {} }
{ x: 1, y: 'why not', z: [Function] }
>
```
For the ambiguous inputs like `{ x }`, the existing REPL
behaviour (ES6 literal shorthand) is preserved (prefers
expression over statement).
Fixes: #5576
PR-URL: #5581
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>1 parent 0d0c57f commit 4271732Copy full SHA for 4271732
File tree
Expand file treeCollapse file tree
2 files changed
+19
-6
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+19
-6
lines changedOpen diff view settings
Collapse file
+17-6Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
220 | 220 | |
221 | 221 | |
222 | 222 | |
223 | | - |
| 223 | + |
224 | 224 | |
225 | 225 | |
226 | 226 | |
| ||
238 | 238 | |
239 | 239 | |
240 | 240 | |
241 | | - |
242 | | - |
| 241 | + |
| 242 | + |
| 243 | + |
| 244 | + |
| 245 | + |
| 246 | + |
| 247 | + |
| 248 | + |
| 249 | + |
243 | 250 | |
244 | 251 | |
245 | | - |
246 | | - |
| 252 | + |
| 253 | + |
| 254 | + |
| 255 | + |
247 | 256 | |
248 | | - |
| 257 | + |
249 | 258 | |
250 | 259 | |
251 | 260 | |
| ||
418 | 427 | |
419 | 428 | |
420 | 429 | |
| 430 | + |
421 | 431 | |
422 | 432 | |
423 | 433 | |
| ||
435 | 445 | |
436 | 446 | |
437 | 447 | |
| 448 | + |
438 | 449 | |
439 | 450 | |
440 | 451 | |
|
Collapse file
+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
323 | 323 | |
324 | 324 | |
325 | 325 | |
| 326 | + |
| 327 | + |
326 | 328 | |
327 | 329 | |
328 | 330 | |
|
0 commit comments