Open Bug 1339123 Opened 9 years ago Updated 1 year ago

Hoisted block-level function named "arguments" not initialized with undefined per B.3.3.1

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

Tracking Status
firefox54 --- affected

People

(Reporter: anba, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: triage-deferred)

Attachments

(1 obsolete file)

Test case: --- (function(a = (print(arguments))) { print(arguments); { function arguments() {} } print(arguments); })(); --- Expected output: [object Arguments] undefined function arguments() {} Actual output: [object Arguments] [object Arguments] function arguments() {} Spec https://tc39.github.io/ecma262/#sec-web-compat-functiondeclarationinstantiation initializes the block functions which apply for B.3.3.1 with |undefined| in step 1.a.ii.2 if their names aren't included in the |instantiatedVarNames| list.
Recapping some IRC conversation below. Per current spec text of Annex B that uses |parameterList| to test if Annex B behavior should apply, when a function has |argumentsObjectNeede = true|, Annex B behavior would *not* apply to functions named "arguments". However, Waldo says this was an unintended normative change from his editorial PR https://github.com/tc39/ecma262/pull/677 I'll go ahead and fix it according to the ES2015 behavior (anba's test case above). Waldo, could you file an upstream PR?
Flags: needinfo?(jwalden+bmo)
Turns out our in-tree test was wrong. The bug is that if parameter exprs needed the arguments object and didn't have a formal named 'parameter', we weren't treating var bindings of 'arguments' like regular var bindings.
Attachment #8836916 - Flags: review?(jwalden+bmo)
Comment on attachment 8836916 [details] [diff] [review] Fix 'arguments' handling in parameter expressions when there is also a var binding of 'arguments'. I'm not sure what the intended semantics are anymore. Retracting patch.
Attachment #8836916 - Attachment is obsolete: true
Flags: needinfo?(jwalden+bmo)
Attachment #8836916 - Flags: review?(jwalden+bmo)
On test262: test/annexB/language/function-code/block-decl-func-skip-arguments.js
Keywords: triage-deferred
Priority: -- → P3
Severity: normal → S3

See https://github.com/tc39/ecma262/issues/991 as well (this probably should be fixed in spec is my reading)

Blocks: test262
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: