Skip to content

Commit b200a70

Browse files
committed
fix(transformer): 循环中有 if-else 时生成匿名表达式位置错误,close #2352
1 parent 5e0bf68 commit b200a70

File tree

1 file changed

+1
-1
lines changed
  • packages/taro-transformer-wx/src

1 file changed

+1
-1
lines changed

packages/taro-transformer-wx/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export function generateAnonymousState (
226226
func.body.body.unshift(buildConstVariableDeclaration(variableName, expr))
227227
} else {
228228
func.body.body.unshift(t.variableDeclaration('let', [t.variableDeclarator(t.identifier(variableName), t.nullLiteral())]))
229-
consequent.node.body.unshift(t.expressionStatement(t.assignmentExpression(
229+
consequent.node.body.push(t.expressionStatement(t.assignmentExpression(
230230
'=',
231231
t.identifier(variableName),
232232
expr

0 commit comments

Comments
 (0)