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

Function genVNodeCall

packages/compiler-core/src/codegen.ts:817–878  ·  packages/compiler-core/src/codegen.ts::genVNodeCall
(node: VNodeCall, context: CodegenContext)

Source from the content-addressed store, hash-verified

815}
816
817function genVNodeCall(node: VNodeCall, context: CodegenContext) {
818 const { push, helper, pure } = context
819 const {
820 tag,
821 props,
822 children,
823 patchFlag,
824 dynamicProps,
825 directives,
826 isBlock,
827 disableTracking,
828 isComponent,
829 } = node
830
831 class="cm">// add dev annotations to patch flags
832 let patchFlagString
833 if (patchFlag) {
834 if (__DEV__) {
835 if (patchFlag < 0) {
836 class="cm">// special flags (negative and mutually exclusive)
837 patchFlagString = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`
838 } else {
839 class="cm">// bitwise flags
840 const flagNames = Object.keys(PatchFlagNames)
841 .map(Number)
842 .filter(n => n > 0 && patchFlag & n)
843 .map(n => PatchFlagNames[n as PatchFlags])
844 .join(`, `)
845 patchFlagString = patchFlag + ` /* ${flagNames} */`
846 }
847 } else {
848 patchFlagString = String(patchFlag)
849 }
850 }
851
852 if (directives) {
853 push(helper(WITH_DIRECTIVES) + `(`)
854 }
855 if (isBlock) {
856 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `)
857 }
858 if (pure) {
859 push(PURE_ANNOTATION)
860 }
861 const callHelper: symbol = isBlock
862 ? getVNodeBlockHelper(context.inSSR, isComponent)
863 : getVNodeHelper(context.inSSR, isComponent)
864 push(helper(callHelper) + `(`, NewlineType.None, node)
865 genNodeList(
866 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]),
867 context,
868 )
869 push(`)`)
870 if (isBlock) {
871 push(`)`)
872 }
873 if (directives) {
874 push(`, `)

Callers 1

genNodeFunction · 0.85

Calls 10

getVNodeBlockHelperFunction · 0.90
getVNodeHelperFunction · 0.90
StringInterface · 0.85
genNodeListFunction · 0.85
genNullableArgsFunction · 0.85
genNodeFunction · 0.85
mapMethod · 0.80
pushFunction · 0.70
helperFunction · 0.70
filterMethod · 0.65

Tested by

no test coverage detected