if isinstance(node.rvalue, pc_ast.Attribute):
self.fixup_attr(node=node.rvalue)
+ if isinstance(node.lvalue, pc_ast.Sequence):
+ if not isinstance(node.rvalue, pc_ast.Sequence):
+ raise ValueError(node.rvalue)
+ if len(node.lvalue) != len(node.rvalue):
+ raise ValueError(node)
+ for (lvalue, rvalue) in zip(node.lvalue, node.rvalue):
+ assign = node.__class__(
+ lvalue=lvalue.clone(),
+ rvalue=rvalue.clone(),
+ )
+ self.traverse(root=assign)
+ for (level, stmt) in self[assign]:
+ self[node].emit(stmt=stmt, level=level)
+ return
+
if isinstance(node.lvalue, pc_ast.SubscriptExpr):
call = self.call(name="oppc_subscript_assign", node=node, stmt=True, code=[
self[node.lvalue.subject],
def AttributeName(self, node):
yield node
+ @pc_util.Hook(pc_ast.Sequence)
+ def Sequence(self, node):
+ yield node
+
@pc_util.Hook(pc_ast.Attribute)
def Attribute(self, node):
yield node