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

Side by Side Diff: test/mjsunit/harmony/async-await-basic.js

Issue 2608333002: [cleanup] remove sloppy generator/async function maps (Closed)
Patch Set: [cleanup] remove sloppy generator/async function maps Created 3 years, 11 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/objects.cc ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 // Flags: --harmony-async-await --allow-natives-syntax 5 // Flags: --harmony-async-await --allow-natives-syntax
6 6
7 // Do not install `AsyncFunction` constructor on global object 7 // Do not install `AsyncFunction` constructor on global object
8 8
9 function assertThrowsAsync(run, errorType, message) { 9 function assertThrowsAsync(run, errorType, message) {
10 var actual; 10 var actual;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 Symbol.toStringTag); 137 Symbol.toStringTag);
138 assertEquals("AsyncFunction", descriptor.value); 138 assertEquals("AsyncFunction", descriptor.value);
139 assertEquals(false, descriptor.enumerable); 139 assertEquals(false, descriptor.enumerable);
140 assertEquals(false, descriptor.writable); 140 assertEquals(false, descriptor.writable);
141 assertEquals(true, descriptor.configurable); 141 assertEquals(true, descriptor.configurable);
142 142
143 assertEquals(1, AsyncFunction.length); 143 assertEquals(1, AsyncFunction.length);
144 144
145 // Let F be ! FunctionAllocate(functionPrototype, Strict, "non-constructor") 145 // Let F be ! FunctionAllocate(functionPrototype, Strict, "non-constructor")
146 async function asyncNonConstructorDecl() {} 146 async function asyncNonConstructorDecl() {}
147 assertThrows( 147 assertThrows(() => new asyncNonConstructorDecl(), TypeError);
148 () => new asyncNonConstructorDecl(), TypeError); 148 assertThrows(() => asyncNonConstructorDecl.caller, TypeError);
149 assertThrows( 149 assertThrows(() => asyncNonConstructorDecl.arguments, TypeError);
150 () => new (async function() {}), TypeError); 150
151 assertThrows(() => new (async function() {}), TypeError);
152 assertThrows(() => (async function() {}).caller, TypeError);
153 assertThrows(() => (async function() {}).arguments, TypeError);
154
151 assertThrows( 155 assertThrows(
152 () => new ({ async nonConstructor() {} }).nonConstructor(), TypeError); 156 () => new ({ async nonConstructor() {} }).nonConstructor(), TypeError);
153 assertThrows( 157 assertThrows(
154 () => new (() => "not a constructor!"), TypeError); 158 () => ({ async nonConstructor() {} }).nonConstructor.caller, TypeError);
155 assertThrows( 159 assertThrows(
156 () => new (AsyncFunction()), TypeError); 160 () => ({ async nonConstructor() {} }).nonConstructor.arguments, TypeError);
157 assertThrows( 161
158 () => new (new AsyncFunction()), TypeError); 162 assertThrows(() => new (() => "not a constructor!"), TypeError);
163 assertThrows(() => (() => 1).caller, TypeError);
164 assertThrows(() => (() => 1).arguments, TypeError);
165
166 assertThrows(() => new (AsyncFunction()), TypeError);
167 assertThrows(() => AsyncFunction().caller, TypeError);
168 assertThrows(() => AsyncFunction().arguments, TypeError);
169
170 assertThrows(() => new (new AsyncFunction()), TypeError);
171 assertThrows(() => (new AsyncFunction()).caller, TypeError);
172 assertThrows(() => (new AsyncFunction()).arguments, TypeError);
159 173
160 // Normal completion 174 // Normal completion
161 async function asyncDecl() { return "test"; } 175 async function asyncDecl() { return "test"; }
162 assertEqualsAsync("test", asyncDecl); 176 assertEqualsAsync("test", asyncDecl);
163 assertEqualsAsync("test2", async function() { return "test2"; }); 177 assertEqualsAsync("test2", async function() { return "test2"; });
164 assertEqualsAsync("test3", async () => "test3"); 178 assertEqualsAsync("test3", async () => "test3");
165 assertEqualsAsync("test4", () => ({ async f() { return "test4"; } }).f()); 179 assertEqualsAsync("test4", () => ({ async f() { return "test4"; } }).f());
166 assertEqualsAsync("test5", () => AsyncFunction("no", "return 'test' + no;")(5)); 180 assertEqualsAsync("test5", () => AsyncFunction("no", "return 'test' + no;")(5));
167 assertEqualsAsync("test6", 181 assertEqualsAsync("test6",
168 () => (new AsyncFunction("no", "return 'test' + no;"))(6)); 182 () => (new AsyncFunction("no", "return 'test' + no;"))(6));
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 "20", () => (async(foo, { a = "0" }) => foo + a)("2", { a: undefined })); 383 "20", () => (async(foo, { a = "0" }) => foo + a)("2", { a: undefined }));
370 assertThrows(() => eval("async({ foo = 1 })"), SyntaxError); 384 assertThrows(() => eval("async({ foo = 1 })"), SyntaxError);
371 assertThrows(() => eval("async(a, { foo = 1 })"), SyntaxError); 385 assertThrows(() => eval("async(a, { foo = 1 })"), SyntaxError);
372 386
373 // https://bugs.chromium.org/p/chromium/issues/detail?id=638019 387 // https://bugs.chromium.org/p/chromium/issues/detail?id=638019
374 async function gaga() { 388 async function gaga() {
375 let i = 1; 389 let i = 1;
376 while (i-- > 0) { await 42 } 390 while (i-- > 0) { await 42 }
377 } 391 }
378 assertDoesNotThrow(gaga); 392 assertDoesNotThrow(gaga);
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698