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 6496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6507 TEST(DestructuringPositiveTests) { | 6507 TEST(DestructuringPositiveTests) { |
6508 i::FLAG_harmony_destructuring = true; | 6508 i::FLAG_harmony_destructuring = true; |
6509 | 6509 |
6510 const char* context_data[][2] = {{"'use strict'; let ", " = {};"}, | 6510 const char* context_data[][2] = {{"'use strict'; let ", " = {};"}, |
6511 {"var ", " = {};"}, | 6511 {"var ", " = {};"}, |
6512 {"'use strict'; const ", " = {};"}, | 6512 {"'use strict'; const ", " = {};"}, |
6513 {"function f(", ") {}"}, | 6513 {"function f(", ") {}"}, |
6514 {"function f(argument1, ", ") {}"}, | 6514 {"function f(argument1, ", ") {}"}, |
6515 {"var f = (", ") => {};"}, | 6515 {"var f = (", ") => {};"}, |
6516 {"var f = (argument1,", ") => {};"}, | 6516 {"var f = (argument1,", ") => {};"}, |
| 6517 {"try {} catch(", ") {}"}, |
6517 {NULL, NULL}}; | 6518 {NULL, NULL}}; |
6518 | 6519 |
6519 // clang-format off | 6520 // clang-format off |
6520 const char* data[] = { | 6521 const char* data[] = { |
6521 "a", | 6522 "a", |
6522 "{ x : y }", | 6523 "{ x : y }", |
6523 "{ x : y = 1 }", | 6524 "{ x : y = 1 }", |
6524 "{ get, set }", | 6525 "{ get, set }", |
6525 "{ get = 1, set = 2 }", | 6526 "{ get = 1, set = 2 }", |
6526 "[a]", | 6527 "[a]", |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6568 | 6569 |
6569 { // All modes. | 6570 { // All modes. |
6570 const char* context_data[][2] = {{"'use strict'; let ", " = {};"}, | 6571 const char* context_data[][2] = {{"'use strict'; let ", " = {};"}, |
6571 {"var ", " = {};"}, | 6572 {"var ", " = {};"}, |
6572 {"'use strict'; const ", " = {};"}, | 6573 {"'use strict'; const ", " = {};"}, |
6573 {"function f(", ") {}"}, | 6574 {"function f(", ") {}"}, |
6574 {"function f(argument1, ", ") {}"}, | 6575 {"function f(argument1, ", ") {}"}, |
6575 {"var f = (", ") => {};"}, | 6576 {"var f = (", ") => {};"}, |
6576 {"var f = ", " => {};"}, | 6577 {"var f = ", " => {};"}, |
6577 {"var f = (argument1,", ") => {};"}, | 6578 {"var f = (argument1,", ") => {};"}, |
| 6579 {"try {} catch(", ") {}"}, |
6578 {NULL, NULL}}; | 6580 {NULL, NULL}}; |
6579 | 6581 |
6580 // clang-format off | 6582 // clang-format off |
6581 const char* data[] = { | 6583 const char* data[] = { |
6582 "a++", | 6584 "a++", |
6583 "++a", | 6585 "++a", |
6584 "delete a", | 6586 "delete a", |
6585 "void a", | 6587 "void a", |
6586 "typeof a", | 6588 "typeof a", |
6587 "--a", | 6589 "--a", |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7255 NULL | 7257 NULL |
7256 }; | 7258 }; |
7257 // clang-format on | 7259 // clang-format on |
7258 | 7260 |
7259 static const ParserFlag fail_flags[] = { | 7261 static const ParserFlag fail_flags[] = { |
7260 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst, | 7262 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst, |
7261 kAllowHarmonyDestructuring}; | 7263 kAllowHarmonyDestructuring}; |
7262 RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags, | 7264 RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags, |
7263 arraysize(fail_flags)); | 7265 arraysize(fail_flags)); |
7264 } | 7266 } |
OLD | NEW |