ChakraCore currently allows lexical declarations (let, const, class, function*) to appear after a label. Labels can only prepend a Statement, not a Declaration, according to the ES spec.
See grammar at https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations
FunctionDeclaration gets an exception and is allowed, presumably for back-compat. GeneratorDeclaration does not get the exception, however, and so it not allow. See LabelledItem
Async functions presumably will also be disallowed by way of being a HoistableDeclaration and not excepted by LabelledItem.
E.g. each of these lines should be a syntax error but are not currently:
a: let x;
b: const y = 0;
c: class z { }
d: function* w() { }
e: async function u() { } // pending finalization of async function spec
ChakraCore currently allows lexical declarations (let, const, class, function*) to appear after a label. Labels can only prepend a Statement, not a Declaration, according to the ES spec.
See grammar at https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations
FunctionDeclaration gets an exception and is allowed, presumably for back-compat. GeneratorDeclaration does not get the exception, however, and so it not allow. See LabelledItem
Async functions presumably will also be disallowed by way of being a HoistableDeclaration and not excepted by LabelledItem.
E.g. each of these lines should be a syntax error but are not currently: