Bug 730810 - Don't assert doing a compound assignment to a const. r=luke

This commit is contained in:
Jeff Walden 2012-02-27 14:04:04 -08:00
parent 0a850b3ea8
commit 7e88cd00ca
3 changed files with 25 additions and 1 deletions

View File

@ -3700,7 +3700,7 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par
if (lhs->isOp(JSOP_CALLEE)) {
if (Emit1(cx, bce, JSOP_CALLEE) < 0)
return false;
} else if (lhs->isOp(JSOP_NAME)) {
} else if (lhs->isOp(JSOP_NAME) || lhs->isOp(JSOP_GETGNAME)) {
if (!EmitIndex32(cx, lhs->getOp(), atomIndex, bce))
return false;
} else {

View File

@ -0,0 +1,23 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
//-----------------------------------------------------------------------------
var BUGNUMBER = 730810;
var summary = "Don't assert on compound assignment to a const";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
const x = 3;
x += 2;
assertEq(x, 2);
/******************************************************************************/
if (typeof reportCompare === "function")
reportCompare(true, true);
print("Tests complete!");

View File

@ -61,3 +61,4 @@ script regress-691746.js
script regress-697515.js
script correct-this-for-nonnatives-on-array-proto-chain.js
script toSource-0.js
script compound-assign-const.js