This repository was archived by the owner on Jul 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
packages/compiler-vapor/src Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -23,16 +23,15 @@ import { transformVOn } from './transforms/vOn'
2323import { transformVShow } from './transforms/vShow'
2424import { transformRef } from './transforms/transformRef'
2525import { transformText } from './transforms/transformText'
26- import type { HackOptions } from './ir'
2726import { transformVModel } from './transforms/vModel'
2827import { transformVIf } from './transforms/vIf'
2928import { transformVFor } from './transforms/vFor'
3029import { transformComment } from './transforms/transformComment'
30+ import type { HackOptions } from './ir'
3131
3232export { wrapTemplate } from './transforms/utils'
3333
34- // TODO: copied from @vue /compiler-core
35- // code/AST -> IR -> JS codegen
34+ // code/AST -> IR (transform) -> JS (generate)
3635export function compile (
3736 source : string | RootNode ,
3837 options : CompilerOptions = { } ,
Original file line number Diff line number Diff line change @@ -89,10 +89,7 @@ export class TransformContext<T extends AllNode = AllNode> {
8989 this . root = this as TransformContext < RootNode >
9090 }
9191
92- enterBlock (
93- ir : TransformContext [ 'block' ] ,
94- isVFor : boolean = false ,
95- ) : ( ) => void {
92+ enterBlock ( ir : BlockIRNode , isVFor : boolean = false ) : ( ) => void {
9693 const { block, template, dynamic, childrenTemplate } = this
9794 this . block = ir
9895 this . dynamic = ir . dynamic
@@ -205,26 +202,26 @@ const defaultOptions = {
205202
206203// AST -> IR
207204export function transform (
208- root : RootNode ,
205+ node : RootNode ,
209206 options : TransformOptions = { } ,
210207) : RootIRNode {
211208 const ir : RootIRNode = {
212209 type : IRNodeTypes . ROOT ,
213- node : root ,
214- source : root . source ,
210+ node,
211+ source : node . source ,
215212 template : [ ] ,
216213 component : new Set ( ) ,
217214 block : {
218215 type : IRNodeTypes . BLOCK ,
219- node : root ,
216+ node,
220217 dynamic : newDynamic ( ) ,
221218 effect : [ ] ,
222219 operation : [ ] ,
223220 returns : [ ] ,
224221 } ,
225222 }
226223
227- const context = new TransformContext ( ir , root , options )
224+ const context = new TransformContext ( ir , node , options )
228225
229226 transformNode ( context )
230227
You can’t perform that action at this time.
0 commit comments