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

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

Issue 2661113002: [ESnext] Disallow using new with import() (Closed)
Patch Set: update goldens Created 3 years, 10 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 | « test/cctest/interpreter/bytecode_expectations/Generators.golden ('k') | no next file » | 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 4135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4146 } 4146 }
4147 4147
4148 TEST(ImportExpressionSuccess) { 4148 TEST(ImportExpressionSuccess) {
4149 // clang-format off 4149 // clang-format off
4150 const char* context_data[][2] = { 4150 const char* context_data[][2] = {
4151 {"", ""}, 4151 {"", ""},
4152 {NULL, NULL} 4152 {NULL, NULL}
4153 }; 4153 };
4154 4154
4155 const char* data[] = { 4155 const char* data[] = {
4156 "new import(x)",
4157 "import(1)", 4156 "import(1)",
4158 "import(y=x)", 4157 "import(y=x)",
4159 "f(...[import(y=x)])", 4158 "f(...[import(y=x)])",
4160 "x = {[import(y=x)]: 1}", 4159 "x = {[import(y=x)]: 1}",
4161 "var {[import(y=x)]: x} = {}", 4160 "var {[import(y=x)]: x} = {}",
4162 "({[import(y=x)]: x} = {})", 4161 "({[import(y=x)]: x} = {})",
4163 "async () => { await import(x) }", 4162 "async () => { await import(x) }",
4164 "() => { import(x) }", 4163 "() => { import(x) }",
4165 "(import(y=x))", 4164 "(import(y=x))",
4166 "{import(y=x)}", 4165 "{import(y=x)}",
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4224 "import(...y)", 4223 "import(...y)",
4225 "import(x,)", 4224 "import(x,)",
4226 "import(,)", 4225 "import(,)",
4227 "import(,y)", 4226 "import(,y)",
4228 "import(;)", 4227 "import(;)",
4229 "[import]", 4228 "[import]",
4230 "{import}", 4229 "{import}",
4231 "import+", 4230 "import+",
4232 "import = 1", 4231 "import = 1",
4233 "import.wat", 4232 "import.wat",
4233 "new import(x)",
4234 NULL 4234 NULL
4235 }; 4235 };
4236 4236
4237 // clang-format on 4237 // clang-format on
4238 RunParserSyncTest(context_data, data, kError); 4238 RunParserSyncTest(context_data, data, kError);
4239 // We ignore the error messages for the reason explained in the 4239 // We ignore the error messages for the reason explained in the
4240 // ImportExpressionSuccess test. 4240 // ImportExpressionSuccess test.
4241 RunModuleParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0, NULL, 4241 RunModuleParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0, NULL,
4242 0, true, true); 4242 0, true, true);
4243 static const ParserFlag flags[] = {kAllowHarmonyDynamicImport}; 4243 static const ParserFlag flags[] = {kAllowHarmonyDynamicImport};
(...skipping 5129 matching lines...) Expand 10 before | Expand all | Expand 10 after
9373 eager_info.literal()->scope()->inner_scope()->inner_scope(); 9373 eager_info.literal()->scope()->inner_scope()->inner_scope();
9374 DCHECK_NOT_NULL(scope); 9374 DCHECK_NOT_NULL(scope);
9375 DCHECK_NULL(scope->sibling()); 9375 DCHECK_NULL(scope->sibling());
9376 DCHECK(scope->is_function_scope()); 9376 DCHECK(scope->is_function_scope());
9377 9377
9378 size_t index = 0; 9378 size_t index = 0;
9379 i::ScopeTestHelper::CompareScopeToData( 9379 i::ScopeTestHelper::CompareScopeToData(
9380 scope, lazy_info.preparsed_scope_data(), index); 9380 scope, lazy_info.preparsed_scope_data(), index);
9381 } 9381 }
9382 } 9382 }
OLDNEW
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/Generators.golden ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698