From 314169bba6407138ac421717a1f1a516321acd19 Mon Sep 17 00:00:00 2001 From: Petar Dambovaliev Date: Wed, 15 May 2024 15:41:29 +0200 Subject: [PATCH] save --- gnovm/pkg/gnolang/preprocess.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/gnovm/pkg/gnolang/preprocess.go b/gnovm/pkg/gnolang/preprocess.go index e2f7e74b5ad..38931e91f6e 100644 --- a/gnovm/pkg/gnolang/preprocess.go +++ b/gnovm/pkg/gnolang/preprocess.go @@ -2727,19 +2727,17 @@ func findUndefined(store Store, last BlockNode, x Expr) (un Name) { // finds the next undefined identifier and returns it if it is global func findUndefined2SkipLocals(store Store, last BlockNode, x Expr, t Type) Name { - pkg := packageOf(last) name := findUndefined2(store, last, x, t) - if name == "" { - return "" - } - - _, _, ok := pkg.FileSet.GetDeclForSafe(name) + if name != "" { + pkg := packageOf(last) - // skip it if it's a local identifier - if !ok { - return "" + if _, _, ok := pkg.FileSet.GetDeclForSafe(name); !ok { + // skip it if it's a local identifier + return "" + } } + return name }