Closed Bug 1317374 Opened 3 years ago Closed 3 years ago

Annex B.3.3.1 should not be applied when a parameter with the same name is present

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: anba, Assigned: shu)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Test case:
---
(function(f) {
  if (true) function f() {  }
  assertEq(f, 123);
}(123));
---

Expected: Passes
Actual: Throws "Error: Assertion failed: got function f() {  }, expected 123"


ES2017 spec:

The second condition in B.3.3.1, step 1.a.ii doesn't seem to be checked in SpiderMonkey:
---
If replacing the FunctionDeclaration f with a VariableStatement that has F as a BindingIdentifier would not produce any Early Errors for func
and
F is not an element of parameterNames, then [...]
---

https://tc39.github.io/ecma262/#sec-web-compat-functiondeclarationinstantiation
Flags: needinfo?(shu)
Flags: needinfo?(shu)
Attachment #8818123 - Flags: review?(jwalden+bmo) → review+
Pushed by shu@rfrn.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4dc794806128
Don't do Annex B lexical function behavior when redeclaring a parameter name. (r=Waldo)
Pushed by shu@rfrn.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4f4bae3e495a
Don't do Annex B lexical function behavior when redeclaring a parameter name. (r=Waldo)
Flags: needinfo?(shu)
https://hg.mozilla.org/mozilla-central/rev/4f4bae3e495a
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Assignee: nobody → shu
You need to log in before you can comment on or make changes to this bug.