Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2255353002: [parser] Allow duplicate __proto__ keys in patterns (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: create objectliteral production Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser-base.h ('k') | test/test262/test262.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 15 matching lines...) Expand all
6776 "{ x: y() }", 6780 "{ x: y() }",
6777 "{ this }", 6781 "{ this }",
6778 "{ x: this }", 6782 "{ x: this }",
6779 "{ x: this = 1 }", 6783 "{ x: this = 1 }",
6780 "{ super }", 6784 "{ super }",
6781 "{ x: super }", 6785 "{ x: super }",
6782 "{ x: super = 1 }", 6786 "{ x: super = 1 }",
6783 "{ new.target }", 6787 "{ new.target }",
6784 "{ x: new.target }", 6788 "{ x: new.target }",
6785 "{ x: new.target = 1 }", 6789 "{ x: new.target = 1 }",
6790 "{{ __proto__: x, __proto__: y}}",
adamk 2016/08/19 23:27:35 Why the double braces? Isn't that already an error
6791 "({ __proto__: x, __proto__: y})",
adamk 2016/08/19 23:27:35 Same here, I think the parens are already an error
6786 "[x--]", 6792 "[x--]",
6787 "[--x = 1]", 6793 "[--x = 1]",
6788 "[x()]", 6794 "[x()]",
6789 "[this]", 6795 "[this]",
6790 "[this = 1]", 6796 "[this = 1]",
6791 "[new.target]", 6797 "[new.target]",
6792 "[new.target = 1]", 6798 "[new.target = 1]",
6793 "[super]", 6799 "[super]",
6794 "[super = 1]", 6800 "[super = 1]",
6795 "[function f() {}]", 6801 "[function f() {}]",
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
6863 "var foo; foo = { x = 10 };", 6869 "var foo; foo = { x = 10 };",
6864 "var foo; foo = { q } = { x = 10 };", 6870 "var foo; foo = { q } = { x = 10 };",
6865 "var x; ({ x = 10 });", 6871 "var x; ({ x = 10 });",
6866 "var q, x; ({ q } = { x = 10 });", 6872 "var q, x; ({ q } = { x = 10 });",
6867 "var x; [{ x = 10 }]", 6873 "var x; [{ x = 10 }]",
6868 "var x; (true ? { x = true } : { x = false })", 6874 "var x; (true ? { x = true } : { x = false })",
6869 "var q, x; (q, { x = 10 });", 6875 "var q, x; (q, { x = 10 });",
6870 "var { x = 10 } = { x = 20 };", 6876 "var { x = 10 } = { x = 20 };",
6871 "var { x = 10 } = (o = { x = 20 });", 6877 "var { x = 10 } = (o = { x = 20 });",
6872 "var x; (({ x = 10 } = { x = 20 }) => x)({})", 6878 "var x; (({ x = 10 } = { x = 20 }) => x)({})",
6879 "var {{ __proto__: x, __proto__: y}}",
adamk 2016/08/19 23:27:35 And here and below.
6880 "({ __proto__: x, __proto__: y}) => ()",
6873 6881
6874 // Not ambiguous, but uses same context data 6882 // Not ambiguous, but uses same context data
6875 "switch([window %= []] = []) { default: }", 6883 "switch([window %= []] = []) { default: }",
6876 6884
6877 NULL, 6885 NULL,
6878 }; 6886 };
6879 RunParserSyncTest(empty_context_data, ambiguity_data, kError); 6887 RunParserSyncTest(empty_context_data, ambiguity_data, kError);
6880 6888
6881 // Strict mode errors 6889 // Strict mode errors
6882 const char* strict_context_data[][2] = {{"'use strict'; (", " = {})"}, 6890 const char* strict_context_data[][2] = {{"'use strict'; (", " = {})"},
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
8187 "(a,);", 8195 "(a,);",
8188 "(a,b,c,);", 8196 "(a,b,c,);",
8189 NULL 8197 NULL
8190 }; 8198 };
8191 // clang-format on 8199 // clang-format on
8192 8200
8193 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; 8201 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas};
8194 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 8202 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
8195 arraysize(always_flags)); 8203 arraysize(always_flags));
8196 } 8204 }
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698