File tree Expand file tree Collapse file tree 2 files changed +73
-1
lines changed Expand file tree Collapse file tree 2 files changed +73
-1
lines changed Original file line number Diff line number Diff line change 951951 } ;
952952
953953 CodeGenerator . prototype . generateIterationForStatement = function ( operator , stmt , flags ) {
954- var result = [ 'for' + space + '(' ] , that = this ;
954+ var result = [ 'for' + space + ( stmt . await ? 'await' + space : '' ) + '(' ] , that = this ;
955955 withIndent ( function ( ) {
956956 if ( stmt . left . type === Syntax . VariableDeclaration ) {
957957 withIndent ( function ( ) {
Original file line number Diff line number Diff line change @@ -6208,6 +6208,78 @@ data = {
62086208 "async" : true
62096209 }
62106210 } ,
6211+ } ,
6212+
6213+ 'ES2018 for-await-of' : {
6214+ 'async function f() {\n for await (const x of ait) {\n console.log(x);\n }\n}' : {
6215+ generateFrom : {
6216+ "type" : "FunctionDeclaration" ,
6217+ "id" : {
6218+ "type" : "Identifier" ,
6219+ "name" : "f"
6220+ } ,
6221+ "params" : [ ] ,
6222+ "body" : {
6223+ "type" : "BlockStatement" ,
6224+ "body" : [
6225+ {
6226+ "type" : "ForOfStatement" ,
6227+ "left" : {
6228+ "type" : "VariableDeclaration" ,
6229+ "declarations" : [
6230+ {
6231+ "type" : "VariableDeclarator" ,
6232+ "id" : {
6233+ "type" : "Identifier" ,
6234+ "name" : "x"
6235+ } ,
6236+ "init" : null
6237+ }
6238+ ] ,
6239+ "kind" : "const"
6240+ } ,
6241+ "right" : {
6242+ "type" : "Identifier" ,
6243+ "name" : "ait"
6244+ } ,
6245+ "body" : {
6246+ "type" : "BlockStatement" ,
6247+ "body" : [
6248+ {
6249+ "type" : "ExpressionStatement" ,
6250+ "expression" : {
6251+ "type" : "CallExpression" ,
6252+ "callee" : {
6253+ "type" : "MemberExpression" ,
6254+ "object" : {
6255+ "type" : "Identifier" ,
6256+ "name" : "console"
6257+ } ,
6258+ "property" : {
6259+ "type" : "Identifier" ,
6260+ "name" : "log"
6261+ } ,
6262+ "computed" : false
6263+ } ,
6264+ "arguments" : [
6265+ {
6266+ "type" : "Identifier" ,
6267+ "name" : "x"
6268+ }
6269+ ]
6270+ }
6271+ }
6272+ ]
6273+ } ,
6274+ "await" : true
6275+ }
6276+ ]
6277+ } ,
6278+ "generator" : false ,
6279+ "async" : true
6280+ }
6281+ }
6282+
62116283 }
62126284} ;
62136285
You can’t perform that action at this time.
0 commit comments