Add support for @@iterator (#7058)

This commit is contained in:
Raja Sekar
2018-01-12 20:49:11 +05:30
committed by Brian Ng
parent c3352ad2e0
commit 2d05487293
41 changed files with 1595 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
declare class A {
@@iterator(): Iterator<File>;
}
declare class A {
@@asyncIterator(): Iterator<File>;
}

View File

@@ -0,0 +1,6 @@
declare class A {
@@iterator(): Iterator<File>
}
declare class A {
@@asyncIterator(): Iterator<File>
}

View File

@@ -0,0 +1,7 @@
interface A {
@@iterator(): Iterator<File>;
}
interface A {
@@asyncIterator(): Iterator<File>;
}

View File

@@ -0,0 +1,6 @@
interface A {
@@iterator(): Iterator<File>
}
interface A {
@@asyncIterator(): Iterator<File>
}

View File

@@ -0,0 +1,3 @@
function foo(): { @@iterator: () => string } {
return (0: any);
}

View File

@@ -0,0 +1,5 @@
function foo(): {
@@iterator: () => string
} {
return (0: any);
}

View File

@@ -0,0 +1,15 @@
declare class A {
@@iterator(): Iterator<File>;
}
declare class A {
@@asyncIterator(): Iterator<File>;
}
interface A {
@@iterator(): Iterator<File>;
}
interface A {
@@asyncIterator(): Iterator<File>;
}

View File

@@ -8,6 +8,7 @@ import * as N from "../types";
import type { Pos, Position } from "../util/location";
import type State from "../tokenizer/state";
import * as charCodes from "charcodes";
import { isIteratorStart } from "../util/identifier";
const primitiveTypes = [
"any",
@@ -1626,8 +1627,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
// ensure that inside flow types, we bypass the jsx parser plugin
readToken(code: number): void {
const next = this.input.charCodeAt(this.state.pos + 1);
if (this.state.inType && (code === 62 || code === 60)) {
return this.finishOp(tt.relational, 1);
} else if (isIteratorStart(code, next)) {
this.state.isIterator = true;
return super.readWord(code);
} else {
return super.readToken(code);
}

View File

@@ -73,6 +73,9 @@ tt.name.updateContext = function(prevType) {
this.state.exprAllowed = true;
}
}
if (this.state.isIterator) {
this.state.isIterator = false;
}
};
tt.braceL.updateContext = function(prevType) {

View File

@@ -1240,6 +1240,8 @@ export default class Tokenizer extends LocationParser {
const ch = this.fullCharCodeAtPos();
if (isIdentifierChar(ch)) {
this.state.pos += ch <= 0xffff ? 1 : 2;
} else if (this.state.isIterator && ch === charCodes.atSign) {
this.state.pos += 1;
} else if (ch === charCodes.backslash) {
this.state.containsEsc = true;
@@ -1271,6 +1273,10 @@ export default class Tokenizer extends LocationParser {
return word + this.input.slice(chunkStart, this.state.pos);
}
isIterator(word): boolean {
return word === "@@iterator" || word === "@@asyncIterator";
}
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
@@ -1286,6 +1292,14 @@ export default class Tokenizer extends LocationParser {
type = keywordTypes[word];
}
// Allow @@iterator and @@asyncIterator as a identifier only inside type
if (
this.state.isIterator &&
(!this.isIterator(word) || !this.state.inType)
) {
this.raise(this.state.pos, `Invalid identifier ${word}`);
}
this.finishToken(type, word);
}

View File

@@ -87,6 +87,12 @@ export function isIdentifierStart(code: number): boolean {
return isInAstralSet(code, astralIdentifierStartCodes);
}
// Test whether a current state character code and next character code is @
export function isIteratorStart(current: number, next: number): boolean {
return current === 64 && next === 64;
}
// Test whether a given character is part of an identifier.
export function isIdentifierChar(code: number): boolean {

View File

@@ -0,0 +1,3 @@
declare class A {
@@iterator(): Iterator<File>;
}

View File

@@ -0,0 +1,225 @@
{
"type": "File",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "DeclareClass",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 14,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "A"
},
"name": "A"
},
"typeParameters": null,
"extends": [],
"mixins": [],
"body": {
"type": "ObjectTypeAnnotation",
"start": 16,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 3,
"column": 1
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 20,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 30
}
},
"key": {
"type": "Identifier",
"start": 20,
"end": 30,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 12
},
"identifierName": "@@iterator"
},
"name": "@@iterator"
},
"static": false,
"kind": "init",
"method": true,
"value": {
"type": "FunctionTypeAnnotation",
"start": 20,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 30
}
},
"params": [],
"rest": null,
"typeParameters": null,
"returnType": {
"type": "GenericTypeAnnotation",
"start": 34,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 30
}
},
"typeParameters": {
"type": "TypeParameterInstantiation",
"start": 42,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 24
},
"end": {
"line": 2,
"column": 30
}
},
"params": [
{
"type": "GenericTypeAnnotation",
"start": 43,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 29
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 43,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 29
},
"identifierName": "File"
},
"name": "File"
}
}
]
},
"id": {
"type": "Identifier",
"start": 34,
"end": 42,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 24
},
"identifierName": "Iterator"
},
"name": "Iterator"
}
}
},
"optional": false
}
],
"indexers": [],
"exact": false
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1,3 @@
declare class A {
@@asyncIterator(): Iterator<File>;
}

