Closed Bug 1618526 Opened 5 years ago Closed 5 years ago

searchInEnclosingScope() doesn't need to check for declared parameters in non-simple parameter lists

Categories

(Core :: JavaScript Engine, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

Duplicate parameters are only allowed for non-strict function with simple parameter lists. Furthermore the function must neither be an arrow nor a method function. A parameter list is non-simple if one of the following applies:

  • It contains parameter default expressions.
  • It contains destructuring parameters.
  • It contains rest arguments.

EmitterScope::searchInEnclosingScope() is currently searching for duplicate parameters in non-strict without default parameters (!script->strict() && !script->functionHasParameterExprs()), but unless I'm misinterpreting this code, we should also be able to skip the duplicate parameter check when destructuring or rest parameters are present. (Or when the function is an arrow or method function, except we don't have a script flag at hand to determine the function kind.)

Priority: -- → P1
Pushed by cbrindusan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f3fdc0edd2c4 Don't check for duplicate parameters when duplicates aren't allowed in the function context. r=jandem
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: