Skip to content

Commit

Permalink
refactor: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Jan 22, 2024
1 parent ff1b4a1 commit e9389ee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions packages/compiler-vapor/__tests__/transforms/vBind.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: undefined,
modifier: undefined,
})

expect(code).matchSnapshot()
Expand All @@ -210,7 +210,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: undefined,
modifier: undefined,
})

expect(code).matchSnapshot()
Expand All @@ -233,7 +233,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: true,
runtimePrefix: undefined,
modifier: undefined,
})

expect(code).matchSnapshot()
Expand All @@ -258,7 +258,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: '.',
modifier: '.',
})

expect(code).matchSnapshot()
Expand All @@ -279,7 +279,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: '.',
modifier: '.',
})

expect(code).matchSnapshot()
Expand All @@ -300,7 +300,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: '.',
modifier: '.',
})

expect(code).matchSnapshot()
Expand All @@ -325,7 +325,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: '.',
modifier: '.',
})

expect(code).matchSnapshot()
Expand All @@ -346,7 +346,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: '.',
modifier: '.',
})

expect(code).matchSnapshot()
Expand All @@ -367,7 +367,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: '^',
modifier: '^',
})

expect(code).matchSnapshot()
Expand All @@ -388,7 +388,7 @@ describe('compiler v-bind', () => {
isStatic: false,
},
runtimeCamelize: false,
runtimePrefix: '^',
modifier: '^',
})

expect(code).matchSnapshot()
Expand Down
8 changes: 4 additions & 4 deletions packages/compiler-vapor/src/generators/prop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export function genSetProp(oper: SetPropIRNode, context: CodegenContext) {
helperName = 'setClass'
} else if (keyName === 'style') {
helperName = 'setStyle'
} else if (oper.runtimePrefix) {
helperName = oper.runtimePrefix === '.' ? 'setDOMProp' : 'setAttr'
} else if (oper.modifier) {
helperName = oper.modifier === '.' ? 'setDOMProp' : 'setAttr'
}

if (helperName) {
Expand Down Expand Up @@ -49,8 +49,8 @@ export function genSetProp(oper: SetPropIRNode, context: CodegenContext) {
() => {
if (oper.runtimeCamelize) {
pushFnCall(helper('camelize'), () => genExpression(oper.key, context))
} else if (oper.runtimePrefix) {
pushMulti([`\`${oper.runtimePrefix}\${`, `}\``], () =>
} else if (oper.modifier) {
pushMulti([`\`${oper.modifier}\${`, `}\``], () =>
genExpression(oper.key, context),
)
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-vapor/src/ir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export interface SetPropIRNode extends BaseIRNode {
element: number
key: IRExpression
value: IRExpression
modifier?: '.' | '^'
runtimeCamelize: boolean
runtimePrefix?: '.' | '^'
}

export interface SetTextIRNode extends BaseIRNode {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-vapor/src/transforms/vBind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const transformVBind: DirectiveTransform = (dir, node, context) => {
key: arg,
value: exp,
runtimeCamelize: camel,
runtimePrefix: modifiers.includes('prop')
modifier: modifiers.includes('prop')
? '.'
: modifiers.includes('attr')
? '^'
Expand Down

0 comments on commit e9389ee

Please sign in to comment.