Chromium Code Reviews| Index: test/mjsunit/harmony/iteration-syntax.js |
| diff --git a/test/mjsunit/regress/regress-2489.js b/test/mjsunit/harmony/iteration-syntax.js |
| similarity index 60% |
| copy from test/mjsunit/regress/regress-2489.js |
| copy to test/mjsunit/harmony/iteration-syntax.js |
| index 882c4f794a88e24d1d64e86a466b27c39f51e625..64356478d13012e25cd833a5af498f40d2152676 100644 |
| --- a/test/mjsunit/regress/regress-2489.js |
| +++ b/test/mjsunit/harmony/iteration-syntax.js |
| @@ -25,26 +25,34 @@ |
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| -// Flags: --allow-natives-syntax |
| +// Flags: --harmony-iteration --harmony-scoping |
| + |
| +// Test for-of syntax. |
| "use strict"; |
| -function f(a, b) { |
| - return g("c", "d"); |
| -} |
| - |
| -function g(a, b) { |
| - g.constructor.apply(this, arguments); |
| -} |
| - |
| -g.constructor = function(a, b) { |
| - assertEquals("c", a); |
| - assertEquals("d", b); |
| -} |
| - |
| -f("a", "b"); |
| -f("a", "b"); |
| -%OptimizeFunctionOnNextCall(f); |
| -f("a", "b"); |
| -g.x = "deopt"; |
| -f("a", "b"); |
| +function f() { for (x of y) { } } |
| +function f() { for (var x of y) { } } |
| +function f() { for (let x of y) { } } |
| + |
| +assertThrows("function f() { for (x of) { } }", SyntaxError); |
| +assertThrows("function f() { for (x of y z) { } }", SyntaxError); |
| +assertThrows("function f() { for (x of y;) { } }", SyntaxError); |
| + |
| +assertThrows("function f() { for (var x of) { } }", SyntaxError); |
| +assertThrows("function f() { for (var x of y z) { } }", SyntaxError); |
| +assertThrows("function f() { for (var x of y;) { } }", SyntaxError); |
| + |
| +assertThrows("function f() { for (let x of) { } }", SyntaxError); |
| +assertThrows("function f() { for (let x of y z) { } }", SyntaxError); |
| +assertThrows("function f() { for (let x of y;) { } }", SyntaxError); |
| + |
| +// Alack, this appears to be valid. |
|
rossberg
2013/06/06 10:32:33
However, "for (of x)" or "for (of of)" shouldn't b
wingo
2013/06/06 14:09:51
Done.
|
| +function f() { for (of of y) { } } |
| +function f() { for (let of of y) { } } |
| +function f() { for (var of of y) { } } |
| + |
| +// This too, of course. |
| +function f() { for (of in y) { } } |
| +function f() { for (var of in y) { } } |
| +function f() { for (let of in y) { } } |