View File

@@ -0,0 +1,225 @@
{
"type": "File",
"start": 0,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "DeclareClass",
"start": 0,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 14,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 15
},
"identifierName": "A"
},
"name": "A"
},
"typeParameters": null,
"extends": [],
"mixins": [],
"body": {
"type": "ObjectTypeAnnotation",
"start": 16,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 3,
"column": 1
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 20,
"end": 53,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 35
}
},
"key": {
"type": "Identifier",
"start": 20,
"end": 35,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 17
},
"identifierName": "@@asyncIterator"
},
"name": "@@asyncIterator"
},
"static": false,
"kind": "init",
"method": true,
"value": {
"type": "FunctionTypeAnnotation",
"start": 20,
"end": 53,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 35
}
},
"params": [],
"rest": null,
"typeParameters": null,
"returnType": {
"type": "GenericTypeAnnotation",
"start": 39,
"end": 53,
"loc": {
"start": {
"line": 2,
"column": 21
},
"end": {
"line": 2,
"column": 35
}
},
"typeParameters": {
"type": "TypeParameterInstantiation",
"start": 47,
"end": 53,
"loc": {
"start": {
"line": 2,
"column": 29
},
"end": {
"line": 2,
"column": 35
}
},
"params": [
{
"type": "GenericTypeAnnotation",
"start": 48,
"end": 52,
"loc": {
"start": {
"line": 2,
"column": 30
},
"end": {
"line": 2,
"column": 34
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 48,
"end": 52,
"loc": {
"start": {
"line": 2,
"column": 30
},
"end": {
"line": 2,
"column": 34
},
"identifierName": "File"
},
"name": "File"
}
}
]
},
"id": {
"type": "Identifier",
"start": 39,
"end": 47,
"loc": {
"start": {
"line": 2,
"column": 21
},
"end": {
"line": 2,
"column": 29
},
"identifierName": "Iterator"
},
"name": "Iterator"
}
}
},
"optional": false
}
],
"indexers": [],
"exact": false
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1 @@
var @@asyncIterator;

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@asyncIterator (1:19)"
}

View File

@@ -0,0 +1 @@
var @@iterator;

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@iterator (1:14)"
}

View File

@@ -0,0 +1,3 @@
class T {
@@asyncIterator(){}
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@asyncIterator (2:17)"
}

View File

@@ -0,0 +1,3 @@
class T {
@@iterator(){}
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@iterator (2:12)"
}

View File

@@ -0,0 +1 @@
type @@iterator = number

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@iterator (1:15)"
}

View File

@@ -0,0 +1 @@
type @@asyncIterator = number

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@asyncIterator (1:20)"
}

View File

@@ -0,0 +1,3 @@
let x = {
@@iterator() {}
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@iterator (2:12)"
}

