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

Function flattenChain

internal/transformers/estransforms/optionalchain.go:135–144  ·  view source on GitHub ↗
(chain *ast.Node)

Source from the content-addressed store, hash-verified

133}
134
135func flattenChain(chain *ast.Node) flattenResult {
136 debug.Assert(!isNonNullChain(chain))
137 links := []*ast.Node{chain}
138 for !ast.IsTaggedTemplateExpression(chain) && chain.QuestionDotToken() == nil {
139 chain = ast.SkipPartiallyEmittedExpressions(chain.Expression())
140 debug.Assert(!isNonNullChain(chain))
141 links = append([]*ast.Node{chain}, links...)
142 }
143 return flattenResult{chain.Expression(), links}
144}
145
146func isCallChain(node *ast.Node) bool {
147 return ast.IsCallExpression(node) && node.Flags&ast.NodeFlagsOptionalChain != 0

Callers 1

Calls 7

AssertFunction · 0.92
isNonNullChainFunction · 0.85
QuestionDotTokenMethod · 0.80
ExpressionMethod · 0.80
appendFunction · 0.50

Tested by

no test coverage detected