Changeset 192586 in webkit for trunk/Source/JavaScriptCore/ChangeLog
- Timestamp:
- Nov 18, 2015, 2:01:19 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r192561 r192586 1 2015-11-18 Saam barati <[email protected]> 2 3 There is a bug when default parameter values are mixed with destructuring parameter values 4 https://bugs.webkit.org/show_bug.cgi?id=151369 5 6 Reviewed by Geoffrey Garen and Mark Lam. 7 8 This patch changes our parser to no longer declare destructuring 9 parameters as "var"s. This is a weird bug that just happened 10 to work in a world without default parameter values. In a world with 11 default parameter values this is just completely wrong. It would 12 incorrectly transform this program: 13 ```function foo(a = function() { b = 40; }, {b}) { a(); return b; }; foo(undefined, {b: 42}); // Should return 40``` 14 into 15 ```function foo(a = function() { b = 40; }, {b}) { var b; a(); return b; }; foo(undefined, {b:42}); // Returns 42, not 40.``` 16 Which is wrong because we end up with two distinct bindings of "b" when 17 there should only be one. 18 19 * parser/Parser.cpp: 20 (JSC::Parser<LexerType>::parseVariableDeclarationList): 21 (JSC::Parser<LexerType>::createBindingPattern): 22 (JSC::Parser<LexerType>::parseDestructuringPattern): 23 * parser/Parser.h: 24 (JSC::Scope::declareParameter): 25 (JSC::Scope::getUsedVariables): 26 (JSC::Parser::strictMode): 27 (JSC::Parser::isValidStrictMode): 28 (JSC::Parser::declareParameter): 29 (JSC::Parser::breakIsValid): 30 (JSC::Scope::declareBoundParameter): Deleted. 31 (JSC::Parser::declareBoundParameter): Deleted. 32 * tests/stress/es6-default-parameters.js: 33 1 34 2015-11-17 Benjamin Poulain <[email protected]> 2 35
Note:
See TracChangeset
for help on using the changeset viewer.