private void convertYieldOfAsyncGenerator ( NodeTraversal t , LexicalContext ctx , Node yieldNode ) { checkNotNull ( yieldNode ) ; checkState ( yieldNode . isYield ( ) ) ; checkState ( ctx != null && ctx . function != null ) ; checkState ( ctx . function . isAsyncGeneratorFunction ( ) ) ; Node expression = yieldNode . removeFirstChild ( ) ; Node newActionRecord = astFactory . createNewNode ( astFactory . createQName ( t . getScope ( ) , ACTION_RECORD_NAME ) ) ; if ( yieldNode . isYieldAll ( ) ) { checkNotNull ( expression ) ; // yield* expression becomes new ActionRecord(YIELD_STAR, expression) newActionRecord . addChildToBack ( astFactory . createQName ( t . getScope ( ) , ACTION_ENUM_YIELD_STAR ) ) ; newActionRecord . addChildToBack ( expression ) ; } else { if ( expression == null ) { expression = NodeUtil . newUndefinedNode ( null ) ; } // yield expression becomes new ActionRecord(YIELD, expression) newActionRecord . addChildToBack ( astFactory . createQName ( t . getScope ( ) , ACTION_ENUM_YIELD ) ) ; newActionRecord . addChildToBack ( expression ) ; } newActionRecord . useSourceInfoIfMissingFromForTree ( yieldNode ) ; yieldNode . addChildToFront ( newActionRecord ) ; yieldNode . removeProp ( Node . YIELD_ALL ) ; }
Converts a yield into a yield of an ActionRecord to perform YIELD or YIELD_STAR .