michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 667131; michael@0: var summary = 'yield ignored if maybeNoteLegacyGenerator called too late'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: function testGenerator(f, desc) { michael@0: reportCompare(f.isGenerator(), true, desc + ": is generator"); michael@0: reportCompare(typeof f(), "object", desc + ": calling doesn't crash"); michael@0: } michael@0: michael@0: function reported1() { michael@0: (function(){})([yield[]], ("")) michael@0: } michael@0: michael@0: function reported2() { michael@0: (function(){})(let(w = "") yield, (e)) michael@0: } michael@0: michael@0: function simplified1() { michael@0: print([yield], (0)) michael@0: } michael@0: michael@0: function simplified2() { michael@0: print(let(w) yield, (0)) michael@0: } michael@0: michael@0: function f1(a) { [x for (x in yield) for (y in (a))] } michael@0: function f2(a) { [x for (x in yield) if (y in (a))] } michael@0: function f3(a) { ([x for (x in yield) for (y in (a))]) } michael@0: function f4(a) { ([x for (x in yield) if (y in (a))]) } michael@0: michael@0: function f7() { print({a:yield},(0)) } michael@0: michael@0: function f8() { ([yield], (0)) } michael@0: function f9() { (let(w)yield, (0)) } michael@0: michael@0: testGenerator(reported1, "reported function with array literal"); michael@0: testGenerator(reported2, "reported function with let-expression"); michael@0: testGenerator(simplified1, "reported function with array literal, simplified"); michael@0: testGenerator(simplified2, "reported function with let-expression, simplified"); michael@0: testGenerator(f1, "top-level array comprehension with paren expr in for-block"); michael@0: testGenerator(f2, "top-level array comprehension with paren expr in if-block"); michael@0: testGenerator(f3, "parenthesized array comprehension with paren expr in for-block"); michael@0: testGenerator(f4, "parenthesized array comprehension with paren expr in if-block"); michael@0: testGenerator(f7, "object literal"); michael@0: testGenerator(f8, "array literal in paren exp"); michael@0: testGenerator(f9, "let-expression in paren exp");