# HG changeset patch # User Paul Boddie # Date 1693604513 -7200 # Node ID 15feae4d469e03b9487878cdc411a37713b31e64 # Parent 2957d8a7ccfb343e7eb4fcd9f24682d428e3afc3 Use a normal built-in for the special __loop_exit instance. diff -r 2957d8a7ccfb -r 15feae4d469e common.py --- a/common.py Fri Sep 01 19:35:20 2023 +0200 +++ b/common.py Fri Sep 01 23:41:53 2023 +0200 @@ -623,7 +623,7 @@ # raise LoopExit [(compiler.ast.Name("StopIteration"), None, - compiler.ast.Raise(compiler.ast.Name("$loop_exit")))], + compiler.ast.Raise(compiler.ast.Name("__loop_exit")))], None), # ... = diff -r 2957d8a7ccfb -r 15feae4d469e inspector.py --- a/inspector.py Fri Sep 01 19:35:20 2023 +0200 +++ b/inspector.py Fri Sep 01 23:41:53 2023 +0200 @@ -907,20 +907,6 @@ self.set_special(n.name, value) return value - # Special case for loops. - - elif n.name == "$loop_exit": - - # Attempt to get a reference. - - ref = self.get_builtin("__loop_exit") - - # Record the imported name and provide the resolved name reference. - - value = ResolvedNameRef(n.name, ref) - self.set_special(n.name, value) - return value - # Test for self usage, which is only allowed in methods. if n.name == "self" and not (self.in_function and self.in_class): diff -r 2957d8a7ccfb -r 15feae4d469e resolving.py --- a/resolving.py Fri Sep 01 19:35:20 2023 +0200 +++ b/resolving.py Fri Sep 01 23:41:53 2023 +0200 @@ -3,7 +3,7 @@ """ Name resolution. -Copyright (C) 2016, 2017, 2023 Paul Boddie +Copyright (C) 2016, 2017 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -73,11 +73,7 @@ for name, value in self.special.items(): ref, paths = value - - # Handle special instances. - - origin = ref.is_well_defined_instance() and ref.get_name() or ref.get_origin() - self.special[name] = self.importer.identify(origin), paths + self.special[name] = self.importer.identify(ref.get_origin()), paths def check_names_used(self): diff -r 2957d8a7ccfb -r 15feae4d469e translator.py --- a/translator.py Fri Sep 01 19:35:20 2023 +0200 +++ b/translator.py Fri Sep 01 23:41:53 2023 +0200 @@ -1619,8 +1619,7 @@ # function names to references. elif n.name.startswith("$L") or n.name.startswith("$op") or \ - n.name.startswith("$seq") or n.name.startswith("$print") or \ - n.name == "$loop_exit": + n.name.startswith("$seq") or n.name.startswith("$print"): ref, paths = self.importer.get_module(self.name).special[n.name] return TrResolvedNameRef(n.name, ref)