MCPcopy Create free account
hub / github.com/MMmaXingXing/mini-vue / generate

Function generate

code/src/compiler-core/src/codegen.ts:9–25  ·  view source on GitHub ↗
(ast)

Source from the content-addressed store, hash-verified

7} from "./runtimeHelpers";
8
9export const generate = (ast) => {
10 const context = createCodegenContext();
11 const { push } = context;
12
13 genFunctionPreamble(context, ast);
14 const functionName = "render";
15 const args = ["_ctx", "_cache"];
16 const signature = args.join(",");
17
18 push(`function ${functionName}(${signature}){`);
19 push(`return `);
20 genNode(ast.codegenNode, context);
21 push("}");
22 return {
23 code: context.code
24 };
25};
26const genFunctionPreamble = (context, ast) => {
27 const { push } = context;
28 const vueBinging = "Vue";

Callers 2

baseCompileFunction · 0.90
codegen.spec.tsFile · 0.90

Calls 4

createCodegenContextFunction · 0.70
genFunctionPreambleFunction · 0.70
pushFunction · 0.70
genNodeFunction · 0.70

Tested by

no test coverage detected