-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial work #2
base: AsyncGeneratorExpressions
Are you sure you want to change the base?
initial work #2
Changes from all commits
c43a36a
d7ab9f4
0c017e8
3561cc3
93e6855
7207e80
55ecee2
fc0a26d
0e1bea0
e1225d8
8edb6c6
383a85e
e7dde08
fced437
17c6ab2
1d2a911
ac56fdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
*~ | ||
*.pyc | ||
console/TestCases | ||
.idea |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: pending | ||
description: > | ||
%AsyncGeneratorProrotype% creates functions with or without new and handles arguments | ||
similarly to functions. | ||
---*/ | ||
|
||
var AsyncGeneratorProrotype = async function* foo() { }.constructor; | ||
var fn; | ||
|
||
fn = AsyncGeneratorProrotype("a", "await 1;"); | ||
assert.sameValue(fn.length, 1, "length with 1 argument, call"); | ||
|
||
fn = AsyncGeneratorProrotype("a,b", "await 1;"); | ||
assert.sameValue(fn.length, 2, "length with 2 arguments in one, call"); | ||
|
||
fn = AsyncGeneratorProrotype("a", "b", "await 1;"); | ||
assert.sameValue(fn.length, 2, "length with 2 arguments, call"); | ||
|
||
fn = new AsyncGeneratorProrotype("a", "await 1;"); | ||
assert.sameValue(fn.length, 1, "length with 1 argument, construct"); | ||
|
||
fn = new AsyncGeneratorProrotype("a,b", "await 1;"); | ||
assert.sameValue(fn.length, 2, "length with 2 arguments in one, construct"); | ||
|
||
fn = new AsyncGeneratorProrotype("a", "b", "await 1;"); | ||
assert.sameValue(fn.length, 2, "length with 2 arguments, construct"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: pending | ||
description: > | ||
%AsyncGeneratorFunction% is extensible | ||
---*/ | ||
|
||
var AsyncGeneratorFunction = async function*() { }.constructor; | ||
AsyncGeneratorFunction.x = 1; | ||
assert.sameValue(AsyncGeneratorFunction.x, 1); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: pending | ||
description: > | ||
%AsyncGeneratorFunction% is a subclass of Function | ||
(The AsyncGeneratorFunction constructor is a standard built-in | ||
function object that inherits from the Function constructor. ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parenthesized bit might not add much, dunno |
||
---*/ | ||
async function* foo() { }; | ||
var AsyncGeneratorFunction = foo.constructor; | ||
assert.sameValue(Object.getPrototypeOf(AsyncGeneratorFunction), Function, "Prototype of constructor is Function"); | ||
assert.sameValue(Object.getPrototypeOf(AsyncGeneratorFunction.prototype), Function.prototype, "Prototype of constructor's prototype is Function.prototype"); | ||
assert(foo instanceof Function, 'async generator instance is instanceof Function'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: pending | ||
description: > | ||
%AsyncGeneratorFunction% has a length of 1 with writable false, enumerable false, configurable true. | ||
includes: [propertyHelper.js] | ||
---*/ | ||
|
||
var AsyncGeneratorFunction = async function* foo() { }.constructor; | ||
assert.sameValue(AsyncGeneratorFunction.length, 1); | ||
verifyNotWritable(AsyncGeneratorFunction, 'length'); | ||
verifyNotEnumerable(AsyncGeneratorFunction, 'length'); | ||
verifyConfigurable(AsyncGeneratorFunction, 'length'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: pending | ||
description: > | ||
The value of the name property of | ||
the AsyncGeneratorFunction is "AsyncGeneratorFunction". | ||
includes: [propertyHelper.js] | ||
---*/ | ||
|
||
var AsyncGeneratorFunction = async function* foo() { }.constructor; | ||
assert.sameValue(AsyncGeneratorFunction.name, "AsyncGeneratorFunction"); | ||
verifyNotWritable(AsyncGeneratorFunctionAsyncFunction, "name"); | ||
verifyNotEnumerable(AsyncGeneratorFunction, "name"); | ||
verifyConfigurable(AsyncGeneratorFunction, "name"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*--- | ||
author: Sasha Kruglyak <[email protected]> | ||
esid: pending | ||
description: > | ||
%AsyncGeneratorPrototype%.next.[[Call]] exists (is callable) | ||
---*/ | ||
|
||
async function* foo() { }; | ||
assert.sameValue(foo.hasOwnProperty("next"), true); | ||
foo().next(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: pending | ||
description: AsyncGeneratorFunction has a prototype property with writable false, enumerable false, configurable false. | ||
includes: [propertyHelper.js] | ||
---*/ | ||
|
||
var AsyncGeneratorFunction = async function* foo() { }.constructor; | ||
verifyNotConfigurable(AsyncGeneratorFunction, 'prototype'); | ||
verifyNotWritable(AsyncGeneratorFunction, 'prototype'); | ||
verifyNotEnumerable(AsyncGeneratorFunctionAsyncFunction, 'prototype'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
description: > | ||
%AsyncGeneratorPrototype% exists and is a function | ||
---*/ | ||
|
||
var AsyncGeneratorFunction = async function* foo() { }.constructor; | ||
assert.sameValue(typeof AsyncGeneratorFunction, "function"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/*--- | ||
author: Sakthipriyan Vairamani (thefourtheye) <[email protected]> | ||
description: Check if %AsyncGeneratorFunction% function's `prototype` | ||
object's `constructor` property is %AsyncGeneratorFunction% | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: remove "Check if" |
||
itself | ||
---*/ | ||
|
||
const AsyncGeneratorFunction = async function* () {}.constructor; | ||
const AGFPrototype = AsyncGeneratorFunction.prototype; | ||
assert.sameValue(AGFPrototype.constructor, AsyncGeneratorFunction); | ||
|
||
verifyNotEnumerable(AGFPrototype, 'constructor'); | ||
verifyNotWritable(AGFPrototype, 'constructor'); | ||
verifyConfigurable(AGFPrototype, 'constructor'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: pending | ||
description: > | ||
%AsyncGeneratorPrototype% has a [[Extensible]] of true | ||
---*/ | ||
|
||
var AsyncGeneratorFunction = async function* foo() { }.constructor; | ||
AsyncGeneratorFunction.prototype.x = 1; | ||
assert.sameValue(AsyncGeneratorFunction.prototype.x, 1); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/*--- | ||
author: Sakthipriyan Vairamani (thefourtheye) <[email protected]> | ||
description: Make sure %AsyncGeneratorFunction% is exposed via the | ||
`.constructor` property. | ||
---*/ | ||
|
||
const AsyncGeneratorFunction = async function* () {}.constructor; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many test262 tests avoid using lexical variables unless specifically testing things related to lexical variables |
||
assert.sameValue(typeof AsyncGeneratorFunction, 'function'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/*--- | ||
author: Sakthipriyan Vairamani (thefourtheye) <[email protected]> | ||
description: Make sure %AsyncGeneratorFunction% is not a global function | ||
---*/ | ||
|
||
assert.throws(ReferenceError, function() { | ||
AsyncGeneratorFunction | ||
}, 'AsyncGeneratorFunction should not be available in global scope'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/*--- | ||
author: Sakthipriyan Vairamani (thefourtheye) <[email protected]> | ||
description: Check if %AsyncGeneratorFunction% function's `prototype` | ||
object's `Symbol.toStringTag` property is | ||
'AsyncGeneratorFunction' | ||
---*/ | ||
|
||
const AsyncGeneratorFunction = async function* () {}.constructor; | ||
const AGFPrototype = AsyncGeneratorFunction.prototype; | ||
|
||
assert.sameValue(AGFPrototype[Symbol.toStringTag], 'AsyncGeneratorFunction'); | ||
|
||
verifyNotEnumerable(AGFPrototype, Symbol.toStringTag); | ||
verifyNotWritable(AGFPrototype, Symbol.toStringTag); | ||
verifyConfigurable(AGFPrototype, Symbol.toStringTag); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2016 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: early | ||
description: Value shared by all realms | ||
info: > | ||
Unless otherwise specified, well-known symbols values are shared by all | ||
realms. | ||
features: [Symbol.asyncIterator] | ||
---*/ | ||
|
||
var otherRealmSymbol = $.createRealm().global.Symbol; | ||
|
||
assert.sameValue(Symbol.asyncIterator, otherRealmSymbol.asyncIterator); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*--- | ||
author: Benjamin Gruenbaum <[email protected]> | ||
esid: early | ||
description: Name prop of Symbol.asyncIterator | ||
info: > | ||
The value of the name property of this function is "[Symbol.asyncIterator]". | ||
features: [Symbol.asyncIterator] | ||
---*/ | ||
|
||
|
||
assert.sameValue(Symbol.asyncIterator.name, '[Symbol.asyncIterator]'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "[Symbol.asyncIterator]" is not a name of the symbol, but the method of %AsyncIteratorPrototype% |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (C) 2015-2017 the V8 project authors. All rights reserved. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd probably rename this file to just "asyncIterator.js" unless this matches the conventions of the other well known symbol tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This matches the conventions of the async function tests. I don't feel strongly about the name though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fair enough |
||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: early | ||
description: > | ||
`Symbol.asyncIterator` property descriptor | ||
info: > | ||
This property has the attributes { [[Writable]]: false, [[Enumerable]]: | ||
false, [[Configurable]]: false }. | ||
includes: [propertyHelper.js] | ||
features: [Symbol.asyncIterator] | ||
---*/ | ||
|
||
assert.sameValue(typeof Symbol.asyncIterator, 'symbol'); | ||
verifyNotEnumerable(Symbol, 'asyncIterator'); | ||
verifyNotWritable(Symbol, 'asyncIterator'); | ||
verifyNotConfigurable(Symbol, 'asyncIterator'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and | ||
IsSimpleParameterList of UniqueFormalParameters is false. | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
---*/ | ||
|
||
(async function*(x = 1) {"use strict"}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
It is a SyntaxError if FormalParameters contains arguments in strict mode. | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
flags: [onlyStrict] | ||
---*/ | ||
|
||
(async function*(arguments) { }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: 12.1.1 | ||
description: > | ||
`await` is not a valid BindingIdentifier for AsyncGeneratorExpressions. | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
---*/ | ||
|
||
(async function* await() { }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
If the source code matching this production is strict code, it is a | ||
Syntax Error if BindingIdentifier is the IdentifierName arguments. | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
flags: [onlyStrict] | ||
---*/ | ||
|
||
(async function* arguments() { }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
If the source code matching this production is strict code, it is a | ||
Syntax Error if BindingIdentifier is the IdentifierName eval. | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
flags: [onlyStrict] | ||
---*/ | ||
|
||
(async function* eval() { }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
It is a syntax error if AsyncGeneratorBody contains SuperCall is true. | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
---*/ | ||
|
||
(async function*() { super(); }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
It is a syntax error if AsyncGeneratorBody contains SuperProperty is true. | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
---*/ | ||
|
||
(async function*() { super.prop; }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
It is a SyntaxError if FormalParameters contains eval in strict mode. | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
flags: [onlyStrict] | ||
---*/ | ||
|
||
(async function*(eval) { }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
It is a SyntaxError if BoundNames of FormalParameters also occurs in the | ||
LexicallyDeclaredNames of AsyncFunctionBody | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
---*/ | ||
|
||
(async function*(a) { const a = 0; }); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2017 the V8 project authors. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
author: Caitlin Potter <[email protected]> | ||
esid: pending | ||
description: > | ||
It is a SyntaxError if BoundNames of FormalParameters also occurs in the | ||
LexicallyDeclaredNames of AsyncFunctionBody | ||
negative: | ||
phase: early | ||
type: SyntaxError | ||
---*/ | ||
|
||
(async function*(a) { let a; }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly about arguments parsing in CreateDynamicFunction