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 }