WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 158575
ES5: Reusing function name as a parameter name shouldn't throw Syntax Error
https://bugs.webkit.org/show_bug.cgi?id=158575
Summary
ES5: Reusing function name as a parameter name shouldn't throw Syntax Error
Michael Saboff
Reported
2016-06-09 13:09:03 PDT
According to the ES6 spec, <
http://www.ecma-international.org/ecma-262/6.0/#sec-function-definitions-static-semantics-early-errors
>, reusing the function name of a function as a parameter name should not throw a Syntax Error. This is was pointed out on the es-discuss mailing list <
https://esdiscuss.org/topic/can-strict-parameters-shadow-strict-function-names
>, specifically how we differ from V8 and SpiderMonkey.
Attachments
Patch
(4.33 KB, patch)
2016-06-09 15:36 PDT
,
Michael Saboff
benjamin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Michael Saboff
Comment 1
2016-06-09 15:36:59 PDT
Created
attachment 280959
[details]
Patch
Radar WebKit Bug Importer
Comment 2
2016-06-09 15:37:58 PDT
<
rdar://problem/26729710
>
Saam Barati
Comment 3
2016-06-09 15:39:25 PDT
Comment on
attachment 280959
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=280959&action=review
r=me with comments
> Source/JavaScriptCore/parser/Parser.h:483 > + bool isValidStrictMode = (addResult.isNewEntry || !addResult.iterator->value.isParameter()) > + && m_vm->propertyNames->eval != *ident && !isArgumentsIdent;
Style: one line
> LayoutTests/js/script-tests/basic-strict-mode.js:89 > +shouldBe("(function a(a){'use strict'; return a+2; })(40)", "42"); > +shouldBe("var foo = function a(a){'use strict'; return a+2; }; foo(40)", "42");
Can you also add tests for method style syntax?
Mark Lam
Comment 4
2016-06-09 15:40:05 PDT
Comment on
attachment 280959
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=280959&action=review
> Source/JavaScriptCore/ChangeLog:10 > + The check for a parameter with a duplicate name doesn't take into account the > + type of the prior variable. Added a check that the duplicate is also a > + parameter.
Can you add the URL to the spec as a ref here?
Michael Saboff
Comment 5
2016-06-09 16:03:49 PDT
(In reply to
comment #3
)
> Comment on
attachment 280959
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=280959&action=review
> > r=me with comments > > > Source/JavaScriptCore/parser/Parser.h:483 > > + bool isValidStrictMode = (addResult.isNewEntry || !addResult.iterator->value.isParameter()) > > + && m_vm->propertyNames->eval != *ident && !isArgumentsIdent; > > Style: one line
Our style guide doesn't talk about whether or not we should break long line. I believe this is more readable. The breaking is in line with the style guide.
> > LayoutTests/js/script-tests/basic-strict-mode.js:89 > > +shouldBe("(function a(a){'use strict'; return a+2; })(40)", "42"); > > +shouldBe("var foo = function a(a){'use strict'; return a+2; }; foo(40)", "42"); > > Can you also add tests for method style syntax?
Done.
Michael Saboff
Comment 6
2016-06-09 16:04:05 PDT
(In reply to
comment #4
)
> Comment on
attachment 280959
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=280959&action=review
> > > Source/JavaScriptCore/ChangeLog:10 > > + The check for a parameter with a duplicate name doesn't take into account the > > + type of the prior variable. Added a check that the duplicate is also a > > + parameter. > > Can you add the URL to the spec as a ref here?
Done.
Michael Saboff
Comment 7
2016-06-09 16:29:08 PDT
Committed
r201892
: <
http://trac.webkit.org/changeset/201892
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug