meriyah: Meriyah does not properly follow ECMA standards on function declaration and calling.
When experimenting with Meriyah, I discovered the parser properly registers the following invalid function declarations and calls:
function 10() {
return 10;
}
10();
function "string"() {
return "string"();
}
"string"();
Meriyah also struggles when calling functions. It will assume that the name of the function being called is an identifier, and not a literal.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (15 by maintainers)
Commits related to this issue
- fix(parser): fix missing rejection on function name closes #182 — committed to meriyah/meriyah by 3cp 3 years ago
NVM, my mistake,
[]()
and({}())
is runtime error too 😃Other parsers like acorn and TS do not reject them.
My lord
"a"()
is runtime error too.This parses with no issue in browser or nodejs.
@KFlash I guess we don’t change the rejections of CallExpression at all?
@KFlash some interesting finding. In real JS parser (nodejs),
null(), true(), false()
are not parser error, but runtime error.I guess we don’t need to reject the 3 in parsing.