Closed YuanWangC closed 4 years ago
ECMAScript disallows a FunctionDeclaration
as the body of a labeled statement here: https://www.ecma-international.org/ecma-262/10.0/index.html#sec-labelled-statements-static-semantics-early-errors
However, there is an Annex B note that goes back and disallows them only in strict mode: https://www.ecma-international.org/ecma-262/10.0/index.html#sec-labelled-function-declarations
The current implementation chooses not to support this particular part of Annex B. Note that the clause is only included for web browser compatibility. Hermes doesn't support certain parts of Annex B to simplify the code base, though we can certainly discuss these features on a case-by-case basis.
When I execute the testcase below, hermes throw an error:
Function declaration not allowed as body of labeled statement
, but other engines (v8, Chakra, spiderMonkey etc.) did not throw exceptions. Is this an issue of hermes?version
3826084
testcase
command
build_release/bin/hermes -w testcase.js
output
error: Function declaration not allowed as body of labeled statement