Skip to content

Commit 47cbadb

Browse files
author
whitequark
committedJul 18, 2015
Revert "Ensure bindings are created in correct order for e.g. "x, y = y, x"."
This reverts commit bcd1832. The bindings are actually created in lexical order, as evident in e.g. "x = lambda: x". The safety provided by this check should be instead provided by a local access analysis.
1 parent 8e1cc8d commit 47cbadb

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed
 

Diff for: ‎artiq/compiler/transforms/asttyped_rewriter.py

+1-14
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,12 @@ def visit_arg(self, node):
108108

109109
def visit_Name(self, node):
110110
if self.in_assign:
111-
# Code like:
111+
# code like:
112112
# x = 1
113113
# def f():
114114
# x = 1
115115
# creates a new binding for x in f's scope
116116
self._assignable(node.id)
117-
else:
118-
# This is duplicated here as well as below so that
119-
# code like:
120-
# x, y = y, x
121-
# where y and x were not defined earlier would be invalid.
122-
if node.id in self.typing_env:
123-
return
124-
for outer_env in reversed(self.env_stack):
125-
if node.id in outer_env:
126-
return
127-
diag = diagnostic.Diagnostic("fatal",
128-
"name '{name}' is not bound to anything", {"name":node.id}, node.loc)
129-
self.engine.process(diag)
130117

131118
def visit_Attribute(self, node):
132119
self.visit_in_assign(node.value, in_assign=False)

0 commit comments

Comments
 (0)
Please sign in to comment.