Skip to content

Commit 8b39650

Browse files
authored
Merge pull request #1 from estools/master
Sync with escodegen/master
2 parents 124e035 + 819a63b commit 8b39650

File tree

3 files changed

+80
-3
lines changed

3 files changed

+80
-3
lines changed

escodegen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@
953953
};
954954

955955
CodeGenerator.prototype.generateIterationForStatement = function (operator, stmt, flags) {
956-
var result = ['for' + space + (stmt.await ? 'await' + space : '') + '('], that = this;
956+
var result = ['for' + (stmt.await ? noEmptySpace() + 'await' : '') + space + '('], that = this;
957957
withIndent(function () {
958958
if (stmt.left.type === Syntax.VariableDeclaration) {
959959
withIndent(function () {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"escodegen.js",
1515
"package.json"
1616
],
17-
"version": "1.12.0",
17+
"version": "1.12.1",
1818
"engines": {
1919
"node": ">=4.0"
2020
},
@@ -32,7 +32,7 @@
3232
"dependencies": {
3333
"estraverse": "^4.2.0",
3434
"esutils": "^2.0.2",
35-
"esprima": "^3.1.3",
35+
"esprima": "^4.0.1",
3636
"optionator": "^0.8.1"
3737
},
3838
"optionalDependencies": {

test/harmony.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6322,6 +6322,83 @@ data = {
63226322

63236323
},
63246324

6325+
'ES2018 for-await-of with `compact: true`': {
6326+
'async function f(){for await(const x of ait){console.log(x);}}': {
6327+
options: {
6328+
format: {
6329+
compact: true
6330+
}
6331+
},
6332+
generateFrom: {
6333+
"type": "FunctionDeclaration",
6334+
"id": {
6335+
"type": "Identifier",
6336+
"name": "f"
6337+
},
6338+
"params": [],
6339+
"body": {
6340+
"type": "BlockStatement",
6341+
"body": [
6342+
{
6343+
"type": "ForOfStatement",
6344+
"left": {
6345+
"type": "VariableDeclaration",
6346+
"declarations": [
6347+
{
6348+
"type": "VariableDeclarator",
6349+
"id": {
6350+
"type": "Identifier",
6351+
"name": "x"
6352+
},
6353+
"init": null
6354+
}
6355+
],
6356+
"kind": "const"
6357+
},
6358+
"right": {
6359+
"type": "Identifier",
6360+
"name": "ait"
6361+
},
6362+
"body": {
6363+
"type": "BlockStatement",
6364+
"body": [
6365+
{
6366+
"type": "ExpressionStatement",
6367+
"expression": {
6368+
"type": "CallExpression",
6369+
"callee": {
6370+
"type": "MemberExpression",
6371+
"object": {
6372+
"type": "Identifier",
6373+
"name": "console"
6374+
},
6375+
"property": {
6376+
"type": "Identifier",
6377+
"name": "log"
6378+
},
6379+
"computed": false
6380+
},
6381+
"arguments": [
6382+
{
6383+
"type": "Identifier",
6384+
"name": "x"
6385+
}
6386+
]
6387+
}
6388+
}
6389+
]
6390+
},
6391+
"await": true
6392+
}
6393+
]
6394+
},
6395+
"generator": false,
6396+
"async": true
6397+
}
6398+
}
6399+
6400+
},
6401+
63256402
'ES2018 async generator method': {
63266403
'class C {\n async *readLines(file) {\n while (!file.EOF) {\n yield await file.readLine();\n }\n }\n}': {
63276404
generateFrom: {

0 commit comments

Comments
 (0)