docs: NewExpression spec

This commit is contained in:
Sven SAULEAU 2017-05-30 20:14:19 +02:00
parent 9bcd85acf3
commit b0386005c8
No known key found for this signature in database
GPG Key ID: 7C3212582FBA1BA2
3 changed files with 135 additions and 0 deletions

View File

@ -908,6 +908,7 @@ A function or method call expression.
```js
interface NewExpression <: CallExpression {
type: "NewExpression";
optional: boolean | null;
}
```

View File

@ -1 +1,3 @@
new C?.()
new C?.(a, b)

View File

@ -0,0 +1,132 @@
{
"type": "File",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 13
}
},
"program": {
"type": "Program",
"start": 0,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 13
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"expression": {
"type": "NewExpression",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"callee": {
"type": "Identifier",
"start": 4,
"end": 5,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
},
"identifierName": "C"
},
"name": "C"
},
"arguments": [],
"optional": true
}
},
{
"type": "ExpressionStatement",
"start": 11,
"end": 24,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 13
}
},
"expression": {
"type": "NewExpression",
"start": 11,
"end": 24,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 13
}
},
"callee": {
"type": "Identifier",
"start": 4,
"end": 5,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
},
"identifierName": "C"
},
"name": "C"
},
"arguments": [],
"optional": true
}
}
],
"directives": []
}
}