(node *ast.Node, sourceFile *ast.SourceFile)
| 617 | } |
| 618 | |
| 619 | func getAsyncAndAwaitOccurrences(node *ast.Node, sourceFile *ast.SourceFile) []*ast.Node { |
| 620 | fun := ast.GetContainingFunction(node) |
| 621 | if fun == nil { |
| 622 | return nil |
| 623 | } |
| 624 | |
| 625 | var keywords []*ast.Node |
| 626 | |
| 627 | for _, modifier := range fun.ModifierNodes() { |
| 628 | if modifier.Kind == ast.KindAsyncKeyword { |
| 629 | keywords = append(keywords, modifier) |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | fun.ForEachChild(func(child *ast.Node) bool { |
| 634 | traverseWithoutCrossingFunction(child, sourceFile, func(child *ast.Node) { |
| 635 | if ast.IsAwaitExpression(child) { |
| 636 | token := lsutil.GetFirstToken(child, sourceFile) |
| 637 | if token.Kind == ast.KindAwaitKeyword { |
| 638 | keywords = append(keywords, token) |
| 639 | } |
| 640 | } |
| 641 | }) |
| 642 | return false // continue traversal |
| 643 | }) |
| 644 | |
| 645 | return keywords |
| 646 | } |
| 647 | |
| 648 | func getYieldOccurrences(node *ast.Node, sourceFile *ast.SourceFile) []*ast.Node { |
| 649 | parentFunc := ast.FindAncestor(node.Parent, ast.IsFunctionLike) |
no test coverage detected