nodejs / repl

REPL rewrite for Node.js ✨🐢🚀✨
MIT License
177 stars 25 forks source link

Fixes block level multiline issue #20

Closed antsmartian closed 6 years ago

antsmartian commented 6 years ago

Hello @devsnek

Fixes the issue: https://github.com/nodejs/repl/issues/19

I guess it got introduced by this commit: https://github.com/nodejs/repl/commit/f4f203e23a57c7ccf8c0dee703a1e14c983e1480

Thanks.

devsnek commented 6 years ago

with that change now this happens

> {
... a
... }
...
...
...
...
antsmartian commented 6 years ago

@devsnek I guess that issue was there even before. With current node-repl I can replicate that (I tried running from the commit : https://github.com/nodejs/repl/commit/25c0630d4a2cc04e61f57244e1219e5a3aaff1ec). I knew, where the issue is, let me see if I can fix it.

antsmartian commented 6 years ago

@devsnek The root cause is that we have to call wrapObjectLiteralExpressionIfNeeded before passing the code to isRecoverable. I just played around with our cases (looks good to me):

image