Closed Bug 778919 Opened 12 years ago Closed 12 years ago

remove CheckStrictParameters

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: luke, Assigned: luke)

References

Details

Attachments

(3 files)

CheckStrictParameters is kindof an oddball:
 - it iterates over all bindings (not just parameters, why this is ok takes some hand-waving)
 - it builds a hashset containing all formals, to look for duplicates (even though we already have tc->decls)
 - it checks for the bad names (eval, keywords), which we usually do when defining bindings and already do for destructuring formals

This weirdness gets in the way of bug 775323.

This trio of patches removes it by putting the relevant checks into DefineArg and BindDestructuringArg, making them more symetrics with the rest of the parser's handling of strict-mode checks.
Simple syntax movement + a comment.
Attachment #647286 - Flags: review?(ejpbruel)
Attachment #647287 - Flags: review?(ejpbruel)
Do the dup-checking at the one use site.  Strict mode makes this an error, so the bool to check whether we've already warned was useless.
Attachment #647289 - Flags: review?(ejpbruel)
Attachment #647286 - Flags: review+
Attachment #647286 - Flags: review?(ejpbruel)
Comment on attachment 647287 [details] [diff] [review]
do CheckStrictBindings like everywhere else

Review of attachment 647287 [details] [diff] [review]:
-----------------------------------------------------------------

I assume your comment that:
- it checks for the bad names (eval, keywords), which we usually do when defining bindings and already do for destructuring formals"

was wrong, because you had to add a call to CheckStrictBinding in BindDestructuringArg?

Other than that, looks to me like this patch does the right thing.
Attachment #647287 - Flags: review+
Attachment #647289 - Flags: review+
Attachment #647287 - Flags: review?(ejpbruel)
Attachment #647289 - Flags: review?(ejpbruel)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: