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 6324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6335 "{'hi' : x = 42}", | 6335 "{'hi' : x = 42}", |
6336 "{var: x}", | 6336 "{var: x}", |
6337 "{var: x = 42}", | 6337 "{var: x = 42}", |
6338 "{[x] : z}", | 6338 "{[x] : z}", |
6339 "{[1+1] : z}", | 6339 "{[1+1] : z}", |
6340 "{[foo()] : z}", | 6340 "{[foo()] : z}", |
6341 "{}", | 6341 "{}", |
6342 "[...rest]", | 6342 "[...rest]", |
6343 "[a,b,...rest]", | 6343 "[a,b,...rest]", |
6344 "[a,,...rest]", | 6344 "[a,,...rest]", |
| 6345 "{ __proto__: x, __proto__: y}", |
6345 "{arguments: x}", | 6346 "{arguments: x}", |
6346 "{eval: x}", | 6347 "{eval: x}", |
6347 NULL}; | 6348 NULL}; |
6348 // clang-format on | 6349 // clang-format on |
6349 RunParserSyncTest(context_data, data, kSuccess); | 6350 RunParserSyncTest(context_data, data, kSuccess); |
6350 | 6351 |
6351 // v8:5201 | 6352 // v8:5201 |
6352 // TODO(lpy): The two test sets below should be merged once | 6353 // TODO(lpy): The two test sets below should be merged once |
6353 // we fix https://bugs.chromium.org/p/v8/issues/detail?id=4577 | 6354 // we fix https://bugs.chromium.org/p/v8/issues/detail?id=4577 |
6354 { | 6355 { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6622 "{ x : { foo: y = 10 } = {} }", | 6623 "{ x : { foo: y = 10 } = {} }", |
6623 "{ x : { foo: foo().y = 10 } = {} }", | 6624 "{ x : { foo: foo().y = 10 } = {} }", |
6624 "{ x : { foo: foo()[y] = 10 } = {} }", | 6625 "{ x : { foo: foo()[y] = 10 } = {} }", |
6625 "{ x : { foo: y.z = 10 } = {} }", | 6626 "{ x : { foo: y.z = 10 } = {} }", |
6626 "{ x : { foo: y[z] = 10 } = {} }", | 6627 "{ x : { foo: y[z] = 10 } = {} }", |
6627 "{ x : [ y = 10 ] = {} }", | 6628 "{ x : [ y = 10 ] = {} }", |
6628 "{ x : [ foo().y = 10 ] = {} }", | 6629 "{ x : [ foo().y = 10 ] = {} }", |
6629 "{ x : [ foo()[y] = 10 ] = {} }", | 6630 "{ x : [ foo()[y] = 10 ] = {} }", |
6630 "{ x : [ y.z = 10 ] = {} }", | 6631 "{ x : [ y.z = 10 ] = {} }", |
6631 "{ x : [ y[z] = 10 ] = {} }", | 6632 "{ x : [ y[z] = 10 ] = {} }", |
| 6633 "{ z : { __proto__: x, __proto__: y } = z }" |
6632 | 6634 |
6633 "[ x ]", | 6635 "[ x ]", |
6634 "[ foo().x ]", | 6636 "[ foo().x ]", |
6635 "[ foo()[x] ]", | 6637 "[ foo()[x] ]", |
6636 "[ x.y ]", | 6638 "[ x.y ]", |
6637 "[ x[y] ]", | 6639 "[ x[y] ]", |
6638 "[ { x } ]", | 6640 "[ { x } ]", |
6639 "[ { x : y } ]", | 6641 "[ { x : y } ]", |
6640 "[ { x : foo().y } ]", | 6642 "[ { x : foo().y } ]", |
6641 "[ { x : foo()[y] } ]", | 6643 "[ { x : foo()[y] } ]", |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6741 "var foo = { x = 10 } = {};", | 6743 "var foo = { x = 10 } = {};", |
6742 "var foo = { q } = { x = 10 } = {};", | 6744 "var foo = { q } = { x = 10 } = {};", |
6743 "var foo; foo = { x = 10 } = {};", | 6745 "var foo; foo = { x = 10 } = {};", |
6744 "var foo; foo = { q } = { x = 10 } = {};", | 6746 "var foo; foo = { q } = { x = 10 } = {};", |
6745 "var x; ({ x = 10 } = {});", | 6747 "var x; ({ x = 10 } = {});", |
6746 "var q, x; ({ q } = { x = 10 } = {});", | 6748 "var q, x; ({ q } = { x = 10 } = {});", |
6747 "var x; [{ x = 10 } = {}]", | 6749 "var x; [{ x = 10 } = {}]", |
6748 "var x; (true ? { x = true } = {} : { x = false } = {})", | 6750 "var x; (true ? { x = true } = {} : { x = false } = {})", |
6749 "var q, x; (q, { x = 10 } = {});", | 6751 "var q, x; (q, { x = 10 } = {});", |
6750 "var { x = 10 } = { x = 20 } = {};", | 6752 "var { x = 10 } = { x = 20 } = {};", |
| 6753 "var { __proto__: x, __proto__: y } = {}", |
| 6754 "({ __proto__: x, __proto__: y } = {})", |
6751 "var { x = 10 } = (o = { x = 20 } = {});", | 6755 "var { x = 10 } = (o = { x = 20 } = {});", |
6752 "var x; (({ x = 10 } = { x = 20 } = {}) => x)({})", | 6756 "var x; (({ x = 10 } = { x = 20 } = {}) => x)({})", |
6753 NULL, | 6757 NULL, |
6754 }; | 6758 }; |
6755 RunParserSyncTest(empty_context_data, ambiguity_data, kSuccess); | 6759 RunParserSyncTest(empty_context_data, ambiguity_data, kSuccess); |
6756 } | 6760 } |
6757 | 6761 |
6758 | 6762 |
6759 TEST(DestructuringAssignmentNegativeTests) { | 6763 TEST(DestructuringAssignmentNegativeTests) { |
6760 const char* context_data[][2] = { | 6764 const char* context_data[][2] = { |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8187 "(a,);", | 8191 "(a,);", |
8188 "(a,b,c,);", | 8192 "(a,b,c,);", |
8189 NULL | 8193 NULL |
8190 }; | 8194 }; |
8191 // clang-format on | 8195 // clang-format on |
8192 | 8196 |
8193 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 8197 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |
8194 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 8198 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
8195 arraysize(always_flags)); | 8199 arraysize(always_flags)); |
8196 } | 8200 } |
OLD | NEW |