diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index c43b501914c..d9a96ff5d30 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -4858,41 +4858,15 @@ BytecodeEmitter::emitIf(ParseNode* pn) } /* - * pnLet represents one of: + * pnLet represents a let-statement: let (x = y) { ... } * - * let-expression: (let (x = y) EXPR) - * let-statement: let (x = y) { ... } - * - * For a let-expression 'let (x = a, [y,z] = b) e', EmitLet produces: - * - * bytecode stackDepth srcnotes - * evaluate a +1 - * evaluate b +1 - * dup +1 - * destructure y - * pick 1 - * dup +1 - * destructure z - * pick 1 - * pop -1 - * setlocal 2 -1 - * setlocal 1 -1 - * setlocal 0 -1 - * pushblockscope (if needed) - * evaluate e +1 - * debugleaveblock - * popblockscope (if needed) - * - * Note that, since pushblockscope simply changes fp->scopeChain and does not - * otherwise touch the stack, evaluation of the let-var initializers must leave - * the initial value in the let-var's future slot. */ /* * Using MOZ_NEVER_INLINE in here is a workaround for llvm.org/pr14047. See * the comment on emitSwitch. */ MOZ_NEVER_INLINE bool -BytecodeEmitter::emitLet(ParseNode* pnLet) +BytecodeEmitter::emitLetBlock(ParseNode* pnLet) { MOZ_ASSERT(pnLet->isArity(PN_BINARY)); ParseNode* varList = pnLet->pn_left; @@ -6722,9 +6696,8 @@ BytecodeEmitter::emitConditionalExpression(ConditionalExpression& conditional) * ignore the value pushed by the first branch. Execution will follow * only one path, so we must decrement this->stackDepth. * - * Failing to do this will foil code, such as let expression and block - * code generation, which must use the stack depth to compute local - * stack indexes correctly. + * Failing to do this will foil code, such as let block code generation, + * which must use the stack depth to compute local stack indexes correctly. */ MOZ_ASSERT(stackDepth > 0); stackDepth--; @@ -7542,8 +7515,7 @@ BytecodeEmitter::emitTree(ParseNode* pn) break; case PNK_LETBLOCK: - case PNK_LETEXPR: - ok = emitLet(pn); + ok = emitLetBlock(pn); break; case PNK_CONST: diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index 67243ea55f4..5c62ad7a979 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -490,7 +490,7 @@ struct BytecodeEmitter bool emitWith(ParseNode* pn); MOZ_NEVER_INLINE bool emitLabeledStatement(const LabeledStatement* pn); - MOZ_NEVER_INLINE bool emitLet(ParseNode* pnLet); + MOZ_NEVER_INLINE bool emitLetBlock(ParseNode* pnLet); MOZ_NEVER_INLINE bool emitLexicalScope(ParseNode* pn); MOZ_NEVER_INLINE bool emitSwitch(ParseNode* pn); MOZ_NEVER_INLINE bool emitTry(ParseNode* pn); diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index 0044779f545..1e6d7855d8b 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -402,7 +402,6 @@ ContainsHoistedDeclaration(ExclusiveContext* cx, ParseNode* node, bool* result) case PNK_FALSE: case PNK_NULL: case PNK_THIS: - case PNK_LETEXPR: case PNK_ELISION: case PNK_NUMBER: case PNK_NEW: diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index f0aa2161d9c..884340e370c 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -591,14 +591,6 @@ class FullParseHandler block->pn_expr = body; } - ParseNode* newLetExpression(ParseNode* vars, ParseNode* block, const TokenPos& pos) { - ParseNode* letExpr = newBinary(PNK_LETEXPR, vars, block); - if (!letExpr) - return nullptr; - letExpr->pn_pos = pos; - return letExpr; - } - ParseNode* newLetBlock(ParseNode* vars, ParseNode* block, const TokenPos& pos) { ParseNode* letBlock = newBinary(PNK_LETBLOCK, vars, block); if (!letBlock) diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.cpp index 69bb38fc845..4aaa106e9de 100644 --- a/js/src/frontend/NameFunctions.cpp +++ b/js/src/frontend/NameFunctions.cpp @@ -424,7 +424,6 @@ class NameResolver case PNK_DIVASSIGN: case PNK_MODASSIGN: case PNK_ELEM: - case PNK_LETEXPR: case PNK_COLON: case PNK_CASE: case PNK_SHORTHAND: diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index 63baa06a6de..a5c29e41ed2 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -266,7 +266,6 @@ PushNodeChildren(ParseNode* pn, NodeStack* stack) case PNK_MODASSIGN: // ...and a few others. case PNK_ELEM: - case PNK_LETEXPR: case PNK_IMPORT_SPEC: case PNK_EXPORT_SPEC: case PNK_COLON: diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index d549c9df39e..2feb2d7928f 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -133,7 +133,6 @@ class UpvarCookie F(LEXICALSCOPE) \ F(LET) \ F(LETBLOCK) \ - F(LETEXPR) \ F(IMPORT) \ F(IMPORT_SPEC_LIST) \ F(IMPORT_SPEC) \ diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 96801b59b9e..b8f64e8b9dc 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -2989,8 +2989,8 @@ Parser::reportRedeclaration(Node pn, Definition::Kind redeclKind, } /* - * Define a lexical binding in a block, let-expression, or comprehension scope. pc - * must already be in such a scope. + * Define a lexical binding in a block, or comprehension scope. pc must + * already be in such a scope. * * Throw a SyntaxError if 'atom' is an invalid name. Otherwise create a * property for the new variable on the block object, pc->staticScope; @@ -3680,14 +3680,13 @@ Parser::pushLetScope(HandleStaticBlockObject blockObj, StmtI } /* - * Parse a let block statement or let expression (determined by 'letContext'). + * Parse a let block statement. * In both cases, bindings are not hoisted to the top of the enclosing block * and thus must be carefully injected between variables() and the let body. */ template typename ParseHandler::Node -Parser::deprecatedLetBlockOrExpression(YieldHandling yieldHandling, - LetContext letContext) +Parser::deprecatedLetBlock(YieldHandling yieldHandling) { MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LET)); @@ -3710,82 +3709,22 @@ Parser::deprecatedLetBlockOrExpression(YieldHandling yieldHandling if (!block) return null(); - bool needExprStmt = false; - if (letContext == LetStatement) { - bool matched; - if (!tokenStream.matchToken(&matched, TOK_LC, TokenStream::Operand)) - return null(); - if (!matched) { - /* - * Strict mode eliminates a grammar ambiguity with unparenthesized - * LetExpressions in an ExpressionStatement. If followed immediately - * by an arguments list, it's ambiguous whether the let expression - * is the callee or the call is inside the let expression body. - * - * function id(x) { return x; } - * var x = "outer"; - * // Does this parse as - * // (let (loc = "inner") id)(loc) // "outer" - * // or as - * // let (loc = "inner") (id(loc)) // "inner" - * let (loc = "inner") id(loc); - * - * See bug 569464. - */ - if (!reportWithOffset(ParseStrictError, pc->sc->strict(), begin, - JSMSG_STRICT_CODE_LET_EXPR_STMT)) - { - return null(); - } + MUST_MATCH_TOKEN(TOK_LC, JSMSG_CURLY_BEFORE_LET); - /* - * If this is really an expression in let statement guise, then we - * need to wrap the PNK_LETEXPR node in a PNK_SEMI node so that we - * pop the return value of the expression. - */ - needExprStmt = true; - letContext = LetExpression; - } - } + Node expr = statements(yieldHandling); + if (!expr) + return null(); + MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_LET); - Node expr; - if (letContext == LetStatement) { - expr = statements(yieldHandling); - if (!expr) - return null(); - MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_LET); + addTelemetry(JSCompartment::DeprecatedLetBlock); + if (!report(ParseWarning, pc->sc->strict(), expr, JSMSG_DEPRECATED_LET_BLOCK)) + return null(); - addTelemetry(JSCompartment::DeprecatedLetBlock); - if (!report(ParseWarning, pc->sc->strict(), expr, JSMSG_DEPRECATED_LET_BLOCK)) - return null(); - } else { - MOZ_ASSERT(letContext == LetExpression); - expr = assignExpr(InAllowed, yieldHandling); - if (!expr) - return null(); - - addTelemetry(JSCompartment::DeprecatedLetExpression); - if (!report(ParseWarning, pc->sc->strict(), expr, JSMSG_DEPRECATED_LET_EXPRESSION)) - return null(); - } handler.setLexicalScopeBody(block, expr); PopStatementPC(tokenStream, pc); TokenPos letPos(begin, pos().end); - if (letContext == LetExpression) { - if (needExprStmt) { - if (!MatchOrInsertSemicolon(tokenStream)) - return null(); - } - - Node letExpr = handler.newLetExpression(vars, block, letPos); - if (!letExpr) - return null(); - - return needExprStmt ? handler.newExprStatement(letExpr, pos().end) : letExpr; - } - return handler.newLetBlock(vars, block, letPos); } @@ -4242,24 +4181,17 @@ Parser::letDeclarationOrBlock(YieldHandling yieldHandling) { handler.disableSyntaxParser(); - /* Check for a let statement or let expression. */ + /* Check for a let statement. */ TokenKind tt; if (!tokenStream.peekToken(&tt)) return null(); if (tt == TOK_LP) { - ParseNode* node = - deprecatedLetBlockOrExpression(yieldHandling, LetStatement); + ParseNode* node = deprecatedLetBlock(yieldHandling); if (!node) return nullptr; - if (node->isKind(PNK_LETBLOCK)) { - MOZ_ASSERT(node->isArity(PN_BINARY)); - } else { - MOZ_ASSERT(node->isKind(PNK_SEMI)); - MOZ_ASSERT(node->pn_kid->isKind(PNK_LETEXPR)); - MOZ_ASSERT(node->pn_kid->isArity(PN_BINARY)); - } - + MOZ_ASSERT(node->isKind(PNK_LETBLOCK)); + MOZ_ASSERT(node->isArity(PN_BINARY)); return node; } @@ -4750,8 +4682,7 @@ Parser::forStatement(YieldHandling yieldHandling) MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_AFTER_FOR); /* - * True if we have 'for (var/let/const ...)', except in the oddball case - * where 'let' begins a let-expression in 'for (let (...) ...)'. + * True if we have 'for (var/let/const ...)'. */ bool isForDecl = false; @@ -4790,19 +4721,13 @@ Parser::forStatement(YieldHandling yieldHandling) handler.disableSyntaxParser(); bool constDecl = tt == TOK_CONST; tokenStream.consumeKnownToken(tt); - if (!tokenStream.peekToken(&tt)) + isForDecl = true; + blockObj = StaticBlockObject::create(context); + if (!blockObj) return null(); - if (tt == TOK_LP) { - pn1 = deprecatedLetBlockOrExpression(yieldHandling, LetExpression); - } else { - isForDecl = true; - blockObj = StaticBlockObject::create(context); - if (!blockObj) - return null(); - pn1 = variables(yieldHandling, - constDecl ? PNK_CONST : PNK_LET, nullptr, blockObj, - DontHoistVars); - } + pn1 = variables(yieldHandling, + constDecl ? PNK_CONST : PNK_LET, nullptr, blockObj, + DontHoistVars); } else { pn1 = expr(InProhibited, yieldHandling); } @@ -7053,9 +6978,7 @@ LegacyCompExprTransplanter::transplant(ParseNode* pn) // The one remaining thing to patch up is the block scope depth. We need to // compute the maximum block scope depth of a function, so we know how much // space to reserve in the fixed part of a stack frame. Normally this is done -// whenever we leave a statement, via AccumulateBlockScopeDepth. However if the -// head has a let expression, we need to re-assign that depth to the tail of the -// comprehension. +// whenever we leave a statement, via AccumulateBlockScopeDepth. // // Thing is, we don't actually know what that depth is, because the only // information we keep is the maximum nested depth within a statement, so we @@ -7128,10 +7051,9 @@ Parser::legacyComprehensionTail(ParseNode* bodyExpr, unsigned * the comprehension's block scope. We allocate that id or one above it * here, by calling PushLexicalScope. * - * In the case of a comprehension expression that has nested blocks - * (e.g., let expressions), we will allocate a higher blockid but then - * slide all blocks "to the right" to make room for the comprehension's - * block scope. + * In the case of a comprehension expression that has nested blocks, + * we will allocate a higher blockid but then slide all blocks "to the + * right" to make room for the comprehension's block scope. */ adjust = pc->blockid(); pn = pushLexicalScope(&stmtInfo); @@ -8219,9 +8141,10 @@ Parser::arrayInitializer(YieldHandling yieldHandling) * * [i * j for (i in o) for (j in p) if (i != j)] * - * translates to roughly the following let expression: + * translates to roughly the following code: * - * let (array = new Array, i, j) { + * { + * let array = new Array, i, j; * for (i in o) let { * for (j in p) * if (i != j) @@ -8651,9 +8574,6 @@ Parser::primaryExpr(YieldHandling yieldHandling, TokenKind tt, case TOK_LC: return propertyList(yieldHandling, ObjectLiteral); - case TOK_LET: - return deprecatedLetBlockOrExpression(yieldHandling, LetExpression); - case TOK_LP: { TokenKind next; if (!tokenStream.peekToken(&next, TokenStream::Operand)) diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index 0a03356a1c9..4fe7af18371 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -326,7 +326,6 @@ struct BindData; class CompExprTransplanter; -enum LetContext { LetExpression, LetStatement }; enum VarContext { HoistVars, DontHoistVars }; enum PropListType { ObjectLiteral, ClassBody }; @@ -629,7 +628,7 @@ class Parser : private JS::AutoGCRooter, public StrictModeGetter Node generatorComprehension(uint32_t begin); bool argumentList(YieldHandling yieldHandling, Node listNode, bool* isSpread); - Node deprecatedLetBlockOrExpression(YieldHandling yieldHandling, LetContext letContext); + Node deprecatedLetBlock(YieldHandling yieldHandling); Node destructuringExpr(YieldHandling yieldHandling, BindData* data, TokenKind tt); Node destructuringExprWithoutYield(YieldHandling yieldHandling, BindData* data, diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseHandler.h index 0c64b556ad1..31418c81213 100644 --- a/js/src/frontend/SyntaxParseHandler.h +++ b/js/src/frontend/SyntaxParseHandler.h @@ -258,10 +258,6 @@ class SyntaxParseHandler Node newLexicalScope(ObjectBox* blockbox) { return NodeGeneric; } void setLexicalScopeBody(Node block, Node body) {} - Node newLetExpression(Node vars, Node block, const TokenPos& pos) { - return NodeGeneric; - } - Node newLetBlock(Node vars, Node block, const TokenPos& pos) { return NodeGeneric; } diff --git a/js/src/jit-test/tests/auto-regress/bug491806.js b/js/src/jit-test/tests/auto-regress/bug491806.js deleted file mode 100644 index 05ec0161f2a..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug491806.js +++ /dev/null @@ -1,9 +0,0 @@ -// Binary: cache/js-dbg-64-0ba03471b3b0-linux -// Flags: -// -uneval(new Function("\ - for(\ - ((let (functional) x) for each ([] in [])); \ - yield x; \ - (let (x = true) x));\ -")) diff --git a/js/src/jit-test/tests/auto-regress/bug523793.js b/js/src/jit-test/tests/auto-regress/bug523793.js deleted file mode 100644 index 70814d639bc..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug523793.js +++ /dev/null @@ -1,15 +0,0 @@ -// |jit-test| error:ReferenceError - -// Binary: cache/js-dbg-32-525d852c622d-linux -// Flags: -j -// -(function() { - let(x) - (function() { - for (let a in [0, x, 0, 0]) - (function() { - for (let y in [0, 0]) print - })(); - })() - with({}) throw x; -})() diff --git a/js/src/jit-test/tests/auto-regress/bug531298.js b/js/src/jit-test/tests/auto-regress/bug531298.js deleted file mode 100644 index 2e75f862a8a..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug531298.js +++ /dev/null @@ -1,18 +0,0 @@ -// Binary: cache/js-dbg-32-15c46082297d-linux -// Flags: -j -// -(function() { - (eval("\ - (function() {\ - let(e)((function() { ((function f(a) {\ - if (a < 1) {\ - return 1\ - }\ - x = arguments;\ - return f(a - 1) + f(a - 2)\ - })(6))\ - })())\ - })\ - "))() -})() -gc() diff --git a/js/src/jit-test/tests/auto-regress/bug569774.js b/js/src/jit-test/tests/auto-regress/bug569774.js deleted file mode 100644 index 846ea5b4b76..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug569774.js +++ /dev/null @@ -1,9 +0,0 @@ -// Binary: cache/js-dbg-64-7f7dfb33a33e-linux -// Flags: -// -x = Proxy.create((function () {}), (evalcx(''))) -try { - (function () { - ((let(e = eval) e).call(x, ("\"\""))) - })() -} catch (e) {} diff --git a/js/src/jit-test/tests/auto-regress/bug650617.js b/js/src/jit-test/tests/auto-regress/bug650617.js deleted file mode 100644 index fd0320440a1..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug650617.js +++ /dev/null @@ -1,6 +0,0 @@ -// |jit-test| error:ReferenceError - -// Binary: cache/js-dbg-64-242947d76f73-linux -// Flags: -// -for (b in [evalcx("let(e)eval()", evalcx('split'))]) {} diff --git a/js/src/jit-test/tests/auto-regress/bug712169.js b/js/src/jit-test/tests/auto-regress/bug712169.js deleted file mode 100644 index 21693fe4e8d..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug712169.js +++ /dev/null @@ -1,14 +0,0 @@ -// |jit-test| slow; - -// Binary: cache/js-dbg-32-f98c57415d8d-linux -// Flags: -// - -try { - var str = '0123456789'; - for (var icount = 0; icount < 25; ++icount, let(icount2, printStatus) (function() gczeal(2))[1]++) - str = str + str; -} catch(ex) { - new Date( str, false, (new RegExp('[0-9]{3}')).test('23 2 34 78 9 09')); -} -this.toSource(); diff --git a/js/src/jit-test/tests/auto-regress/bug740509.js b/js/src/jit-test/tests/auto-regress/bug740509.js index e5f7f38f41e..3d6014b9d04 100644 --- a/js/src/jit-test/tests/auto-regress/bug740509.js +++ b/js/src/jit-test/tests/auto-regress/bug740509.js @@ -59,9 +59,6 @@ function InLeapYear( t ) {\ function DayWithinYear( t ) {\ return( Day(t) - DayFromYear(YearFromTime(t)));\ "); -lfcode.push("this.__proto__ = []; \ -let ( _ = this ) Boolean (\"({ set x([, b, c]) { } })\");\ -"); while (true) { var file = lfcode.shift(); if (file == undefined) { break; } if (file == "evaluate") { diff --git a/js/src/jit-test/tests/auto-regress/bug745158.js b/js/src/jit-test/tests/auto-regress/bug745158.js deleted file mode 100644 index 2555c538a65..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug745158.js +++ /dev/null @@ -1,8 +0,0 @@ -// |jit-test| error:TypeError - -// Binary: cache/js-dbg-32-3fa30b0edd15-linux -// Flags: -// - -let ([] = 1) 3; -let (i) new [i][print[i]]; diff --git a/js/src/jit-test/tests/auto-regress/bug765280.js b/js/src/jit-test/tests/auto-regress/bug765280.js deleted file mode 100644 index a540c732df4..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug765280.js +++ /dev/null @@ -1,8 +0,0 @@ -// |jit-test| error:Error - -// Binary: cache/js-dbg-64-85e31a4bdd41-linux -// Flags: -// - -function f(x = let([] = c) 1, ... __call__) {} -assertEq(this > f, true); diff --git a/js/src/jit-test/tests/auto-regress/bug800407.js b/js/src/jit-test/tests/auto-regress/bug800407.js deleted file mode 100644 index 95ed9ab7fe6..00000000000 --- a/js/src/jit-test/tests/auto-regress/bug800407.js +++ /dev/null @@ -1,10 +0,0 @@ -// Binary: cache/js-dbg-32-5cca0408a73f-linux -// Flags: -// - -options("strict_mode"); -function test(str, arg, result) { - var fun = new Function('x', str); - var got = fun.toSource(); -} -test('return let (y) x;'); diff --git a/js/src/jit-test/tests/baseline/bug1115844.js b/js/src/jit-test/tests/baseline/bug1115844.js deleted file mode 100644 index 07a41762a40..00000000000 --- a/js/src/jit-test/tests/baseline/bug1115844.js +++ /dev/null @@ -1,6 +0,0 @@ -function f() { - let(x) yield x; -} -var g = f(); -g.next(); -g.close(); diff --git a/js/src/jit-test/tests/baseline/bug842326.js b/js/src/jit-test/tests/baseline/bug842326.js deleted file mode 100644 index 10dc77e9ad7..00000000000 --- a/js/src/jit-test/tests/baseline/bug842326.js +++ /dev/null @@ -1,16 +0,0 @@ -function TestCase(n, d, e, a) -this.passed = getTestCaseResult(e, a); -function getTestCaseResult(expected, actual) { - if (actual != actual) - return gTestcases; -} -gczeal(4); -try { - var TEST_STRING = new String(""); - new TestCase(null, 0,eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") ); - new TestCase(null, null, 0, eval("x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)")); - new TestCase(null, null, 0, eval("x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)")); - new TestCase(null, null, 0, eval("x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)")); - new TestCase(null, null, Number.NaN, eval("x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)")); - new new let (r) (function () {}) (); -} catch(e) {} diff --git a/js/src/jit-test/tests/basic/bug510642.js b/js/src/jit-test/tests/basic/bug510642.js deleted file mode 100644 index c225d15f6ca..00000000000 --- a/js/src/jit-test/tests/basic/bug510642.js +++ /dev/null @@ -1,14 +0,0 @@ -// Don't crash or assert. - -(function () { - var x; - (eval("\ - (function () {\ - for (y in [0, 0]) let(a)((function () {\ - for (w in [0, 0])\ - x = 0\ - })());\ - with({}) {}\ - })\ - "))() -})() diff --git a/js/src/jit-test/tests/basic/bug601395.js b/js/src/jit-test/tests/basic/bug601395.js deleted file mode 100644 index cdf61a3994d..00000000000 --- a/js/src/jit-test/tests/basic/bug601395.js +++ /dev/null @@ -1,2 +0,0 @@ -// |jit-test| error: SyntaxError; -let(y = let(d = []) u, x diff --git a/js/src/jit-test/tests/basic/bug601402.js b/js/src/jit-test/tests/basic/bug601402.js deleted file mode 100644 index 33bda5a82c3..00000000000 --- a/js/src/jit-test/tests/basic/bug601402.js +++ /dev/null @@ -1,2 +0,0 @@ -// |jit-test| error: SyntaxError; -for (let d in [(0)]) let(b = (let(e) {}), d diff --git a/js/src/jit-test/tests/basic/bug646968-1.js b/js/src/jit-test/tests/basic/bug646968-1.js deleted file mode 100644 index 00b948a28e6..00000000000 --- a/js/src/jit-test/tests/basic/bug646968-1.js +++ /dev/null @@ -1,7 +0,0 @@ -var x = 5; -let (x = x) - assertEq(x, 5); -let (x = eval("x")) - assertEq(x, 5); -let (x = function () { with ({}) return x; }) - assertEq(x(), 5); diff --git a/js/src/jit-test/tests/basic/bug646968-2.js b/js/src/jit-test/tests/basic/bug646968-2.js deleted file mode 100644 index e86e3a6e915..00000000000 --- a/js/src/jit-test/tests/basic/bug646968-2.js +++ /dev/null @@ -1,4 +0,0 @@ -var x = 5; -(let (x = x) assertEq(x, 5)); -(let (x = eval("x")) assertEq(x, 5)); -(let (x = function () { with ({}) return x; }) assertEq(x(), 5)); diff --git a/js/src/jit-test/tests/basic/bug646968-6.js b/js/src/jit-test/tests/basic/bug646968-6.js deleted file mode 100644 index 75f917926a5..00000000000 --- a/js/src/jit-test/tests/basic/bug646968-6.js +++ /dev/null @@ -1,6 +0,0 @@ -function test(s) { - eval(s); - let (a = ({}).q = 0, x = x) - assertEq(x, 5); -} -test('var x = 5;'); diff --git a/js/src/jit-test/tests/basic/bug647695.js b/js/src/jit-test/tests/basic/bug647695.js deleted file mode 100644 index 0f23b82c950..00000000000 --- a/js/src/jit-test/tests/basic/bug647695.js +++ /dev/null @@ -1,15 +0,0 @@ -try { let(x = Date(7), y = let(a = x)("")) {} } catch (e) {} - -try { -with({ - y: Float64Array -}) -for each(let y in [y]) {} -} catch (e) {} - -try { test(); } catch (e) {} -function test() { - try { - var result, arguments = 'adddb', arguments; - } catch (ex) {} -} diff --git a/js/src/jit-test/tests/basic/bug662338.js b/js/src/jit-test/tests/basic/bug662338.js deleted file mode 100644 index b4973b5a2b5..00000000000 --- a/js/src/jit-test/tests/basic/bug662338.js +++ /dev/null @@ -1 +0,0 @@ -let (parsesSuccessfully = SyntaxError) function () parsesSuccessfully diff --git a/js/src/jit-test/tests/basic/bug708805.js b/js/src/jit-test/tests/basic/bug708805.js deleted file mode 100644 index 95fd99668f1..00000000000 --- a/js/src/jit-test/tests/basic/bug708805.js +++ /dev/null @@ -1,4 +0,0 @@ -gczeal(4); -test(); -function test() -eval("with({}) let(x=[])(function(){x})()"); diff --git a/js/src/jit-test/tests/basic/bug729364.js b/js/src/jit-test/tests/basic/bug729364.js deleted file mode 100644 index e9efdc59a58..00000000000 --- a/js/src/jit-test/tests/basic/bug729364.js +++ /dev/null @@ -1,20 +0,0 @@ -function f() { - try {} catch (e) {} -} -function g(code) { - function m() { - return "(function(){return " + code + "})()" - } - var codeNestedDeep = m(codeNestedDeep) - h(m(code), "same-compartment") - h(codeNestedDeep, "same-compartment") -} -function h(code, globalType) { - try { - evalcx(code, newGlobal(globalType)) - } catch (e) { - "" + f() - } -} -function p()(function() function() {}) -g("print(let(x=verifyprebarriers(),q)((x(\"\",l('')))?(\"\"):(\"\")))()") diff --git a/js/src/jit-test/tests/basic/bug753283.js b/js/src/jit-test/tests/basic/bug753283.js deleted file mode 100644 index 2f1e7416354..00000000000 --- a/js/src/jit-test/tests/basic/bug753283.js +++ /dev/null @@ -1,26 +0,0 @@ -var summary = ''; -function printStatus (msg) { - var lines = msg.split ("\n"); -} -evaluate("\ -function f() {\ - var ss = [\ - new f(Int8Array, propertyIsEnumerable, '[let (x = 3, y = 4) x].map(0)')\ - ];\ -}\ -try {\ - f();\ -} catch (e) {}\ - gczeal(4);\ - printStatus (summary);\ -"); -evaluate("\ -function g(n, h) {\ - var a = f;\ - if (n <= 0) \ - return f; \ - var t = g(n - 1, h);\ - var r = function(x) { };\ -}\ -g(80, f);\ -"); diff --git a/js/src/jit-test/tests/basic/destructuring-default.js b/js/src/jit-test/tests/basic/destructuring-default.js index 4548f39fcb0..e1385446b10 100644 --- a/js/src/jit-test/tests/basic/destructuring-default.js +++ b/js/src/jit-test/tests/basic/destructuring-default.js @@ -92,7 +92,7 @@ function testThrow(pattern, input) { } testAll(testThrow); -// XXX: Support for let blocks and expressions will be removed in bug 1023609. +// XXX: Support for let blocks will be removed in bug 1023609. // However, they test a special code path in destructuring assignment so having // these tests here for now seems like a good idea. function testLetBlock(pattern, input) { @@ -103,13 +103,6 @@ function testLetBlock(pattern, input) { } testAll(testLetBlock); -function testLetExpression(pattern, input) { - return new Function('input', - 'return (let (' + pattern + ' = input) [a, b, c, d, e, f]);' - )(input); -} -testAll(testLetExpression); - // test global const const [ca = 1, cb = 2] = []; assertEq(ca, 1); diff --git a/js/src/jit-test/tests/basic/destructuring-rest.js b/js/src/jit-test/tests/basic/destructuring-rest.js index 29b3884d3df..256b1168283 100644 --- a/js/src/jit-test/tests/basic/destructuring-rest.js +++ b/js/src/jit-test/tests/basic/destructuring-rest.js @@ -128,7 +128,7 @@ function testThrow(pattern, input, binding) { } testDeclaration(testThrow); -// XXX: Support for let blocks and expressions will be removed in bug 1023609. +// XXX: Support for let blocks will be removed in bug 1023609. // However, they test a special code path in destructuring assignment so having // these tests here for now seems like a good idea. function testLetBlock(pattern, input, binding) { @@ -139,12 +139,3 @@ function testLetBlock(pattern, input, binding) { )(input); } testDeclaration(testLetBlock); - -function testLetExpression(pattern, input, binding) { - binding = binding || 'rest'; - return new Function('input', - 'return (let (' + pattern + ' = input) ' + binding + ');' - )(input); -} -testDeclaration(testLetExpression); - diff --git a/js/src/jit-test/tests/basic/function-tosource-constructor.js b/js/src/jit-test/tests/basic/function-tosource-constructor.js index 59e04a8f5af..5ee9ff6db44 100644 --- a/js/src/jit-test/tests/basic/function-tosource-constructor.js +++ b/js/src/jit-test/tests/basic/function-tosource-constructor.js @@ -8,8 +8,6 @@ assertEq(f.toString(), "function anonymous(a, ...rest) {\nreturn rest[42] + b;\n assertEq(f.toSource(), "(function anonymous(a, ...rest) {\nreturn rest[42] + b;\n})") assertEq(decompileFunction(f), f.toString()); assertEq(decompileBody(f), "return rest[42] + b;"); -f = Function("x", "return let (y) x;"); -assertEq(f.toSource(), "(function anonymous(x) {\nreturn let (y) x;\n})"); f = Function(""); assertEq(f.toString(), "function anonymous() {\n\n}"); f = Function("", "(abc)"); diff --git a/js/src/jit-test/tests/basic/regress-bug720680.js b/js/src/jit-test/tests/basic/regress-bug720680.js deleted file mode 100644 index ebb794fb545..00000000000 --- a/js/src/jit-test/tests/basic/regress-bug720680.js +++ /dev/null @@ -1,15 +0,0 @@ -// |jit-test| error: InternalError -version(0); -eval("\ -function TimeFromYear( y ) {}\ -addTestCase( -2208988800000 );\ -function addTestCase( t ) {\ - var start = TimeFromYear((addTestCase(addTestCase << t, 0)));\ - new TestCase( \ - SECTION,\ - '(new Date('+d+')).getUTCDay()',\ - WeekDay((d)),\ - (new Date(let ({ stop } = 'properties.length' )('/ab[c\\\n]/'))).getUTCDay() \ - );\ -}\ -"); diff --git a/js/src/jit-test/tests/basic/syntax-error-illegal-character.js b/js/src/jit-test/tests/basic/syntax-error-illegal-character.js index 128b6a380ea..18fede5850a 100644 --- a/js/src/jit-test/tests/basic/syntax-error-illegal-character.js +++ b/js/src/jit-test/tests/basic/syntax-error-illegal-character.js @@ -977,7 +977,6 @@ test("let ( x = 1, y = 2 ) { @"); test("let ( x = 1, y = 2 ) { x @"); test("let ( x = 1, y = 2 ) { x; @"); test("let ( x = 1, y = 2 ) { x; } @"); -test_no_strict("let ( x = 1, y = 2 ) x @"); // Expression closures @@ -1014,22 +1013,6 @@ test("for each (let x in @"); test("for each (let x in y @"); test("for each (let x in y) @"); -// let expression - -test("(let @"); -test("(let ( @"); -test("(let ( x @"); -test("(let ( x = @"); -test("(let ( x = 1 @"); -test("(let ( x = 1, @"); -test("(let ( x = 1, y @"); -test("(let ( x = 1, y = @"); -test("(let ( x = 1, y = 2 @"); -test("(let ( x = 1, y = 2 ) @"); -test("(let ( x = 1, y = 2 ) x @"); -test("(let ( x = 1, y = 2 ) x) @"); -test("(let ( x = 1, y = 2 ) x); @"); - // Legacy array comprehensions test("[x @"); diff --git a/js/src/jit-test/tests/basic/testBug579647.js b/js/src/jit-test/tests/basic/testBug579647.js deleted file mode 100644 index 4a4d41164b3..00000000000 --- a/js/src/jit-test/tests/basic/testBug579647.js +++ /dev/null @@ -1,13 +0,0 @@ -expected = "TypeError: a is not a function"; -actual = ""; - -try { - a = "" - for each(x in [0, 0, 0, 0]) { - a %= x - } ( let (a=-a) a)() -} catch (e) { - actual = '' + e; -} - -assertEq(actual, expected); diff --git a/js/src/jit-test/tests/basic/testBug692274-4.js b/js/src/jit-test/tests/basic/testBug692274-4.js deleted file mode 100644 index 8c02cdc1138..00000000000 --- a/js/src/jit-test/tests/basic/testBug692274-4.js +++ /dev/null @@ -1,4 +0,0 @@ -// |jit-test| error: TypeError -var obj = {}; -let ([] = print) 3; -let ( i = "a" ) new i [ obj[i] ]; diff --git a/js/src/jit-test/tests/basic/testBug709633.js b/js/src/jit-test/tests/basic/testBug709633.js deleted file mode 100644 index 1ce097b85d4..00000000000 --- a/js/src/jit-test/tests/basic/testBug709633.js +++ /dev/null @@ -1,9 +0,0 @@ -test(); -function test() { - var f; - f = function() { (let(x) {y: z}) } - let (f = function() { - for (var t=0;t<6;++t) ++f; - }) { f(); } // { } - actual = f + ''; -} diff --git a/js/src/jit-test/tests/basic/testBug773108.js b/js/src/jit-test/tests/basic/testBug773108.js deleted file mode 100644 index 69146713a23..00000000000 --- a/js/src/jit-test/tests/basic/testBug773108.js +++ /dev/null @@ -1,11 +0,0 @@ -// |jit-test| error:InternalError - -Function("\ -for each(l in[(let(c)([])\ -for each(l in[]))(let(c)w for(u in[]))(let(u)w for(l in[]))(let(c)w for(u in[]))\ -(let(u)w for each(l in[]))(let(c)w for(u in[]))(let(u)w for(l in[]))(let(c)w for(u in[]))\ -(let(u)w for each(l in[]))(let(c)w for(u in[]))(let(u)w for(l in[]))(let(c)w for(u in[]))\ -(let(l)w for(l in[]))(let(u)w for(l in['']))(let(c)w for(u in[]))(let(u)w for(l in[]))\ -(let(c)w for(l in[]))(let(l)w for(l in[]))(let(c)w for(l in[]))(let(u)w for(l in[]))\ -(let(c)w for(l in[]))(let(u)w for each(l in[x]))(let(w,x)w for(u in[]))]){}\ -") diff --git a/js/src/jit-test/tests/basic/testDynamicUsage.js b/js/src/jit-test/tests/basic/testDynamicUsage.js index 02fd984e12d..ae6a6e4c8c6 100644 --- a/js/src/jit-test/tests/basic/testDynamicUsage.js +++ b/js/src/jit-test/tests/basic/testDynamicUsage.js @@ -59,10 +59,6 @@ assertEq((function(a) { let ([x,y] = a) { (function() { x += y })(); return x } assertEq((function(a) { let ([x,y] = a) { x += y; return (function() x)() } })([1,2]), 3); assertEq((function(a) { let ([[l, x],[m, y]] = a) { (function() { x += y })(); return x } })([[0,1],[0,2]]), 3); assertEq((function(a) { let ([[l, x],[m, y]] = a) { x += y; return (function() x)() } })([[0,1],[0,2]]), 3); -assertEq((function(a) { return let ([x,y] = a) ((function() { x += y })(), x) })([1,2]), 3); -assertEq((function(a) { return let ([x,y] = a) (x += y, (function() x)()) })([1,2]), 3); -assertEq((function(a) { return let ([[l, x],[m, y]] = a) ((function() { x += y })(), x) })([[0,1],[0,2]]), 3); -assertEq((function(a) { return let ([[l, x],[m, y]] = a) (x += y, (function() x)()) })([[0,1],[0,2]]), 3); assertEq((function() { let x = 3; return (function() { return x })() })(), 3); assertEq((function() { let g = function() { return x }; let x = 3; return g() })(), 3); diff --git a/js/src/jit-test/tests/basic/testLet.js b/js/src/jit-test/tests/basic/testLet.js index debaf881f89..7f42fd6c064 100644 --- a/js/src/jit-test/tests/basic/testLet.js +++ b/js/src/jit-test/tests/basic/testLet.js @@ -57,47 +57,46 @@ function isReferenceError(str) } // let expr -test('return let (y) x;'); -test('return let (x) "" + x;', 'unicorns', 'undefined'); -test('return let (y = x) (y++, "" + y);', 'unicorns', 'NaN'); -test('return let (y = 1) (y = x, y);'); -test('return let ([] = x) x;'); -test('return let (x = {a: x}) x.a;'); -test('return let ({a: x} = {a: x}) x;'); -test('return let ([x] = [x]) x;'); -test('return let ({0: x} = [x]) x;'); -test('return let ({0: []} = [[]]) x;'); -test('return let ([, ] = x) x;'); -test('return let ([, , , , ] = x) x;'); -test('return let (x = x) x;'); -test('return let (x = eval("x")) x;'); -test('return let (x = (let (x = x + 1) x) + 1) x;', 1, 3); -test('return let (x = (let (x = eval("x") + 1) eval("x")) + 1) eval("x");', 1, 3); -test('return let (x = x + 1, y = x) y;'); -test('return let (x = x + 1, [] = x, /*[[, , ]] = x, */y = x) y;'); -test('return let ([{a: x}] = x, [, {b: y}] = x) let (x = x + 1, y = y + 2) x + y;', [{a:"p"},{b:"p"}], "p1p2"); -test('return let ([] = []) x;'); -test('return let ([] = [x]) x;'); -test('return let ([a] = (1, [x])) a;'); -test('return let ([a] = (1, x, 1, x)) a;', ['ponies']); -test('return let ([x] = [x]) x;'); -test('return let ([[a, [b, c]]] = [[x, []]]) a;'); -test('return let ([x, y] = [x, x + 1]) x + y;', 1, 3); -test('return let ([x, y, z] = [x, x + 1, x + 2]) x + y + z;', 1, 6); -test('return let ([[x]] = [[x]]) x;'); -test('return let ([x, y] = [x, x + 1]) x;'); -test('return let ([x, [y, z]] = [x, x + 1]) x;'); -test('return let ([{x: [x]}, {y1: y, z1: z}] = [x, x + 1]) x;',{x:['ponies']}); -test('return let (x = (3, x)) x;'); -test('return let (x = x + "s") x;', 'ponie'); -test('return let ([x] = (3, [x])) x;'); -test('return let (y = x) function () {return eval("y");}();'); -test('return eval("let (y = x) y");'); -test('return let (y = x) (eval("var y = 2"), y);', 'ponies', 2); -test('"use strict";return let (y = x) (eval("var y = 2"), y);'); -test('this.y = x;return let (y = 1) this.eval("y");'); -test('try {let (x = x) eval("throw x");} catch (e) {return e;}'); -test('try {return let (x = eval("throw x")) x;} catch (e) {return e;}'); +isParseError('return let (y) x;'); +isParseError('return let (x) "" + x;', 'unicorns', 'undefined'); +isParseError('return let (y = x) (y++, "" + y);', 'unicorns', 'NaN'); +isParseError('return let (y = 1) (y = x, y);'); +isParseError('return let ([] = x) x;'); +isParseError('return let (x = {a: x}) x.a;'); +isParseError('return let ({a: x} = {a: x}) x;'); +isParseError('return let ([x] = [x]) x;'); +isParseError('return let ({0: x} = [x]) x;'); +isParseError('return let ({0: []} = [[]]) x;'); +isParseError('return let ([, ] = x) x;'); +isParseError('return let ([, , , , ] = x) x;'); +isParseError('return let (x = x) x;'); +isParseError('return let (x = eval("x")) x;'); +isParseError('return let (x = (let (x = x + 1) x) + 1) x;', 1, 3); +isParseError('return let (x = (let (x = eval("x") + 1) eval("x")) + 1) eval("x");', 1, 3); +isParseError('return let (x = x + 1, y = x) y;'); +isParseError('return let (x = x + 1, [] = x, /*[[, , ]] = x, */y = x) y;'); +isParseError('return let ([{a: x}] = x, [, {b: y}] = x) let (x = x + 1, y = y + 2) x + y;', [{a:"p"},{b:"p"}], "p1p2"); +isParseError('return let ([] = []) x;'); +isParseError('return let ([] = [x]) x;'); +isParseError('return let ([a] = (1, [x])) a;'); +isParseError('return let ([a] = (1, x, 1, x)) a;', ['ponies']); +isParseError('return let ([x] = [x]) x;'); +isParseError('return let ([[a, [b, c]]] = [[x, []]]) a;'); +isParseError('return let ([x, y] = [x, x + 1]) x + y;', 1, 3); +isParseError('return let ([x, y, z] = [x, x + 1, x + 2]) x + y + z;', 1, 6); +isParseError('return let ([[x]] = [[x]]) x;'); +isParseError('return let ([x, y] = [x, x + 1]) x;'); +isParseError('return let ([x, [y, z]] = [x, x + 1]) x;'); +isParseError('return let ([{x: [x]}, {y1: y, z1: z}] = [x, x + 1]) x;',{x:['ponies']}); +isParseError('return let (x = (3, x)) x;'); +isParseError('return let (x = x + "s") x;', 'ponie'); +isParseError('return let ([x] = (3, [x])) x;'); +isParseError('return let (y = x) function () {return eval("y");}();'); +isParseError('return let (y = x) (eval("var y = 2"), y);', 'ponies', 2); +isParseError('"use strict";return let (y = x) (eval("var y = 2"), y);'); +isParseError('this.y = x;return let (y = 1) this.eval("y");'); +isParseError('try {let (x = x) eval("throw x");} catch (e) {return e;}'); +isParseError('try {return let (x = eval("throw x")) x;} catch (e) {return e;}'); isParseError('let (x = 1, x = 2) x'); isParseError('let ([x, y] = a, {a:x} = b) x'); isParseError('let ([x, y, x] = a) x'); @@ -121,8 +120,8 @@ test('let ([, ] = x) {return x;}'); test('let ([, , , , ] = x) {return x;}'); test('let (x = x) {return x;}'); test('let (x = eval("x")) {return x;}'); -test('let (x = (let (x = x + 1) x) + 1) {return x;}', 1, 3); -test('let (x = (let (x = eval("x") + 1) eval("x")) + 1) {return eval("x");}', 1, 3); +isParseError('let (x = (let (x = x + 1) x) + 1) {return x;}', 1, 3); +isParseError('let (x = (let (x = eval("x") + 1) eval("x")) + 1) {return eval("x");}', 1, 3); test('let (x = x + 1, y = x) {return y;}'); test('let (x = x + 1, [] = x, [[, , ]] = x, y = x) {return y;}'); test('let ([{a: x}] = x, [, {b: y}] = x) {let (x = x + 1, y = y + 2) {return x + y;}}', [{a:"p"},{b:"p"}], "p1p2"); @@ -139,7 +138,7 @@ test('let ([x, y] = [x, x + 1]) {return x;}'); test('let ([x, [y, z]] = [x, x + 1]) {return x;}'); test('let ([{x: [x]}, {y1: y, z1: z}] = [x, x + 1]) {return x;}',{x:['ponies']}); test('let (y = x[1]) {let (x = x[0]) {try {let (y = "unicorns") {throw y;}} catch (e) {return x + y;}}}', ['pon','ies']); -test('let (x = x) {try {let (x = "unicorns") eval("throw x");} catch (e) {return x;}}'); +isParseError('let (x = x) {try {let (x = "unicorns") eval("throw x");} catch (e) {return x;}}'); test('let (y = x) {return function () {return eval("y");}();}'); test('return eval("let (y = x) {y;}");'); test('let (y = x) {eval("var y = 2");return y;}', 'ponies', 2); @@ -159,8 +158,8 @@ test('var [, , , , ] = x;return x;'); test('var x = x;return x;'); test('var y = y;return "" + y;', 'unicorns', 'undefined'); test('var x = eval("x");return x;'); -test('var x = (let (x = x + 1) x) + 1;return x;', 1, 3); -test('var x = (let (x = eval("x") + 1) eval("x")) + 1;return eval("x");', 1, 3); +isParseError('var x = (let (x = x + 1) x) + 1;return x;', 1, 3); +isParseError('var x = (let (x = eval("x") + 1) eval("x")) + 1;return eval("x");', 1, 3); test('var X = x + 1, y = x;return y;'); test('var X = x + 1, [] = X, [[, , ]] = X, y = x;return y;'); test('var [{a: X}] = x, [, {b: y}] = x;var X = X + 1, y = y + 2;return X + y;', [{a:"p"},{b:"p"}], "p1p2"); @@ -187,8 +186,8 @@ test('if (x) {let y = x;return x;}'); test('if (x) {let [] = x;return x;}'); test('if (x) {let [, ] = x;return x;}'); test('if (x) {let [, , , , ] = x;return x;}'); -test('if (x) {let y = (let (x = x + 1) x) + 1;return y;}', 1, 3); -test('if (x) {let y = (let (x = eval("x") + 1) eval("x")) + 1;return eval("y");}', 1, 3); +isParseError('if (x) {let y = (let (x = x + 1) x) + 1;return y;}', 1, 3); +isParseError('if (x) {let y = (let (x = eval("x") + 1) eval("x")) + 1;return eval("y");}', 1, 3); test('if (x) {let X = x + 1, y = x;return y;}'); test('if (x) {let X = x + 1, [] = X, [[, , ]] = X, y = x;return y;}'); test('if (x) {let [{a: X}] = x, [, {b: Y}] = x;var XX = X + 1, YY = Y + 2;return XX + YY;}', [{a:"p"},{b:"p"}], "p1p2"); @@ -232,8 +231,8 @@ test('for (;;) {return x;}'); test('for (let y = 1;;) {return x;}'); test('for (let y = 1;; ++y) {return x;}'); test('for (let y = 1; ++y;) {return x;}'); -test('for (let (x = 1) x; x != 1; ++x) {return x;}'); -test('for (let (x = 1, [{a: b, c: d}] = [{a: 1, c: 2}]) x; x != 1; ++x) {return x;}'); +isParseError('for (let (x = 1) x; x != 1; ++x) {return x;}'); +isParseError('for (let (x = 1, [{a: b, c: d}] = [{a: 1, c: 2}]) x; x != 1; ++x) {return x;}'); test('for (let [[a, [b, c]]] = [[x, []]];;) {return a;}'); test('var sum = 0;for (let y = x; y < 4; ++y) {sum += y;}return sum;', 1, 6); test('var sum = 0;for (let x = x, y = 10; x < 4; ++x) {sum += x;}return sum;', 1, 6); @@ -280,7 +279,7 @@ test('for each (let {x: y, y: x} in [{x: x, y: x}]) {return y;}'); test('for (let x in eval("x")) {return x;}', {ponies:true}); test('for (let x in x) {return eval("x");}', {ponies:true}); test('for (let x in eval("x")) {return eval("x");}', {ponies:true}); -test('for ((let (x = {y: true}) x).y in eval("x")) {return eval("x");}'); +isParseError('for ((let (x = {y: true}) x).y in eval("x")) {return eval("x");}'); test('for (let i in x) {break;}return x;'); test('for (let i in x) {break;}return eval("x");'); test('for (let x in x) {break;}return x;'); diff --git a/js/src/jit-test/tests/basic/testScriptCloning.js b/js/src/jit-test/tests/basic/testScriptCloning.js index face70bce0e..18835f56cfc 100644 --- a/js/src/jit-test/tests/basic/testScriptCloning.js +++ b/js/src/jit-test/tests/basic/testScriptCloning.js @@ -15,9 +15,6 @@ assertEq(g.eval("clone(f)()('123ponies')"), 3); g.f = new Function('return function(x,y) { return x.search(/a/) + y.search(/b/) };'); assertEq(g.eval("clone(f)()('12a','foo')"), 1); -g.f = new Function('return [function(x) x+2, function(y) let(z=y+1) z];'); -assertEq(g.eval("let ([f,g] = clone(f)()) f(g(4))"), 7); - g.f = new Function('return function(x) { switch(x) { case "a": return "b"; case null: return "c" } };'); assertEq(g.eval("clone(f)()('a')"), "b"); assertEq(g.eval("clone(f)()(null)"), "c"); diff --git a/js/src/jit-test/tests/basic/throw-apply-too-many-args.js b/js/src/jit-test/tests/basic/throw-apply-too-many-args.js index a9e3908f04c..21569c28956 100644 --- a/js/src/jit-test/tests/basic/throw-apply-too-many-args.js +++ b/js/src/jit-test/tests/basic/throw-apply-too-many-args.js @@ -4,7 +4,9 @@ function f(a, b, c) arguments.length = getMaxArgs() + 1; g.apply(this, arr); } -var args = [[5], [5], [5], [5], [5], [5], [5], [5], [5], [5], [5], let (x = []) (x.length = getMaxArgs() + 1, x)] +let x = []; +x.length = getMaxArgs() + 1; +var args = [[5], [5], [5], [5], [5], [5], [5], [5], [5], [5], [5], x] try { for (var i = 0; i < args.length; i++) { arr = args[i]; f(); } diff --git a/js/src/jit-test/tests/closures/bug540131-3.js b/js/src/jit-test/tests/closures/bug540131-3.js deleted file mode 100644 index 8d47d791e81..00000000000 --- a/js/src/jit-test/tests/closures/bug540131-3.js +++ /dev/null @@ -1,13 +0,0 @@ -(function() { - (eval("\ - (function() {\ - let(e = eval(\"\ - for(z=0;z<5;z++){}\ - \"))\ - (function(){\ - x = e\ - })()\ - })\ - "))() -})(); -print(x) diff --git a/js/src/jit-test/tests/debug/Environment-find-02.js b/js/src/jit-test/tests/debug/Environment-find-02.js index 809f61c0d64..e6e0e80c9f0 100644 --- a/js/src/jit-test/tests/debug/Environment-find-02.js +++ b/js/src/jit-test/tests/debug/Environment-find-02.js @@ -14,5 +14,5 @@ g.h = function () { }; g.eval("h();"); -g.eval("(function () { let (x = 1, y = 2) h(); })();"); +g.eval("(function () { h(); })();"); assertEq(hits, 2); diff --git a/js/src/jit-test/tests/debug/Environment-find-06.js b/js/src/jit-test/tests/debug/Environment-find-06.js index d3c76f2a66a..b012dbe0ac9 100644 --- a/js/src/jit-test/tests/debug/Environment-find-06.js +++ b/js/src/jit-test/tests/debug/Environment-find-06.js @@ -42,8 +42,6 @@ test2(' { let @@ = 0; { let y = 0; h(); } }'); test2('function f() { let @@ = 0; { let y = 0; h(); } } f();'); test2(' { for (let @@ = 0; X < 1; X++) h(); }'); test2('function f() { for (let @@ = 0; X < 1; X++) h(); } f();'); -test2(' { (let (@@ = 0) let (y = 2, z = 3) h()); }'); -test2('function f() { return (let (@@ = 0) let (y = 2, z = 3) h()); } f();'); test1('(function X() { h(); })();'); test1('(function X(a, b, c) { h(); })(1, 2, 3);'); diff --git a/js/src/jit-test/tests/debug/Environment-type-01.js b/js/src/jit-test/tests/debug/Environment-type-01.js index f69760f33bb..3fdd1e2dbae 100644 --- a/js/src/jit-test/tests/debug/Environment-type-01.js +++ b/js/src/jit-test/tests/debug/Environment-type-01.js @@ -16,7 +16,6 @@ test("{let x = 1, y = 2; h();}", 'declarative'); test("with({x: 1, y: 2}) h();", 'with'); test("(function (s) { with ({x: 1, y: 2}) h(); })();", 'with'); test("let (x = 1) { h(); }", 'declarative'); -test("(let (x = 1) h());", 'declarative'); test("for (let x = 0; x < 1; x++) h();", 'declarative'); test("for (let x in h()) ;", 'object'); test("for (let x in {a:1}) h();", 'declarative'); diff --git a/js/src/jit-test/tests/for-of/syntax-1.js b/js/src/jit-test/tests/for-of/syntax-1.js index 0c8b63aafd5..99499fba960 100644 --- a/js/src/jit-test/tests/for-of/syntax-1.js +++ b/js/src/jit-test/tests/for-of/syntax-1.js @@ -18,5 +18,4 @@ var a, b, c; test("for (a in b of c)"); test("for each (a of b)"); test("for (a of b of c)"); -test("for (let (a = 1) a of b)"); test("for (let {a: 1} of b)"); diff --git a/js/src/jit-test/tests/gc/bug-880776.js b/js/src/jit-test/tests/gc/bug-880776.js deleted file mode 100644 index 97358b0e0c4..00000000000 --- a/js/src/jit-test/tests/gc/bug-880776.js +++ /dev/null @@ -1,21 +0,0 @@ - -gczeal(11); -var otherGlobal = newGlobal(); -function test(str, arg, result) -{ - var fun = new Function('x', str); - var code = "(function (x) { " + str + " })"; - var c = clone(otherGlobal.evaluate(code)); - assertEq(c.toSource(), eval(code).toSource()); -} -test('return let (y) x;'); -test('return let (x) "" + x;', 'unicorns', 'undefined'); -test('return let (y = x) (y++, "" + y);', 'unicorns', 'NaN'); -test('return let (y = 1) (y = x, y);'); -test('return let ([] = x) x;'); -test('return let ([, ] = x) x;'); -test('return let ([, , , , ] = x) x;'); -test('return let ([[]] = x) x;'); -test('return let ([[[[[[[[[[[[[]]]]]]]]]]]]] = x) x;'); -test('return let ([[], []] = x) x;'); -test('return let ([[[[]]], [], , [], [[]]] = x) x;'); diff --git a/js/src/jit-test/tests/ion/bug770332.js b/js/src/jit-test/tests/ion/bug770332.js deleted file mode 100644 index d4908e22d58..00000000000 --- a/js/src/jit-test/tests/ion/bug770332.js +++ /dev/null @@ -1,14 +0,0 @@ -function TestCase(n, d, e, a) {} -function reportCompare (expected, actual, description) { - var testcase = new TestCase("unknown-test-name", description, expected, actual); -} -var status = 'Testing scope after changing obj.__proto__'; -function test() { - let ( actual = [ ] ) TestCase .__proto__ = null; - reportCompare (expect, actual, status); -} -var actual = 'error'; -var expect = 'error'; -for (i = 0; i < 12000; i++) { - test(); -} diff --git a/js/src/jit-test/tests/ion/bug827821.js b/js/src/jit-test/tests/ion/bug827821.js deleted file mode 100644 index 4927985ff83..00000000000 --- a/js/src/jit-test/tests/ion/bug827821.js +++ /dev/null @@ -1,32 +0,0 @@ -var lfcode = new Array(); -lfcode.push("3"); -lfcode.push("\ - gczeal(2);\ - for (let q = 0; q < 50; ++q) {\ - var w = \"r\".match(/r/);\ - }\ - let (eval) (function (a) {\ - Function = gczeal;\ - })();\ - // .js\ -"); -lfcode.push(" // .js"); -lfcode.push(" // .js"); -lfcode.push(" // .js"); -while (true) { - var file = lfcode.shift(); if (file == undefined) { break; } - loadFile(file) -} -function loadFile(lfVarx) { - try { - if (lfVarx.substr(-3) == ".js") { - uneval("foo"); - switch (lfRunTypeId) { - case 3: function newFunc(x) { new Function(x)(); }; newFunc(lfVarx); break; - case 4: eval("(function() { " + lfVarx + " })();"); break; - } - } else if (!isNaN(lfVarx)) { - lfRunTypeId = parseInt(lfVarx); - } - } catch (lfVare) {} -} diff --git a/js/src/jit-test/tests/jaeger/bug580703.js b/js/src/jit-test/tests/jaeger/bug580703.js deleted file mode 100644 index 78d85df051a..00000000000 --- a/js/src/jit-test/tests/jaeger/bug580703.js +++ /dev/null @@ -1,9 +0,0 @@ - - -let(w)(function () { - w -}) -let(e)(function () { - e -}) - diff --git a/js/src/jit-test/tests/jaeger/bug591602.js b/js/src/jit-test/tests/jaeger/bug591602.js deleted file mode 100644 index 5dd0b57dac7..00000000000 --- a/js/src/jit-test/tests/jaeger/bug591602.js +++ /dev/null @@ -1,40 +0,0 @@ -try { - for (x in ['']) { - gczeal(2) - } -} catch(e) {} -try { - var x, e - p() -} catch(e) {} -try { (function() { - let(x)((function() { - let(y)((function() { - try { - let(c) o - } finally { (f, [1,2,3]) - } - })) - })) - })() -} catch(e) {} -try { (function() { - if (x.w("", (function() { - t - })())) {} - })() -} catch(e) {} -try { - gczeal() -} catch(e) {} -try { (function() { - for (let w in [0, 0]) let(b)((function() { - let(x = w = [])((function() { - for (let a in []); - })) - })()) - })() -} catch(e) {} - -/* Don't assert with -m only. */ - diff --git a/js/src/js.msg b/js/src/js.msg index bf88dffdd93..35cab46ec6f 100644 --- a/js/src/js.msg +++ b/js/src/js.msg @@ -228,6 +228,7 @@ MSG_DEF(JSMSG_CURLY_AFTER_TRY, 0, JSEXN_SYNTAXERR, "missing } after try MSG_DEF(JSMSG_CURLY_BEFORE_BODY, 0, JSEXN_SYNTAXERR, "missing { before function body") MSG_DEF(JSMSG_CURLY_BEFORE_CATCH, 0, JSEXN_SYNTAXERR, "missing { before catch block") MSG_DEF(JSMSG_CURLY_BEFORE_CLASS, 0, JSEXN_SYNTAXERR, "missing { before class body") +MSG_DEF(JSMSG_CURLY_BEFORE_LET, 0, JSEXN_SYNTAXERR, "missing { before let block") MSG_DEF(JSMSG_CURLY_BEFORE_FINALLY, 0, JSEXN_SYNTAXERR, "missing { before finally block") MSG_DEF(JSMSG_CURLY_BEFORE_SWITCH, 0, JSEXN_SYNTAXERR, "missing { before switch body") MSG_DEF(JSMSG_CURLY_BEFORE_TRY, 0, JSEXN_SYNTAXERR, "missing { before try block") @@ -238,7 +239,6 @@ MSG_DEF(JSMSG_DEPRECATED_DELETE_OPERAND, 0, JSEXN_SYNTAXERR, "applying the 'dele MSG_DEF(JSMSG_DEPRECATED_FLAGS_ARG, 0, JSEXN_NONE, "flags argument of String.prototype.{search,match,replace} is deprecated") MSG_DEF(JSMSG_DEPRECATED_LET_BLOCK, 0, JSEXN_NONE, "JavaScript 1.7's let blocks are deprecated") MSG_DEF(JSMSG_DEPRECATED_FOR_EACH, 0, JSEXN_NONE, "JavaScript 1.6's for-each-in loops are deprecated; consider using ES6 for-of instead") -MSG_DEF(JSMSG_DEPRECATED_LET_EXPRESSION, 0, JSEXN_NONE, "JavaScript 1.7's let expressions are deprecated") MSG_DEF(JSMSG_DEPRECATED_OCTAL, 0, JSEXN_SYNTAXERR, "octal literals and octal escape sequences are deprecated") MSG_DEF(JSMSG_DEPRECATED_PRAGMA, 1, JSEXN_NONE, "Using //@ to indicate {0} pragmas is deprecated. Use //# instead") MSG_DEF(JSMSG_DUPLICATE_FORMAL, 1, JSEXN_SYNTAXERR, "duplicate formal argument {0}") @@ -307,7 +307,6 @@ MSG_DEF(JSMSG_SEMI_AFTER_FOR_INIT, 0, JSEXN_SYNTAXERR, "missing ; after for- MSG_DEF(JSMSG_SEMI_BEFORE_STMNT, 0, JSEXN_SYNTAXERR, "missing ; before statement") MSG_DEF(JSMSG_SOURCE_TOO_LONG, 0, JSEXN_RANGEERR, "source is too long") MSG_DEF(JSMSG_STMT_AFTER_RETURN, 0, JSEXN_SYNTAXERR, "unreachable code after return statement") -MSG_DEF(JSMSG_STRICT_CODE_LET_EXPR_STMT, 0, JSEXN_ERR, "strict mode code may not contain unparenthesized let expression statements") MSG_DEF(JSMSG_STRICT_CODE_WITH, 0, JSEXN_SYNTAXERR, "strict mode code may not contain 'with' statements") MSG_DEF(JSMSG_STRICT_FUNCTION_STATEMENT, 0, JSEXN_SYNTAXERR, "in strict mode code, functions may be declared only at top level or immediately within another function") MSG_DEF(JSMSG_TEMPLSTR_UNTERM_EXPR, 0, JSEXN_SYNTAXERR, "missing } in template string") diff --git a/js/src/jsapi-tests/testXDR.cpp b/js/src/jsapi-tests/testXDR.cpp index 6b19f625168..ab1804848b0 100644 --- a/js/src/jsapi-tests/testXDR.cpp +++ b/js/src/jsapi-tests/testXDR.cpp @@ -43,7 +43,8 @@ BEGIN_TEST(testXDR_bug506491) "function makeClosure(s, name, value) {\n" " eval(s);\n" " Math.sin(value);\n" - " return let (n = name, v = value) function () { return String(v); };\n" + " let n = name, v = value;\n" + " return function () { return String(v); };\n" "}\n" "var f = makeClosure('0;', 'status', 'ok');\n"; diff --git a/js/src/jsast.tbl b/js/src/jsast.tbl index 5b85699fb4f..0cbb719b1fc 100644 --- a/js/src/jsast.tbl +++ b/js/src/jsast.tbl @@ -37,7 +37,6 @@ ASTDEF(AST_THIS_EXPR, "ThisExpression", "thisExpress ASTDEF(AST_COMP_EXPR, "ComprehensionExpression", "comprehensionExpression") ASTDEF(AST_GENERATOR_EXPR, "GeneratorExpression", "generatorExpression") ASTDEF(AST_YIELD_EXPR, "YieldExpression", "yieldExpression") -ASTDEF(AST_LET_EXPR, "LetExpression", "letExpression") ASTDEF(AST_CLASS_EXPR, "ClassExpression", "classExpression") ASTDEF(AST_EMPTY_STMT, "EmptyStatement", "emptyStatement") diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index d3614d83771..661f0086dce 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -586,7 +586,7 @@ struct JSCompartment DeprecatedLegacyGenerator = 2, // JS 1.7+ DeprecatedExpressionClosure = 3, // Added in JS 1.8 DeprecatedLetBlock = 4, // Added in JS 1.7 - DeprecatedLetExpression = 5, // Added in JS 1.7 + // NO LONGER USING 5 DeprecatedNoSuchMethod = 6, // JS 1.7+ DeprecatedFlagsArgument = 7, // JS 1.3 or older RegExpSourceProperty = 8, // ES5 diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index 44877c1e793..6004de8628b 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -681,8 +681,6 @@ class NodeBuilder bool generatorExpression(HandleValue body, NodeVector& blocks, HandleValue filter, bool isLegacy, TokenPos* pos, MutableHandleValue dst); - bool letExpression(NodeVector& head, HandleValue expr, TokenPos* pos, MutableHandleValue dst); - /* * declarations */ @@ -1475,24 +1473,6 @@ NodeBuilder::generatorExpression(HandleValue body, NodeVector& blocks, HandleVal dst); } -bool -NodeBuilder::letExpression(NodeVector& head, HandleValue expr, TokenPos* pos, - MutableHandleValue dst) -{ - RootedValue array(cx); - if (!newArray(head, &array)) - return false; - - RootedValue cb(cx, callbacks[AST_LET_EXPR]); - if (!cb.isNull()) - return callback(cb, array, expr, pos, dst); - - return newNode(AST_LET_EXPR, pos, - "head", array, - "body", expr, - dst); -} - bool NodeBuilder::letStatement(NodeVector& head, HandleValue stmt, TokenPos* pos, MutableHandleValue dst) { @@ -1800,7 +1780,7 @@ class ASTSerializer bool declaration(ParseNode* pn, MutableHandleValue dst); bool variableDeclaration(ParseNode* pn, bool lexical, MutableHandleValue dst); bool variableDeclarator(ParseNode* pn, MutableHandleValue dst); - bool let(ParseNode* pn, bool expr, MutableHandleValue dst); + bool letBlock(ParseNode* pn, MutableHandleValue dst); bool importDeclaration(ParseNode* pn, MutableHandleValue dst); bool importSpecifier(ParseNode* pn, MutableHandleValue dst); bool exportDeclaration(ParseNode* pn, MutableHandleValue dst); @@ -2144,7 +2124,7 @@ ASTSerializer::variableDeclarator(ParseNode* pn, MutableHandleValue dst) } bool -ASTSerializer::let(ParseNode* pn, bool expr, MutableHandleValue dst) +ASTSerializer::letBlock(ParseNode* pn, MutableHandleValue dst) { MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); @@ -2168,11 +2148,8 @@ ASTSerializer::let(ParseNode* pn, bool expr, MutableHandleValue dst) } RootedValue v(cx); - return expr - ? expression(letBody->pn_expr, &v) && - builder.letExpression(dtors, v, &pn->pn_pos, dst) - : statement(letBody->pn_expr, &v) && - builder.letStatement(dtors, v, &pn->pn_pos, dst); + return statement(letBody->pn_expr, &v) && + builder.letStatement(dtors, v, &pn->pn_pos, dst); } bool @@ -2442,7 +2419,7 @@ ASTSerializer::statement(ParseNode* pn, MutableHandleValue dst) return declaration(pn, dst); case PNK_LETBLOCK: - return let(pn, false, dst); + return letBlock(pn, dst); case PNK_LET: case PNK_CONST: @@ -3192,9 +3169,6 @@ ASTSerializer::expression(ParseNode* pn, MutableHandleValue dst) LOCAL_ASSERT(pn->pn_count == 1); return comprehension(pn->pn_head, dst); - case PNK_LETEXPR: - return let(pn, true, dst); - case PNK_CLASS: return classDefinition(pn, true, dst); diff --git a/js/src/tests/js1_7/block/regress-344262.js b/js/src/tests/js1_7/block/regress-344262.js deleted file mode 100644 index 9afad87df12..00000000000 --- a/js/src/tests/js1_7/block/regress-344262.js +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 344262; -var summary = 'Variables bound by let statement/expression'; -var actual = ''; -var expect = 0; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - function f() { - var a = []; - for (var i = 0; i < 10; i++) { - a[i] = let (j = i) function () { return j; }; - var b = []; - for (var k = 0; k <= i; k++) - b.push(a[k]()); - print(b.join()); - } - actual = a[0](); - print(actual); - } - f(); - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/block/regress-345542.js b/js/src/tests/js1_7/block/regress-345542.js deleted file mode 100644 index b0a314e6f89..00000000000 --- a/js/src/tests/js1_7/block/regress-345542.js +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 345542; -var summary = 'Use let in let-scoped loops'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - var f = []; - for (let i = 0; i < 1; i++) f[i] = let (n = i) function () { return n; }; - for (let i = 0; i < 2; i++) f[i] = let (n = i) function () { return n; }; - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/block/regress-349653.js b/js/src/tests/js1_7/block/regress-349653.js deleted file mode 100644 index 75fc086ccf4..00000000000 --- a/js/src/tests/js1_7/block/regress-349653.js +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 349653; -var summary = 'Do not assert: OBJ_GET_CLASS(cx, obj) == &js_ArrayClass'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - void ({y: true ? [1 for (x in [2])] : 3 }) - reportCompare(expect, actual, summary); - - let (a) true ? [2 for each (z in function(id) { return id })] : 3; - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/block/regress-351497.js b/js/src/tests/js1_7/block/regress-351497.js deleted file mode 100644 index a43c249c243..00000000000 --- a/js/src/tests/js1_7/block/regress-351497.js +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 351497; -var summary = 'Do not assert for(let (w) x in y)'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - expect = /SyntaxError: (invalid for\/in left-hand side|missing variable name)/; - try - { - eval('for(let (w) x in y) { }'); - } - catch(ex) - { - actual = ex + ''; - } - - reportMatch(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/block/regress-352185.js b/js/src/tests/js1_7/block/regress-352185.js deleted file mode 100644 index 93b01000a78..00000000000 --- a/js/src/tests/js1_7/block/regress-352185.js +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 352185; -var summary = 'Do not assert on switch with let'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - try - { - eval('switch(let (a) 2) { case 0: let b; }'); - } - catch(ex) - { - // See https://bugzilla.mozilla.org/show_bug.cgi?id=408957 - summary = 'let declaration must be direct child of block or top-level implicit block'; - expect = 'SyntaxError'; - actual = ex.name; - } - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/block/regress-352609.js b/js/src/tests/js1_7/block/regress-352609.js index 1a8d4b477bc..0722d0bcfdb 100644 --- a/js/src/tests/js1_7/block/regress-352609.js +++ b/js/src/tests/js1_7/block/regress-352609.js @@ -21,28 +21,6 @@ function test() printBugNumber(BUGNUMBER); printStatus (summary); - expect = /TypeError: 0 is not a function/; - try - { - [let (x = 3, y = 4) x].map(0); - } - catch(ex) - { - actual = ex + ''; - } - reportMatch(expect, actual, '[let (x = 3, y = 4) x].map(0)'); - - expect = /TypeError: (p.z = \[let \(x = 3, y = 4\) x\]|.*Array.*) is not a function/; - try - { - var p = {}; (p.z = [let (x = 3, y = 4) x])(); - } - catch(ex) - { - actual = ex + ''; - } - reportMatch(expect, actual, 'p = {}; (p.z = [let (x = 3, y = 4) x])()'); - expect = /TypeError: (p.z = \(let \(x\) x\)|.*Undefined.*) is not a function/; try { diff --git a/js/src/tests/js1_7/block/regress-352616.js b/js/src/tests/js1_7/block/regress-352616.js deleted file mode 100644 index a1cb4ba0c22..00000000000 --- a/js/src/tests/js1_7/block/regress-352616.js +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 352616; -var summary = 'Do not Crash reporting error with |for..in| and |let|'; -var actual = 'No Crash'; -var expect = 'No Crash'; - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - expect = /TypeError: (.+\.c is not a function|Cannot find function c.)/; - actual = 'No Error'; - try - { - for(a in (let (b=1) 2).c(3)) { }; - } - catch(ex) - { - actual = ex + ''; - } - - reportMatch(expect, actual, summary + ': 1'); - - expect = /TypeError: (.+\.c is not a function|Cannot find function c.)/; - actual = 'No Error'; - try - { - for(a in (let (b=1,d=2) 2).c(3)) { }; - } - catch(ex) - { - actual = ex + ''; - } - - reportMatch(expect, actual, summary + ': 2'); - - expect = /TypeError: (.+\.c is not a function|Cannot find function c.)/; - actual = 'No Error'; - try - { - for(a in (let (b=1,d=2) 2).c(3)) { }; - } - catch(ex) - { - actual = ex + ''; - } - - reportMatch(expect, actual, summary + ': 3'); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/block/regress-352624.js b/js/src/tests/js1_7/block/regress-352624.js index 1592bb39317..73846637f6f 100644 --- a/js/src/tests/js1_7/block/regress-352624.js +++ b/js/src/tests/js1_7/block/regress-352624.js @@ -20,13 +20,10 @@ function test() printBugNumber(BUGNUMBER); printStatus (summary); printStatus('This bug can only be verified with a WAY_TOO_MUCH_GC build'); - + let (x = [].map(function () {})) { x; } reportCompare(expect, actual, summary + ': 1'); - let (x = [].map(function () {})) 3 - reportCompare(expect, actual, summary + ': 2'); - var g = function() {}; (function() { let x = [].map(function () {}); g(x); })() reportCompare(expect, actual, summary + ': 3'); diff --git a/js/src/tests/js1_7/expressions/regress-349624.js b/js/src/tests/js1_7/expressions/regress-349624.js deleted file mode 100644 index 18e810bc2aa..00000000000 --- a/js/src/tests/js1_7/expressions/regress-349624.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 349624; -var summary = 'let in initial-value expression for another let'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - let(y = let (x) 4) 3 - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/expressions/regress-349818.js b/js/src/tests/js1_7/expressions/regress-349818.js deleted file mode 100644 index 53418a7b326..00000000000 --- a/js/src/tests/js1_7/expressions/regress-349818.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 349818; -var summary = 'let expression should not assert'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - let (x=3) x; - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/expressions/regress-421806.js b/js/src/tests/js1_7/expressions/regress-421806.js deleted file mode 100644 index b993361b641..00000000000 --- a/js/src/tests/js1_7/expressions/regress-421806.js +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 421806; -var summary = 'Do not assert: *pcstack[pcdepth - 1] == JSOP_ENTERBLOCK'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - try - { - let([] = c) 1; - } - catch(ex) - { - try - { - this.a.b; - } - catch(ex2) - { - } - } - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/extensions/regress-353454.js b/js/src/tests/js1_7/extensions/regress-353454.js deleted file mode 100644 index f4dddbfbe58..00000000000 --- a/js/src/tests/js1_7/extensions/regress-353454.js +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 353454; -var summary = 'Do not assert with regexp iterator'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - actual = "no exception"; - try - { - expect = 'TypeError'; - var obj = {a: 5}; obj.__iterator__ = /x/g; for(x in y = let (z) obj) { } - } - catch(ex) - { - actual = ex instanceof TypeError ? 'TypeError' : "" + ex; - } - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/lexical/regress-346642-03.js b/js/src/tests/js1_7/lexical/regress-346642-03.js index e08f45e58ff..14f36648b0f 100644 --- a/js/src/tests/js1_7/lexical/regress-346642-03.js +++ b/js/src/tests/js1_7/lexical/regress-346642-03.js @@ -107,18 +107,6 @@ function test() } reportCompare(expect, actual, summary + ': 7'); - expect = 'TypeError: ++x is not a function'; - actual = 'No Crash'; - try - { - let (x=3) ((++x)()) - } - catch(ex) - { - actual = ex + ''; - } - reportCompare(expect, actual, summary + ': 8'); - expect = 'ReferenceError: x.y is not defined'; actual = 'No Crash'; try diff --git a/js/src/tests/js1_7/regress/regress-352870-02.js b/js/src/tests/js1_7/regress/regress-352870-02.js deleted file mode 100644 index bfe9c07c9f6..00000000000 --- a/js/src/tests/js1_7/regress/regress-352870-02.js +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 352870; -var summary = 'Do not assert for crazy huge testcases'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - expect = /TypeError: .+\.g (has no properties|is undefined)/; - actual = ''; - try - { - switch(4) { case [(let (y = [].j(5)) ({})) - for (p in ([1,2,3,4].g).v({},((w).y(z, [1]))))]: } } - catch(ex) - { - actual = ex + ''; - } - reportMatch(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/regress/regress-361566.js b/js/src/tests/js1_7/regress/regress-361566.js deleted file mode 100644 index f3bfcc751f4..00000000000 --- a/js/src/tests/js1_7/regress/regress-361566.js +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 361566; -var summary = 'Do not assert: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain'; -var actual = ''; -var expect = ''; - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - try { let([] = z) 3; } catch(ex) { } - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/regress/regress-373828.js b/js/src/tests/js1_7/regress/regress-373828.js deleted file mode 100644 index dd853e91943..00000000000 --- a/js/src/tests/js1_7/regress/regress-373828.js +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 373828; -var summary = 'Do not assert: op == JSOP_LEAVEBLOCKEXPR ? ' + - 'fp->spbase + OBJ_BLOCK_DEPTH(cx, obj) == sp - 1 : fp->spbase + OBJ_BLOCK_DEPTH(cx, obj) == sp'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - try - { - for(let y in [5,6]) let([] = [1]) (function(){ }); d; - } - catch(ex) - { - } - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/regress/regress-387951.js b/js/src/tests/js1_7/regress/regress-387951.js deleted file mode 100644 index 9f189791120..00000000000 --- a/js/src/tests/js1_7/regress/regress-387951.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 387951; -var summary = 'Do not assert: cg->stackDepth >= 0'; -var actual = 'No Crash'; -var expect = 'No Crash'; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - with(delete let (functional) null ? 1 : {}){} - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_7/regress/regress-414553.js b/js/src/tests/js1_7/regress/regress-414553.js index e053034436e..6a1530fd95a 100644 --- a/js/src/tests/js1_7/regress/regress-414553.js +++ b/js/src/tests/js1_7/regress/regress-414553.js @@ -9,7 +9,9 @@ printBugNumber(BUGNUMBER); printStatus(summary); var expected = '1,2,3,4'; -var actual = let (a = 1, [b,c] = [2,3], d = 4) ( String([a,b,c,d]) ); + +let a = 1, [b,c] = [2,3], d = 4; +var actual = String([a,b,c,d]); reportCompare(expected, actual, 'destructuring assignment in let'); diff --git a/js/src/tests/js1_7/regress/regress-420399.js b/js/src/tests/js1_7/regress/regress-420399.js deleted file mode 100644 index 90fecb11aa5..00000000000 --- a/js/src/tests/js1_7/regress/regress-420399.js +++ /dev/null @@ -1,37 +0,0 @@ -// |reftest| skip -- obsolete test -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 420399; -var summary = 'Let expression error involving undefined'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - expect = /TypeError: \(let \(a = undefined\) a\) (is undefined|has no properties)/; - try - { - (let (a=undefined) a).b = 3; - } - catch(ex) - { - actual = ex + ''; - } - - reportMatch(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8/genexps/regress-380237-04.js b/js/src/tests/js1_8/genexps/regress-380237-04.js index 6060a064fe2..9276cb119b4 100644 --- a/js/src/tests/js1_8/genexps/regress-380237-04.js +++ b/js/src/tests/js1_8/genexps/regress-380237-04.js @@ -51,8 +51,6 @@ needParens(13, "for (;;xx) { }"); needParens(14, "for (i in xx) { }"); needParens(15, "throw xx"); needParens(16, "try { } catch (e if xx) { }"); -needParens(17, "let (x=3) xx"); -needParens(18, "let (x=xx) 3"); // Function calls doesNotNeedParens(19, "f(xx);"); diff --git a/js/src/tests/js1_8/genexps/regress-667131.js b/js/src/tests/js1_8/genexps/regress-667131.js index f3f774e6c61..74817bbeec0 100644 --- a/js/src/tests/js1_8/genexps/regress-667131.js +++ b/js/src/tests/js1_8/genexps/regress-667131.js @@ -3,7 +3,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - //----------------------------------------------------------------------------- var BUGNUMBER = 667131; var summary = 'yield ignored if maybeNoteLegacyGenerator called too late'; @@ -19,18 +18,10 @@ function reported1() { (function(){})([yield[]], ("")) } -function reported2() { - (function(){})(let(w = "") yield, (e)) -} - function simplified1() { print([yield], (0)) } -function simplified2() { - print(let(w) yield, (0)) -} - function f1(a) { [x for (x in yield) for (y in (a))] } function f2(a) { [x for (x in yield) if (y in (a))] } function f3(a) { ([x for (x in yield) for (y in (a))]) } @@ -39,16 +30,12 @@ function f4(a) { ([x for (x in yield) if (y in (a))]) } function f7() { print({a:yield},(0)) } function f8() { ([yield], (0)) } -function f9() { (let(w)yield, (0)) } testGenerator(reported1, "reported function with array literal"); -testGenerator(reported2, "reported function with let-expression"); testGenerator(simplified1, "reported function with array literal, simplified"); -testGenerator(simplified2, "reported function with let-expression, simplified"); testGenerator(f1, "top-level array comprehension with paren expr in for-block"); testGenerator(f2, "top-level array comprehension with paren expr in if-block"); testGenerator(f3, "parenthesized array comprehension with paren expr in for-block"); testGenerator(f4, "parenthesized array comprehension with paren expr in if-block"); testGenerator(f7, "object literal"); testGenerator(f8, "array literal in paren exp"); -testGenerator(f9, "let-expression in paren exp"); diff --git a/js/src/tests/js1_8/regress/regress-453492.js b/js/src/tests/js1_8/regress/regress-453492.js deleted file mode 100644 index f7068d12070..00000000000 --- a/js/src/tests/js1_8/regress/regress-453492.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 453492; -var summary = 'Do not assert: op == JSOP_ENUMELEM || op == JSOP_ENUMCONSTELEM'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - print(function() { [(let(a)1)[2]] = 3; }); - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8/regress/regress-464092-01.js b/js/src/tests/js1_8/regress/regress-464092-01.js deleted file mode 100644 index d4176b37ad6..00000000000 --- a/js/src/tests/js1_8/regress/regress-464092-01.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 464092; -var summary = 'Do not assert: OBJ_IS_CLONED_BLOCK(obj)'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - let (a) 'b'.replace(/b/g, function() { c = this; }); c.d = 3; c.d; - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8/regress/regress-464092-02.js b/js/src/tests/js1_8/regress/regress-464092-02.js deleted file mode 100644 index f899ff3c612..00000000000 --- a/js/src/tests/js1_8/regress/regress-464092-02.js +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 464092; -var summary = 'Censor block objects'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - try - { - let (a) 'b'.replace(/b/g, function() c = this ); - } - catch(ex) - { - actual = ex + ''; - } - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8/regress/regress-472528-01.js b/js/src/tests/js1_8/regress/regress-472528-01.js deleted file mode 100644 index 258eb5c2504..00000000000 --- a/js/src/tests/js1_8/regress/regress-472528-01.js +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 472528; -var summary = 'Do not assert: !js_IsActiveWithOrBlock(cx, fp->scopeChain, 0)'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - jit(true); - - try - { - for (var i = 0; i < 4; ++i) { - for (let j = 0; j < 2; ++j) { } - let (x) (function(){}); - } - } - catch(ex) - { - } - jit(false); - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8/regress/regress-472528-02.js b/js/src/tests/js1_8/regress/regress-472528-02.js deleted file mode 100644 index 50327f3196e..00000000000 --- a/js/src/tests/js1_8/regress/regress-472528-02.js +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 472528; -var summary = 'Do not assert: !fp->blockChain'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - jit(true); - - try - { - for (let i = 0; i < 4; ++i) { - for (let j = 0; j < 2; ++j) { } - let (x) (function(){}); - } - } - catch(ex) - { - } - jit(false); - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8/regress/regress-472703.js b/js/src/tests/js1_8/regress/regress-472703.js deleted file mode 100644 index 42041ea5871..00000000000 --- a/js/src/tests/js1_8/regress/regress-472703.js +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 472703; -var summary = 'Do not assert: regs.sp[-1] == OBJECT_TO_JSVAL(fp->scopeChain)'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - jit(true); - - try - { - eval( - 'for (var z = 0; z < 2; ++z) { with({}) for(let y in [1, null]); let(x)' + - '(function(){})(); }' - ); - } - catch(ex) - { - } - jit(false); - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8_1/regress/regress-420399.js b/js/src/tests/js1_8_1/regress/regress-420399.js deleted file mode 100644 index c3d11e87607..00000000000 --- a/js/src/tests/js1_8_1/regress/regress-420399.js +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 420399; -var summary = 'Let expression error involving undefined'; -var actual = ''; -var expect = ''; - - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - - expect = "TypeError: a is undefined"; - try - { - (let (a=undefined) a).b = 3; - } - catch(ex) - { - actual = ex + ''; - } - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8_1/regress/regress-452498-054.js b/js/src/tests/js1_8_1/regress/regress-452498-054.js index b9d2d454ed6..562c454023a 100644 --- a/js/src/tests/js1_8_1/regress/regress-452498-054.js +++ b/js/src/tests/js1_8_1/regress/regress-452498-054.js @@ -31,11 +31,6 @@ function test() function f() { var x; eval("let x, x;"); } f(); -// Assertion failure: fp2->fun && fp2->script, -// at ../jsinterp.cpp:5589 -// - eval("let(x) function(){ x = this; }()"); - reportCompare(expect, actual, summary); exitFunc ('test'); diff --git a/js/src/tests/js1_8_1/regress/regress-452498-068.js b/js/src/tests/js1_8_1/regress/regress-452498-068.js index 352ada492c6..26131310306 100644 --- a/js/src/tests/js1_8_1/regress/regress-452498-068.js +++ b/js/src/tests/js1_8_1/regress/regress-452498-068.js @@ -43,13 +43,6 @@ function test() (function(q){return q;} for each (\u3056 in [])) -// ===== - - for( - const NaN = undefined; - this.__defineSetter__("x4", function(){}); - (eval("", (p={})))) let ({} = (((x ))(function ([]) {})), x1) y; - // ===== function f(){ var c; eval("{var c = NaN, c;}"); } diff --git a/js/src/tests/js1_8_1/regress/regress-452498-082.js b/js/src/tests/js1_8_1/regress/regress-452498-082.js index 7ade6db63e9..2327a02cbb9 100644 --- a/js/src/tests/js1_8_1/regress/regress-452498-082.js +++ b/js/src/tests/js1_8_1/regress/regress-452498-082.js @@ -72,21 +72,6 @@ function test() { } -// ===== - - if (typeof window == 'undefined') - global = this; - else - global = window; - - try - { - eval('(function(){with(global){1e-81; }for(let [x, x3] = global -= x in []) function(){}})();'); - } - catch(ex) - { - } - // ===== try { @@ -114,11 +99,6 @@ function test() { } -// ===== - - var f = new Function("try { with({}) x = x; } catch(\u3056 if (function(){x = x2;})()) { let([] = [1.2e3.valueOf(\"number\")]) ((function(){})()); } "); - "" + f; - // ===== var f = new Function("[] = [( '' )()];"); diff --git a/js/src/tests/js1_8_1/regress/regress-452498-130.js b/js/src/tests/js1_8_1/regress/regress-452498-130.js index 33f5673ffc5..f2f578e3e09 100644 --- a/js/src/tests/js1_8_1/regress/regress-452498-130.js +++ b/js/src/tests/js1_8_1/regress/regress-452498-130.js @@ -26,20 +26,6 @@ function test() // ===== ((function x()x in []) for (y in [])) -//Assertion failure: lexdep->frameLevel() <= funbox->level, at ../jsparse.cpp:1778 -// Opt crash [@ JSCompiler::setFunctionKinds] -// ===== - let(x=[]) function(){try {x} catch(x) {} } - -// Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:2034 -// ===== - try - { - eval('for(let [y] = (let (x) (y)) in []) function(){}'); - } - catch(ex) - { - } // Assertion failure: !(pnu->pn_dflags & PND_BOUND), at ../jsemit.cpp:1818 // ===== diff --git a/js/src/tests/js1_8_1/regress/regress-452498-178.js b/js/src/tests/js1_8_1/regress/regress-452498-178.js deleted file mode 100644 index a689e2a589c..00000000000 --- a/js/src/tests/js1_8_1/regress/regress-452498-178.js +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -//----------------------------------------------------------------------------- -var BUGNUMBER = 452498; -var summary = 'TM: upvar2 regression tests'; -var actual = ''; -var expect = ''; - -//------- Comment #178 From Gary Kwong - -//----------------------------------------------------------------------------- -test(); -//----------------------------------------------------------------------------- - -function test() -{ - enterFunc ('test'); - printBugNumber(BUGNUMBER); - printStatus (summary); - -// Assertion failure: slot < fp2->script->nfixed, at ../jsinterp.cpp:5610 - - eval("with({}) let(x=[])(function(){x})()"); - - reportCompare(expect, actual, summary); - - exitFunc ('test'); -} diff --git a/js/src/tests/js1_8_5/extensions/regress-668438.js b/js/src/tests/js1_8_5/extensions/regress-668438.js deleted file mode 100644 index eb221b36d00..00000000000 --- a/js/src/tests/js1_8_5/extensions/regress-668438.js +++ /dev/null @@ -1,12 +0,0 @@ -// -*- indent-tabs-mode: nil; js-indent-level: 4 -*- -// Any copyright is dedicated to the Public Domain. -// http://creativecommons.org/licenses/publicdomain/ - -// Don't assert trying to parse this. -let(x = (x(( function() { - return { e: function() { e in x } }; - })) - for (x in []))) -true; - -reportCompare(true, true); diff --git a/js/src/tests/js1_8_5/reflect-parse/PatternBuilders.js b/js/src/tests/js1_8_5/reflect-parse/PatternBuilders.js index 24326776065..a4c0d3e899b 100644 --- a/js/src/tests/js1_8_5/reflect-parse/PatternBuilders.js +++ b/js/src/tests/js1_8_5/reflect-parse/PatternBuilders.js @@ -232,9 +232,6 @@ function genExpr(body, blocks, filter, style) { function graphExpr(idx, body) { return Pattern({ type: "GraphExpression", index: idx, expression: body }); } -function letExpr(head, body) { - return Pattern({ type: "LetExpression", head: head, body: body }); -} function idxExpr(idx) { return Pattern({ type: "GraphIndexExpression", index: idx }); } diff --git a/js/src/tests/js1_8_5/reflect-parse/alternateBuilder.js b/js/src/tests/js1_8_5/reflect-parse/alternateBuilder.js index a5bf791783f..74f0e3e4eeb 100644 --- a/js/src/tests/js1_8_5/reflect-parse/alternateBuilder.js +++ b/js/src/tests/js1_8_5/reflect-parse/alternateBuilder.js @@ -138,7 +138,6 @@ return { comprehensionExpression: reject, generatorExpression: reject, yieldExpression: reject, - letExpression: reject, emptyStatement: () => ["EmptyStmt", {}], blockStatement: function(stmts) { diff --git a/js/src/tests/js1_8_5/reflect-parse/basicBuilder.js b/js/src/tests/js1_8_5/reflect-parse/basicBuilder.js index a2bc120dabe..5d25e98a721 100644 --- a/js/src/tests/js1_8_5/reflect-parse/basicBuilder.js +++ b/js/src/tests/js1_8_5/reflect-parse/basicBuilder.js @@ -42,7 +42,6 @@ assertGlobalExpr("this", 14, { thisExpression: () => 14 }); assertGlobalExpr("[x for (x in y)]", 17, { comprehensionExpression: () => 17 }); assertGlobalExpr("(x for (x in y))", 18, { generatorExpression: () => 18 }); assertGlobalExpr("(function() { yield 42 })", genFunExpr(null, [], blockStmt([exprStmt(19)])), { yieldExpression: () => 19 }); -assertGlobalExpr("(let (x) x)", 20, { letExpression: () => 20 }); assertGlobalStmt("switch (x) { case y: }", switchStmt(ident("x"), [1]), { switchCase: () => 1 }); assertGlobalStmt("try { } catch (e) { }", 2, { tryStatement: (b, g, u, f) => u, catchClause: () => 2 }); diff --git a/js/src/tests/js1_8_5/reflect-parse/lexicals.js b/js/src/tests/js1_8_5/reflect-parse/lexicals.js index 22a67130e9e..1b29c78d6ff 100644 --- a/js/src/tests/js1_8_5/reflect-parse/lexicals.js +++ b/js/src/tests/js1_8_5/reflect-parse/lexicals.js @@ -14,30 +14,6 @@ assertBlockDecl("let {x:y} = foo;", letDecl([{ id: objPatt([assignProp("x", iden assertDecl("const {x:y} = foo;", constDecl([{ id: objPatt([assignProp("x", ident("y"))]), init: ident("foo") }])); - -// let expressions - -assertExpr("(let (x=1) x)", letExpr([{ id: ident("x"), init: lit(1) }], ident("x"))); -assertExpr("(let (x=1,y=2) y)", letExpr([{ id: ident("x"), init: lit(1) }, - { id: ident("y"), init: lit(2) }], - ident("y"))); -assertExpr("(let (x=1,y=2,z=3) z)", letExpr([{ id: ident("x"), init: lit(1) }, - { id: ident("y"), init: lit(2) }, - { id: ident("z"), init: lit(3) }], - ident("z"))); -assertExpr("(let (x) x)", letExpr([{ id: ident("x"), init: null }], ident("x"))); -assertExpr("(let (x,y) y)", letExpr([{ id: ident("x"), init: null }, - { id: ident("y"), init: null }], - ident("y"))); -assertExpr("(let (x,y,z) z)", letExpr([{ id: ident("x"), init: null }, - { id: ident("y"), init: null }, - { id: ident("z"), init: null }], - ident("z"))); -assertExpr("(let (x = 1, y = x) y)", letExpr([{ id: ident("x"), init: lit(1) }, - { id: ident("y"), init: ident("x") }], - ident("y"))); -assertError("(let (x = 1, x = 2) x)", TypeError); - // let statements assertStmt("let (x=1) { }", letStmt([{ id: ident("x"), init: lit(1) }], blockStmt([]))); diff --git a/js/src/tests/js1_8_5/regress/regress-569464.js b/js/src/tests/js1_8_5/regress/regress-569464.js deleted file mode 100644 index 2ece14cacd5..00000000000 --- a/js/src/tests/js1_8_5/regress/regress-569464.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/licenses/publicdomain/ - * Contributor: Dave Herman - */ - -function earlyError(src) { - var threw; - try { - eval(src); - threw = false; - } catch (expected) { - threw = true; - } - assertEq(threw, true); -} - -earlyError("'use strict'; let (x) 42;"); -earlyError("function f() { 'use strict'; let (x) 42;"); -earlyError("'use strict'; function id(x) { return x } let (a=1) a ? f : x++(42);"); -earlyError("function id(x) { return x } function f() { 'use strict'; let (a=1) a ? f : x++(42); }"); -earlyError("'use strict'; let (x=2, y=3) x=3, y=13"); -earlyError("function f() { 'use strict'; let (x=2, y=3) x=3, y=13 }"); - -x = "global"; -(let (x=2, y=3) x=3, y=13); -assertEq(x, "global"); -assertEq(y, 13); - -// https://bugzilla.mozilla.org/show_bug.cgi?id=569464#c12 -g = (let (x=7) x*x for each (x in [1,2,3])); -for (let y in g) { - assertEq(y, 49); -} - -reportCompare(0, 0, "In strict mode, let expression statements are disallowed."); diff --git a/js/src/tests/js1_8_5/regress/regress-592202-1.js b/js/src/tests/js1_8_5/regress/regress-592202-1.js deleted file mode 100644 index bbed53021ba..00000000000 --- a/js/src/tests/js1_8_5/regress/regress-592202-1.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/licenses/publicdomain/ - */ -i = 42; -eval("let (y) { \n" + - " (function() { \n" + - " let ({} = (y, {})) { \n" + - " (function() { \n" + - " let ({} = y = []) (i); \n" + - " })(); \n" + - " } \n" + - " })(); \n" + - "}"); -reportCompare(0, 0, "ok"); diff --git a/js/src/tests/js1_8_5/regress/regress-592202-2.js b/js/src/tests/js1_8_5/regress/regress-592202-2.js deleted file mode 100644 index e328d8f3226..00000000000 --- a/js/src/tests/js1_8_5/regress/regress-592202-2.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/licenses/publicdomain/ - */ -eval("\ - let(b)((\ - function(){\ - let(d=b)\ - ((function(){\ - b=b\ - })())\ - }\ - )())\ -") -reportCompare(0, 0, "ok"); diff --git a/js/src/tests/js1_8_5/regress/regress-600137.js b/js/src/tests/js1_8_5/regress/regress-600137.js deleted file mode 100644 index 41fb83a2f29..00000000000 --- a/js/src/tests/js1_8_5/regress/regress-600137.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/licenses/publicdomain/ - */ - -if (typeof evalcx == 'function') { - var src = 'try {\n' + - ' for (var [e] in d) {\n' + - ' (function () {});\n' + - ' }\n' + - '} catch (e) {}\n' + - 'try {\n' + - ' let(x = Object.freeze(this, /x/))\n' + - ' e = {}.toString\n' + - ' function y() {}\n' + - '} catch (e) {}'; - - evalcx(src); -} - -reportCompare(0, 0, "don't crash"); diff --git a/js/src/tests/js1_8_5/regress/regress-673070-1.js b/js/src/tests/js1_8_5/regress/regress-673070-1.js index 9545f4810a3..b6158330515 100644 --- a/js/src/tests/js1_8_5/regress/regress-673070-1.js +++ b/js/src/tests/js1_8_5/regress/regress-673070-1.js @@ -2,7 +2,8 @@ // http://creativecommons.org/licenses/publicdomain/ var q = [2]; -let ([q] = eval("q")) +let ([q] = eval("q")) { assertEq(q, 2); +} reportCompare(0, 0, 'ok'); diff --git a/js/src/tests/js1_8_5/regress/regress-673070-2.js b/js/src/tests/js1_8_5/regress/regress-673070-2.js index ddd279eb95f..65529265ee6 100644 --- a/js/src/tests/js1_8_5/regress/regress-673070-2.js +++ b/js/src/tests/js1_8_5/regress/regress-673070-2.js @@ -2,7 +2,8 @@ // http://creativecommons.org/licenses/publicdomain/ var q = 1; -let ([q] = [eval("q")]) +let ([q] = [eval("q")]) { assertEq(q, 1); +} reportCompare(0, 0, 'ok'); diff --git a/js/src/vm/Xdr.h b/js/src/vm/Xdr.h index b2aea741ee4..ecf6ed833dd 100644 --- a/js/src/vm/Xdr.h +++ b/js/src/vm/Xdr.h @@ -29,11 +29,11 @@ namespace js { * * https://developer.mozilla.org/en-US/docs/SpiderMonkey/Internals/Bytecode */ -static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 283; +static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 284; static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - XDR_BYTECODE_VERSION_SUBTRAHEND); -static_assert(JSErr_Limit == 394, +static_assert(JSErr_Limit == 393, "GREETINGS, POTENTIAL SUBTRAHEND INCREMENTER! If you added or " "removed MSG_DEFs from js.msg, you should increment " "XDR_BYTECODE_VERSION_SUBTRAHEND and update this assertion's "