MCPcopy Create free account
hub / github.com/Effect-TS/tsgo / AnalyzeNestedEffectGenYield

Function AnalyzeNestedEffectGenYield

internal/rules/nested_effect_gen_yield.go:44–72  ·  view source on GitHub ↗
(tp *typeparser.TypeParser, sf *ast.SourceFile)

Source from the content-addressed store, hash-verified

42}
43
44func AnalyzeNestedEffectGenYield(tp *typeparser.TypeParser, sf *ast.SourceFile) []NestedEffectGenYieldMatch {
45 var matches []NestedEffectGenYieldMatch
46
47 var walk ast.Visitor
48 walk = func(node *ast.Node) bool {
49 if node == nil {
50 return false
51 }
52
53 if node.Kind == ast.KindYieldExpression {
54 yieldExpr := node.AsYieldExpression()
55 if yieldExpr != nil && yieldExpr.AsteriskToken != nil && yieldExpr.Expression != nil {
56 if tp.GetEffectContextFlags(node)&typeparser.EffectContextFlagCanYieldEffect != 0 {
57 if tp.EffectGenCall(yieldExpr.Expression) != nil {
58 matches = append(matches, NestedEffectGenYieldMatch{
59 Location: scanner.GetErrorRangeForNode(sf, yieldExpr.Expression),
60 })
61 }
62 }
63 }
64 }
65
66 node.ForEachChild(walk)
67 return false
68 }
69
70 walk(sf.AsNode())
71 return matches
72}

Callers 1

Calls 2

GetEffectContextFlagsMethod · 0.80
EffectGenCallMethod · 0.80

Tested by

no test coverage detected