eshost fails inscrutably when the file starts with a string literal
Opened this issue · 0 comments
bakkot commented
Create a file tmp.js
containing 'a|b'.split('|').forEach(print)
, then run eshost tmp.js
(assuming the existence of eshost-cli
). On my machine, at least, this produces output along the lines of
#### Chakra
SyntaxError: Expected ';'
#### engine262
SyntaxError: Unexpected token
#### GraalJS
SyntaxError: f-1634278503297-82335-eko3b0.sec9l.js:1:5 Expected ; but found const
#### Hermes
SyntaxError: ';' expected
#### JavaScriptCore
SyntaxError: Unexpected keyword 'const'. Parse error.
#### SpiderMonkey
SyntaxError: unexpected token: keyword 'var':
#### V8
SyntaxError: Unexpected token 'var'
#### XS
SyntaxError: missing ;
Poking around some, it looks like the problem is that it's attempting to inject the header with a regex which matches ''
, i.e., it is trying to insert the header between the ''
and the .split
, which obviously isn't going to work.