From 7876c1aec047d151bc72031ce2820b4bb9b8c184 Mon Sep 17 00:00:00 2001 From: ctw-ian Date: Tue, 2 Aug 2022 15:22:48 +0800 Subject: [PATCH] Fix incorrect lexical env implementation in ForInStatement Fix incorrect lexical env creation per-iteration in ForInStatement Issue:I5K5I8 Signed-off-by: ctw-ian Change-Id: I2b517f031d7096cb1e80853cfd971692bc0e7542 --- es2panda/ir/statements/forInStatement.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/es2panda/ir/statements/forInStatement.cpp b/es2panda/ir/statements/forInStatement.cpp index e70fd6f324..1ab3d527fb 100644 --- a/es2panda/ir/statements/forInStatement.cpp +++ b/es2panda/ir/statements/forInStatement.cpp @@ -63,9 +63,8 @@ void ForInStatement::Compile([[maybe_unused]] compiler::PandaGen *pg) const pg->LoadAccumulator(this, propName); lref.SetValue(); - compiler::LoopEnvScope declEnvScope(pg, scope_->DeclScope()); - { + compiler::LoopEnvScope declEnvScope(pg, scope_->DeclScope()); compiler::LoopEnvScope envScope(pg, scope_, labelTarget); body_->Compile(pg); } -- Gitee