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

Method emitObjectLiteralExpression

internal/printer/printer.go:2472–2484  ·  view source on GitHub ↗
(node *ast.ObjectLiteralExpression)

Source from the content-addressed store, hash-verified

2470}
2471
2472func (p *Printer) emitObjectLiteralExpression(node *ast.ObjectLiteralExpression) {
2473 state := p.enterNode(node.AsNode())
2474 indented := p.shouldEmitIndented(node.AsNode())
2475 p.increaseIndentIf(indented)
2476 p.pushNameGenerationScope(node.AsNode())
2477 p.generateAllMemberNames(node.Properties)
2478 p.emitList((*Printer).emitObjectLiteralElement, node.AsNode(), node.Properties, LFObjectLiteralExpressionProperties|
2479 core.IfElse(node.MultiLine, LFPreferNewLine, LFNone)|
2480 core.IfElse(p.shouldAllowTrailingComma(node.AsNode(), node.Properties), LFAllowTrailingComma, LFNone))
2481 p.popNameGenerationScope(node.AsNode())
2482 p.decreaseIndentIf(indented)
2483 p.exitNode(node.AsNode(), state)
2484}
2485
2486// 1..toString is a valid property access, emit a dot after the literal
2487// Also emit a dot if expression is a integer const enum value - it will appear in generated code as numeric literal

Callers 1

emitExpressionMethod · 0.95

Calls 12

enterNodeMethod · 0.95
shouldEmitIndentedMethod · 0.95
increaseIndentIfMethod · 0.95
emitListMethod · 0.95
decreaseIndentIfMethod · 0.95
exitNodeMethod · 0.95
IfElseFunction · 0.92
AsNodeMethod · 0.65

Tested by

no test coverage detected