| OLD | NEW | 
|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include <fstream> | 5 #include <fstream> | 
| 6 | 6 | 
| 7 #include "src/v8.h" | 7 #include "src/v8.h" | 
| 8 | 8 | 
| 9 #include "src/interpreter/bytecode-array-iterator.h" | 9 #include "src/interpreter/bytecode-array-iterator.h" | 
| 10 #include "src/interpreter/bytecode-generator.h" | 10 #include "src/interpreter/bytecode-generator.h" | 
| (...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2364       "class A { constructor(...args) { this.args = args; } }\n" | 2364       "class A { constructor(...args) { this.args = args; } }\n" | 
| 2365       "new A(0, ...[1, 2, 3]);\n", | 2365       "new A(0, ...[1, 2, 3]);\n", | 
| 2366 | 2366 | 
| 2367       "class A { constructor(...args) { this.args = args; } }\n" | 2367       "class A { constructor(...args) { this.args = args; } }\n" | 
| 2368       "new A(0, ...[1, 2, 3], 4);\n"}; | 2368       "new A(0, ...[1, 2, 3], 4);\n"}; | 
| 2369 | 2369 | 
| 2370   CHECK(CompareTexts(BuildActual(printer, snippets), | 2370   CHECK(CompareTexts(BuildActual(printer, snippets), | 
| 2371                      LoadGolden("NewAndSpread.golden"))); | 2371                      LoadGolden("NewAndSpread.golden"))); | 
| 2372 } | 2372 } | 
| 2373 | 2373 | 
|  | 2374 TEST(ForAwaitOf) { | 
|  | 2375   bool old_flag = i::FLAG_harmony_async_iteration; | 
|  | 2376   i::FLAG_harmony_async_iteration = true; | 
|  | 2377   InitializedIgnitionHandleScope scope; | 
|  | 2378   BytecodeExpectationsPrinter printer(CcTest::isolate()); | 
|  | 2379   printer.set_wrap(false); | 
|  | 2380   printer.set_test_function_name("f"); | 
|  | 2381 | 
|  | 2382   const char* snippets[] = { | 
|  | 2383       "async function f() {\n" | 
|  | 2384       "  for await (let x of [1, 2, 3]) {}\n" | 
|  | 2385       "}\n" | 
|  | 2386       "f();\n", | 
|  | 2387 | 
|  | 2388       "async function f() {\n" | 
|  | 2389       "  for await (let x of [1, 2, 3]) { return x; }\n" | 
|  | 2390       "}\n" | 
|  | 2391       "f();\n", | 
|  | 2392 | 
|  | 2393       "async function f() {\n" | 
|  | 2394       "  for await (let x of [10, 20, 30]) {\n" | 
|  | 2395       "    if (x == 10) continue;\n" | 
|  | 2396       "    if (x == 20) break;\n" | 
|  | 2397       "  }\n" | 
|  | 2398       "}\n" | 
|  | 2399       "f();\n", | 
|  | 2400 | 
|  | 2401       "async function f() {\n" | 
|  | 2402       "  var x = { 'a': 1, 'b': 2 };\n" | 
|  | 2403       "  for (x['a'] of [1,2,3]) { return x['a']; }\n" | 
|  | 2404       "}\n" | 
|  | 2405       "f();\n"}; | 
|  | 2406 | 
|  | 2407   CHECK(CompareTexts(BuildActual(printer, snippets), | 
|  | 2408                      LoadGolden("ForAwaitOf.golden"))); | 
|  | 2409 | 
|  | 2410   i::FLAG_harmony_async_iteration = old_flag; | 
|  | 2411 } | 
|  | 2412 | 
| 2374 }  // namespace interpreter | 2413 }  // namespace interpreter | 
| 2375 }  // namespace internal | 2414 }  // namespace internal | 
| 2376 }  // namespace v8 | 2415 }  // namespace v8 | 
| OLD | NEW | 
|---|