Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Dec 16, 2024
1 parent 645a402 commit 6ca952b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,7 @@ describe('compiler: element transform', () => {
`const _on_bar = $event => (_ctx.handleBar($event))`,
)
expect(code).contains(`onBar: () => _on_bar1`)
expect(code).contains(
`const _on_bar1 = () => _ctx.handler`,
)
expect(code).contains(`const _on_bar1 = () => _ctx.handler`)
expect(ir.block.operation).toMatchObject([
{
type: IRNodeTypes.CREATE_COMPONENT_NODE,
Expand Down
7 changes: 2 additions & 5 deletions packages/compiler-vapor/src/generators/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function genCreateComponent(
const inlineHandlers: CodeFragment[] = handlers.reduce<CodeFragment[]>(
(acc, { name, value }) => {
// TODO should support .once modifier on component event
const handler = genEventHandler(context, value, undefined,false)
const handler = genEventHandler(context, value, undefined, false)
return [...acc, `const ${name} = `, ...handler, NEWLINE]
},
[],
Expand Down Expand Up @@ -94,10 +94,7 @@ export function genCreateComponent(
}
}

function getUniqueHandlerName(
context: CodegenContext,
name: string
): string {
function getUniqueHandlerName(context: CodegenContext, name: string): string {
const { seemInlineHandlerNames } = context
const count = seemInlineHandlerNames[name] || 0
seemInlineHandlerNames[name] = count + 1
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-vapor/src/generators/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function genEventHandler(
handlerExp = genWithModifiers(context, handlerExp, nonKeys)
if (keys.length) handlerExp = genWithKeys(context, handlerExp, keys)

if(needWrap) handlerExp.unshift(`() => `)
if (needWrap) handlerExp.unshift(`() => `)
return handlerExp
}

Expand Down

0 comments on commit 6ca952b

Please sign in to comment.