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 17, 2024
1 parent 0f472c0 commit 1859348
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/compiler-vapor/src/generators/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ export function genEffects(
for (let i = 0; i < effects.length; i++) {
const effect = effects[i]
operationsCount += effect.operations.length
const frags = context.withId(
() => genEffect(effect, context),
ids
)
const frags = context.withId(() => genEffect(effect, context), ids)
i > 0 && push(NEWLINE)
if (frag[frag.length - 1] === ')' && frags[0] === '(') {
push(';')
Expand Down Expand Up @@ -136,32 +133,34 @@ export function genEffect(
}

function genDeclarations(
declarations: { key: string, value: SimpleExpressionNode}[],
declarations: { key: string; value: SimpleExpressionNode }[],
context: CodegenContext,
): [Record<string, null>,CodeFragment[]] {
): [Record<string, null>, CodeFragment[]] {
const [frag, push] = buildCodeFragment()
const ids: Record<string, null> = Object.create(null)
for (let i = 0; i < declarations.length; i++) {
const {key,value} = declarations[i]
const { key, value } = declarations[i]
ids[key] = null
push(`const ${key} = `, ...genExpression(value,context), ';', NEWLINE)
push(`const ${key} = `, ...genExpression(value, context), ';', NEWLINE)
}
return [ids, frag]
}

function processExpressions(
context: CodegenContext
): { key: string, value: SimpleExpressionNode}[] {
const { block: { expressions } } = context
const declarations: { key: string, value: SimpleExpressionNode}[] = []
context: CodegenContext,
): { key: string; value: SimpleExpressionNode }[] {
const {
block: { expressions },
} = context
const declarations: { key: string; value: SimpleExpressionNode }[] = []
expressions.forEach(exp => {
const oldExp = extend({}, exp)
const varName = `_${exp.content
.replace(/[^a-zA-Z0-9]/g, '_')
.replace(/_+/g, '_')}`
exp.ast = null
exp.content = varName
if(!declarations.some(declaration => declaration.key === varName)) {
if (!declarations.some(declaration => declaration.key === varName)) {
declarations.push({
key: varName,
value: oldExp,
Expand Down

0 comments on commit 1859348

Please sign in to comment.