Last active
December 4, 2017 08:50
-
-
Save thheller/82ca9ef8a04b58aafa4624edbac383ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function someAsyncFn(thing) { | |
var value = await thing; | |
console.log("await value", value); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function someAsyncFn$$module$src$dev$demo$es6(thing) { | |
/** | |
@suppress {uselessCode} | |
*/ | |
function $jscomp$async$generator() { | |
function $jscomp$generator$impl( | |
$jscomp$generator$action$arg, | |
$jscomp$generator$next$arg, | |
$jscomp$generator$throw$arg | |
) { | |
for (; 1; ) { | |
switch ($jscomp$generator$state) { | |
case 0: | |
$jscomp$generator$state = 1; | |
return { value: thing, done: false }; | |
case 1: | |
if (!($jscomp$generator$action$arg == 1)) { | |
$jscomp$generator$state = 2; | |
break; | |
} | |
$jscomp$generator$state = -1; | |
throw $jscomp$generator$throw$arg; | |
case 2: | |
$jscomp$generator$next$arg0 = $jscomp$generator$next$arg; | |
value = $jscomp$generator$next$arg0; | |
console.log("await value", value); | |
$jscomp$generator$state = -1; | |
default: | |
return { value: undefined, done: true }; | |
} | |
} | |
} | |
var $jscomp$generator$state = 0; | |
var value; | |
var $jscomp$generator$next$arg0; | |
var iterator = { | |
next: function(arg) { | |
return $jscomp$generator$impl(0.0, arg, undefined); | |
}, | |
throw: function(arg) { | |
return $jscomp$generator$impl(1.0, undefined, arg); | |
}, | |
return: function(arg) { | |
throw Error("Not yet implemented"); | |
} | |
}; | |
$jscomp.initSymbolIterator(); | |
/** | |
@this {!Generator<?>} | |
*/ | |
iterator[Symbol.iterator] = function() { | |
return this; | |
}; | |
return iterator; | |
} | |
return $jscomp.executeAsyncGenerator($jscomp$async$generator()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment