From 191ab853d41871b46409505a5b62a972e47eb334 Mon Sep 17 00:00:00 2001 From: tanhauhau Date: Thu, 13 Oct 2022 21:38:21 +0800 Subject: [PATCH] use find_owner instead --- src/compiler/compile/nodes/shared/Expression.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/compiler/compile/nodes/shared/Expression.ts b/src/compiler/compile/nodes/shared/Expression.ts index b34d139ae8..7c911e07de 100644 --- a/src/compiler/compile/nodes/shared/Expression.ts +++ b/src/compiler/compile/nodes/shared/Expression.ts @@ -153,16 +153,7 @@ export default class Expression { variable[deep ? 'mutated' : 'reassigned'] = true; } - let current_scope = scope; - let declaration; - - while (current_scope) { - if (current_scope.declarations.has(name)) { - declaration = current_scope.declarations.get(name); - break; - } - current_scope = current_scope.parent; - } + const declaration: any = scope.find_owner(name)?.declarations.get(name); if (declaration) { if (declaration.kind === 'const' && !deep) {