BUG Description
In non-strict mode, yield is not a reserved word and can legally be used as an identifier (such as a variable name). Therefore, using yield in a destructuring assignment should be valid according to the ECMAScript specification. However, Duktape throws a syntax error, which suggests this may be a bug in its parser or compliance logic.
Version
Duktape 2.7.0
Command
/home/engines/duktape/duktape-2.7.0/duk
Testcase
Actual Behavior
SyntaxError: invalid variable declaration
Expected Behavior
Specification Reference
According to the ECMAScript 5.1 specification, Section 7.6.1.2 – Future Reserved Words, the identifier yield is considered a future reserved word only when parsing strict mode code. The specification states:
The following are future reserved words when parsing strict mode code:
implements, interface, let, package, private, protected, public, static, and yield.
Implication
This means that in non-strict mode, yield is not a reserved word, and it is valid to use it as an identifier (e.g., a variable name or object property).
https://262.ecma-international.org/5.1/#sec-7.6.1.2
BUG Description
In non-strict mode,
yieldis not a reserved word and can legally be used as an identifier (such as a variable name). Therefore, usingyieldin a destructuring assignment should be valid according to the ECMAScript specification. However, Duktape throws a syntax error, which suggests this may be a bug in its parser or compliance logic.Version
Duktape 2.7.0
Command
Testcase
Actual Behavior
Expected Behavior
Specification Reference
According to the ECMAScript 5.1 specification, Section 7.6.1.2 – Future Reserved Words, the identifier
yieldis considered a future reserved word only when parsing strict mode code. The specification states:Implication
This means that in non-strict mode,
yieldis not a reserved word, and it is valid to use it as an identifier (e.g., a variable name or object property).https://262.ecma-international.org/5.1/#sec-7.6.1.2