View File

@@ -0,0 +1,3 @@
let x = {
@@asyncIterator() {}
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@asyncIterator (2:17)"
}

View File

@@ -0,0 +1,3 @@
let x = {
@@random() {}
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Invalid identifier @@random (2:10)"
}

View File

@@ -0,0 +1,3 @@
function foo(): { @@iterator: () => string } {
return (0: any);
}

View File

@@ -0,0 +1,277 @@
{
"type": "File",
"start": 0,
"end": 67,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 67,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 67,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "foo"
},
"name": "foo"
},
"generator": false,
"async": false,
"params": [],
"predicate": null,
"returnType": {
"type": "TypeAnnotation",
"start": 14,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 44
}
},
"typeAnnotation": {
"type": "ObjectTypeAnnotation",
"start": 16,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 44
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 18,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 42
}
},
"key": {
"type": "Identifier",
"start": 18,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 28
},
"identifierName": "@@iterator"
},
"name": "@@iterator"
},
"static": false,
"kind": "init",
"method": false,
"value": {
"type": "FunctionTypeAnnotation",
"start": 30,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 30
},
"end": {
"line": 1,
"column": 42
}
},
"params": [],
"rest": null,
"returnType": {
"type": "StringTypeAnnotation",
"start": 36,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 36
},
"end": {
"line": 1,
"column": 42
}
}
},
"typeParameters": null
},
"variance": null,
"optional": false
}
],
"indexers": [],
"exact": false
}
},
"body": {
"type": "BlockStatement",
"start": 45,
"end": 67,
"loc": {
"start": {
"line": 1,
"column": 45
},
"end": {
"line": 3,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 49,
"end": 65,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 18
}
},
"argument": {
"type": "TypeCastExpression",
"start": 57,
"end": 63,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 16
}
},
"expression": {
"type": "NumericLiteral",
"start": 57,
"end": 58,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 11
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
},
"typeAnnotation": {
"type": "TypeAnnotation",
"start": 58,
"end": 63,
"loc": {
"start": {
"line": 2,
"column": 11
},
"end": {
"line": 2,
"column": 16
}
},
"typeAnnotation": {
"type": "AnyTypeAnnotation",
"start": 60,
"end": 63,
"loc": {
"start": {
"line": 2,
"column": 13
},
"end": {
"line": 2,
"column": 16
}
}
}
},
"extra": {
"parenthesized": true,
"parenStart": 56
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1,3 @@
function foo(): { @@asyncIterator: () => string } {
return (0: any);
}

View File

@@ -0,0 +1,277 @@
{
"type": "File",
"start": 0,
"end": 72,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 72,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 72,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 12
},
"identifierName": "foo"
},
"name": "foo"
},
"generator": false,
"async": false,
"params": [],
"predicate": null,
"returnType": {
"type": "TypeAnnotation",
"start": 14,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 49
}
},
"typeAnnotation": {
"type": "ObjectTypeAnnotation",
"start": 16,
"end": 49,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 49
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 18,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 47
}
},
"key": {
"type": "Identifier",
"start": 18,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 33
},
"identifierName": "@@asyncIterator"
},
"name": "@@asyncIterator"
},
"static": false,
"kind": "init",
"method": false,
"value": {
"type": "FunctionTypeAnnotation",
"start": 35,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 35
},
"end": {
"line": 1,
"column": 47
}
},
"params": [],
"rest": null,
"returnType": {
"type": "StringTypeAnnotation",
"start": 41,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 41
},
"end": {
"line": 1,
"column": 47
}
}
},
"typeParameters": null
},
"variance": null,
"optional": false
}
],
"indexers": [],
"exact": false
}
},
"body": {
"type": "BlockStatement",
"start": 50,
"end": 72,
"loc": {
"start": {
"line": 1,
"column": 50
},
"end": {
"line": 3,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 54,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 18
}
},
"argument": {
"type": "TypeCastExpression",
"start": 62,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 16
}
},
"expression": {
"type": "NumericLiteral",
"start": 62,
"end": 63,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 11
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
},
"typeAnnotation": {
"type": "TypeAnnotation",
"start": 63,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 11
},
"end": {
"line": 2,
"column": 16
}
},
"typeAnnotation": {
"type": "AnyTypeAnnotation",
"start": 65,
"end": 68,
"loc": {
"start": {
"line": 2,
"column": 13
},
"end": {
"line": 2,
"column": 16
}
}
}
},
"extra": {
"parenthesized": true,
"parenStart": 61
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1,3 @@
interface A {
@@iterator(): Iterator<File>;
}

View File

@@ -0,0 +1,225 @@
{
"type": "File",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "InterfaceDeclaration",
"start": 0,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 10,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "A"
},
"name": "A"
},
"typeParameters": null,
"extends": [],
"mixins": [],
"body": {
"type": "ObjectTypeAnnotation",
"start": 12,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 3,
"column": 1
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 16,
"end": 44,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 30
}
},
"key": {
"type": "Identifier",
"start": 16,
"end": 26,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 12
},
"identifierName": "@@iterator"
},
"name": "@@iterator"
},
"static": false,
"kind": "init",
"method": true,
"value": {
"type": "FunctionTypeAnnotation",
"start": 16,
"end": 44,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 30
}
},
"params": [],
"rest": null,
"typeParameters": null,
"returnType": {
"type": "GenericTypeAnnotation",
"start": 30,
"end": 44,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 30
}
},
"typeParameters": {
"type": "TypeParameterInstantiation",
"start": 38,
"end": 44,
"loc": {
"start": {
"line": 2,
"column": 24
},
"end": {
"line": 2,
"column": 30
}
},
"params": [
{
"type": "GenericTypeAnnotation",
"start": 39,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 29
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 39,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 29
},
"identifierName": "File"
},
"name": "File"
}
}
]
},
"id": {
"type": "Identifier",
"start": 30,
"end": 38,
"loc": {
"start": {
"line": 2,
"column": 16
},
"end": {
"line": 2,
"column": 24
},
"identifierName": "Iterator"
},
"name": "Iterator"
}
}
},
"optional": false
}
],
"indexers": [],
"exact": false
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1,3 @@
interface A {
@@asyncIterator(): Iterator<File>;
}

