OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2386 // Destructuring binding and assignment are both disallowed | 2386 // Destructuring binding and assignment are both disallowed |
2387 "var [yield] = [42];", | 2387 "var [yield] = [42];", |
2388 "var {foo: yield} = {a: 42};", | 2388 "var {foo: yield} = {a: 42};", |
2389 "[yield] = [42];", | 2389 "[yield] = [42];", |
2390 "({a: yield} = {a: 42});", | 2390 "({a: yield} = {a: 42});", |
2391 // Also disallow full yield expressions on LHS | 2391 // Also disallow full yield expressions on LHS |
2392 "var [yield 24] = [42];", | 2392 "var [yield 24] = [42];", |
2393 "var {foo: yield 24} = {a: 42};", | 2393 "var {foo: yield 24} = {a: 42};", |
2394 "[yield 24] = [42];", | 2394 "[yield 24] = [42];", |
2395 "({a: yield 24} = {a: 42});", | 2395 "({a: yield 24} = {a: 42});", |
| 2396 "for (yield 'x' in {});", |
| 2397 "for (yield 'x' of {});", |
| 2398 "for (yield 'x' in {} in {});", |
| 2399 "for (yield 'x' in {} of {});", |
2396 NULL | 2400 NULL |
2397 }; | 2401 }; |
2398 // clang-format on | 2402 // clang-format on |
2399 | 2403 |
2400 RunParserSyncTest(context_data, statement_data, kError); | 2404 RunParserSyncTest(context_data, statement_data, kError); |
2401 } | 2405 } |
2402 | 2406 |
2403 | 2407 |
2404 TEST(ErrorsNameOfStrictFunction) { | 2408 TEST(ErrorsNameOfStrictFunction) { |
2405 // Tests that illegal tokens as names of a strict function produce the correct | 2409 // Tests that illegal tokens as names of a strict function produce the correct |
(...skipping 4854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7260 // "Array() **= 10", | 7264 // "Array() **= 10", |
7261 NULL | 7265 NULL |
7262 }; | 7266 }; |
7263 // clang-format on | 7267 // clang-format on |
7264 | 7268 |
7265 static const ParserFlag always_flags[] = { | 7269 static const ParserFlag always_flags[] = { |
7266 kAllowHarmonyExponentiationOperator}; | 7270 kAllowHarmonyExponentiationOperator}; |
7267 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, | 7271 RunParserSyncTest(context_data, error_data, kError, NULL, 0, always_flags, |
7268 arraysize(always_flags)); | 7272 arraysize(always_flags)); |
7269 } | 7273 } |
OLD | NEW |