Fix a number of problems with destructuring of arguments
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Oct 2013 21:31:36 +0000 (21:31 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Oct 2013 21:31:36 +0000 (21:31 +0000)
commit511b6972e75f86617b94651c13598dd54a953642
treecf37b53468ebd22f98fcf16cfb63ef5c849ff511
parenta7a3bbf32c7dd3351dac6e65119bf5fa7f6d36dc
Fix a number of problems with destructuring of arguments
https://bugs.webkit.org/show_bug.cgi?id=123357

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This renames the destructuring node's emitBytecode to bindValue
in order to remove the existing confusion over what was happening.

We then fix an incorrect fall through in the destructuring arguments
logic, and fix the then exposed bug where we placed the index rather
than value into the bound property.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* bytecompiler/NodesCodegen.cpp:
(JSC::ForInNode::emitBytecode):
(JSC::ForOfNode::emitBytecode):
(JSC::DeconstructingAssignmentNode::emitBytecode):
(JSC::ArrayPatternNode::bindValue):
(JSC::ArrayPatternNode::emitDirectBinding):
(JSC::ObjectPatternNode::bindValue):
(JSC::BindingNode::bindValue):
* parser/Nodes.h:

LayoutTests:

Add additional testing

* js/destructuring-assignment-expected.txt:
* js/script-tests/destructuring-assignment.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158051 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/js/destructuring-assignment-expected.txt
LayoutTests/js/script-tests/destructuring-assignment.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
Source/JavaScriptCore/parser/Nodes.h