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

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

Issue 1141223002: [parser] report SyntaxError if rest parameter used in Setter MethodDefinition (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add cctest Created 5 years, 7 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/preparser.cc ('k') | test/message/rest-param-class-setter-strict.js » ('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 5091 matching lines...) Expand 10 before | Expand all | Expand 10 after
5102 "a,\ta, ...args", 5102 "a,\ta, ...args",
5103 "a,\ra, ...args", 5103 "a,\ra, ...args",
5104 "a,\na, ...args", 5104 "a,\na, ...args",
5105 NULL}; 5105 NULL};
5106 static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters}; 5106 static const ParserFlag always_flags[] = {kAllowHarmonyRestParameters};
5107 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 5107 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
5108 arraysize(always_flags)); 5108 arraysize(always_flags));
5109 } 5109 }
5110 5110
5111 5111
5112 TEST(RestParameterInSetterMethodError) {
5113 const char* context_data[][2] = {
5114 {"'use strict';({ set prop(", ") {} }).prop = 1;"},
5115 {"'use strict';(class { static set prop(", ") {} }).prop = 1;"},
5116 {"'use strict';(new (class { set prop(", ") {} })).prop = 1;"},
5117 {"({ set prop(", ") {} }).prop = 1;"},
5118 {"(class { static set prop(", ") {} }).prop = 1;"},
5119 {"(new (class { set prop(", ") {} })).prop = 1;"},
5120 {nullptr, nullptr}};
5121 const char* data[] = {"...a", "...arguments", "...eval", nullptr};
5122
5123 static const ParserFlag always_flags[] = {
5124 kAllowHarmonyRestParameters, kAllowHarmonyClasses, kAllowHarmonySloppy};
5125 RunParserSyncTest(context_data, data, kError, nullptr, 0, always_flags,
5126 arraysize(always_flags));
5127 }
5128
5129
5112 TEST(RestParametersEvalArguments) { 5130 TEST(RestParametersEvalArguments) {
5113 const char* strict_context_data[][2] = 5131 const char* strict_context_data[][2] =
5114 {{"'use strict';(function(", 5132 {{"'use strict';(function(",
5115 "){ return;})(1, [], /regexp/, 'str',function(){});"}, 5133 "){ return;})(1, [], /regexp/, 'str',function(){});"},
5116 {NULL, NULL}}; 5134 {NULL, NULL}};
5117 const char* sloppy_context_data[][2] = 5135 const char* sloppy_context_data[][2] =
5118 {{"(function(", 5136 {{"(function(",
5119 "){ return;})(1, [],/regexp/, 'str', function(){});"}, 5137 "){ return;})(1, [],/regexp/, 'str', function(){});"},
5120 {NULL, NULL}}; 5138 {NULL, NULL}};
5121 5139
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
6456 const char* data[] = { 6474 const char* data[] = {
6457 "yield", 6475 "yield",
6458 "[yield]", 6476 "[yield]",
6459 "{ x : yield }", 6477 "{ x : yield }",
6460 NULL}; 6478 NULL};
6461 // clang-format on 6479 // clang-format on
6462 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 6480 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
6463 arraysize(always_flags)); 6481 arraysize(always_flags));
6464 } 6482 }
6465 } 6483 }
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | test/message/rest-param-class-setter-strict.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698