View File

@@ -0,0 +1,225 @@
{
"type": "File",
"start": 0,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "InterfaceDeclaration",
"start": 0,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 10,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "A"
},
"name": "A"
},
"typeParameters": null,
"extends": [],
"mixins": [],
"body": {
"type": "ObjectTypeAnnotation",
"start": 12,
"end": 52,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 3,
"column": 1
}
},
"callProperties": [],
"properties": [
{
"type": "ObjectTypeProperty",
"start": 16,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 35
}
},
"key": {
"type": "Identifier",
"start": 16,
"end": 31,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 17
},
"identifierName": "@@asyncIterator"
},
"name": "@@asyncIterator"
},
"static": false,
"kind": "init",
"method": true,
"value": {
"type": "FunctionTypeAnnotation",
"start": 16,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 35
}
},
"params": [],
"rest": null,
"typeParameters": null,
"returnType": {
"type": "GenericTypeAnnotation",
"start": 35,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 21
},
"end": {
"line": 2,
"column": 35
}
},
"typeParameters": {
"type": "TypeParameterInstantiation",
"start": 43,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 29
},
"end": {
"line": 2,
"column": 35
}
},
"params": [
{
"type": "GenericTypeAnnotation",
"start": 44,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 30
},
"end": {
"line": 2,
"column": 34
}
},
"typeParameters": null,
"id": {
"type": "Identifier",
"start": 44,
"end": 48,
"loc": {
"start": {
"line": 2,
"column": 30
},
"end": {
"line": 2,
"column": 34
},
"identifierName": "File"
},
"name": "File"
}
}
]
},
"id": {
"type": "Identifier",
"start": 35,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 21
},
"end": {
"line": 2,
"column": 29
},
"identifierName": "Iterator"
},
"name": "Iterator"
}
}
},
"optional": false
}
],
"indexers": [],
"exact": false
}
}
],
"directives": []
}
}