MCPcopy
hub / github.com/vuejs/core / genIfStatement

Function genIfStatement

packages/compiler-core/src/codegen.ts:1066–1088  ·  view source on GitHub ↗
(node: IfStatement, context: CodegenContext)

Source from the content-addressed store, hash-verified

1064}
1065
1066function genIfStatement(node: IfStatement, context: CodegenContext) {
1067 const { push, indent, deindent } = context
1068 const { test, consequent, alternate } = node
1069 push(`if (`)
1070 genNode(test, context)
1071 push(`) {`)
1072 indent()
1073 genNode(consequent, context)
1074 deindent()
1075 push(`}`)
1076 if (alternate) {
1077 push(` else `)
1078 if (alternate.type === NodeTypes.JS_IF_STATEMENT) {
1079 genIfStatement(alternate, context)
1080 } else {
1081 push(`{`)
1082 indent()
1083 genNode(alternate, context)
1084 deindent()
1085 push(`}`)
1086 }
1087 }
1088}
1089
1090function genAssignmentExpression(
1091 node: AssignmentExpression,

Callers 1

genNodeFunction · 0.85

Calls 4

genNodeFunction · 0.85
indentFunction · 0.85
deindentFunction · 0.85
pushFunction · 0.70

Tested by

no test coverage detected