MCPcopy Create free account
hub / github.com/microsoft/typescript-go / VisitEmbeddedStatement

Method VisitEmbeddedStatement

internal/ast/visitor.go:74–84  ·  view source on GitHub ↗

Visits an embedded Statement (i.e., the single statement body of a loop, `if..else` branch, etc.), possibly returning a new Statement in its place. - If the input node is nil, then the output is nil. - If v.Visit is nil, then the output is the input. - If v.Visit returns nil, then the output is nil

(node *Statement)

Source from the content-addressed store, hash-verified

72// - If v.Visit returns nil, then the output is nil.
73// - If v.Visit returns a SyntaxList Node, then the output is either the only child of the SyntaxList Node, or a Block containing the nodes in the list.
74func (v *NodeVisitor) VisitEmbeddedStatement(node *Statement) *Statement {
75 if node == nil || v.Visit == nil {
76 return node
77 }
78
79 visited := v.Visit(node)
80 if visited == nil {
81 return nil
82 }
83 return v.liftToBlock(visited)
84}
85
86// Visits a NodeList, possibly returning a new NodeList in its place.
87//

Calls 1

liftToBlockMethod · 0.95

Tested by

no test coverage detected