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(", ") {}"}, | |
6518 {NULL, NULL}}; | 6517 {NULL, NULL}}; |
6519 | 6518 |
6520 // clang-format off | 6519 // clang-format off |
6521 const char* data[] = { | 6520 const char* data[] = { |
6522 "a", | 6521 "a", |
6523 "{ x : y }", | 6522 "{ x : y }", |
6524 "{ x : y = 1 }", | 6523 "{ x : y = 1 }", |
6525 "{ get, set }", | 6524 "{ get, set }", |
6526 "{ get = 1, set = 2 }", | 6525 "{ get = 1, set = 2 }", |
6527 "[a]", | 6526 "[a]", |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6569 | 6568 |
6570 { // All modes. | 6569 { // All modes. |
6571 const char* context_data[][2] = {{"'use strict'; let ", " = {};"}, | 6570 const char* context_data[][2] = {{"'use strict'; let ", " = {};"}, |
6572 {"var ", " = {};"}, | 6571 {"var ", " = {};"}, |
6573 {"'use strict'; const ", " = {};"}, | 6572 {"'use strict'; const ", " = {};"}, |
6574 {"function f(", ") {}"}, | 6573 {"function f(", ") {}"}, |
6575 {"function f(argument1, ", ") {}"}, | 6574 {"function f(argument1, ", ") {}"}, |
6576 {"var f = (", ") => {};"}, | 6575 {"var f = (", ") => {};"}, |
6577 {"var f = ", " => {};"}, | 6576 {"var f = ", " => {};"}, |
6578 {"var f = (argument1,", ") => {};"}, | 6577 {"var f = (argument1,", ") => {};"}, |
6579 {"try {} catch(", ") {}"}, | |
6580 {NULL, NULL}}; | 6578 {NULL, NULL}}; |
6581 | 6579 |
6582 // clang-format off | 6580 // clang-format off |
6583 const char* data[] = { | 6581 const char* data[] = { |
6584 "a++", | 6582 "a++", |
6585 "++a", | 6583 "++a", |
6586 "delete a", | 6584 "delete a", |
6587 "void a", | 6585 "void a", |
6588 "typeof a", | 6586 "typeof a", |
6589 "--a", | 6587 "--a", |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7230 NULL | 7228 NULL |
7231 }; | 7229 }; |
7232 // clang-format on | 7230 // clang-format on |
7233 | 7231 |
7234 static const ParserFlag fail_flags[] = { | 7232 static const ParserFlag fail_flags[] = { |
7235 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst, | 7233 kAllowHarmonySloppy, kAllowHarmonySloppyLet, kNoLegacyConst, |
7236 kAllowHarmonyDestructuring}; | 7234 kAllowHarmonyDestructuring}; |
7237 RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags, | 7235 RunParserSyncTest(context_data, fail_data, kError, NULL, 0, fail_flags, |
7238 arraysize(fail_flags)); | 7236 arraysize(fail_flags)); |
7239 } | 7237 } |
OLD | NEW |