tc39 / eshost

A uniform wrapper around a multitude of ECMAScript hosts. CLI: https://github.com/bterlson/eshost-cli
Other
142 stars 36 forks source link

Fix invalid d8 runtime #56

Closed kfarnung closed 6 years ago

kfarnung commented 6 years ago

The combination of #50 and #51 has resulted in the d8 runtime being invalid because the single-line comments remove all following code when newlines are removed.

The fix is to always build the AST and remove comments, regardless of whether the shortName is being replaced.

kfarnung commented 6 years ago

Here's what I'm seeing with the latest NPM version:

> eshost -tse "3+4"
┌────────────────┬──────────────────────────────────────┐
│ V8             │                                      │
│ V8 --harmony   │ SyntaxError: Unexpected end of input │
├────────────────┼──────────────────────────────────────┤
│ Chakra         │ 7                                    │
│ JavaScriptCore │                                      │
│ SpiderMonkey   │                                      │
│ XS             │                                      │
└────────────────┴──────────────────────────────────────┘
kfarnung commented 6 years ago

With this fix:

> node .\bin\eshost.js -tse "3+4"
┌────────────────┬───┐
│ Chakra         │ 7 │
│ JavaScriptCore │   │
│ SpiderMonkey   │   │
│ V8             │   │
│ V8 --harmony   │   │
│ XS             │   │
└────────────────┴───┘
rwaldron commented 6 years ago

Squash merged: https://github.com/bterlson/eshost/commit/a0f16713b903292f966fcfd579b15cdc955b0429

Thanks!