if isinstance(node.rvalue, (pc_ast.GPR, pc_ast.FPR)):
self.__regfetch[str(node.rvalue)].append(node.rvalue)
- stmt = " ".join([
- str(self[node.lvalue]),
- "=",
- str(self[node.rvalue]),
- ])
- self[node].emit(stmt=f"{stmt};")
+ if isinstance(node.lvalue, pc_ast.SubscriptExpr):
+ index = str(self[node.lvalue.index])
+ subject = str(self[node.lvalue.subject])
+ args = ", ".join([
+ f"&{subject}",
+ index,
+ str(self[node.rvalue]),
+ ])
+ self[node].emit(f"oppc_subscript_assign({args});")
+ elif isinstance(node.lvalue, pc_ast.RangeSubscriptExpr):
+ start = str(self[node.lvalue.start])
+ end = str(self[node.lvalue.end])
+ subject = str(self[node.lvalue.subject])
+ args = ", ".join([
+ f"&{subject}",
+ start,
+ end,
+ str(self[node.rvalue]),
+ ])
+ self[node].emit(f"oppc_range_subscript_assign({args});")
+ else:
+ stmt = " ".join([
+ str(self[node.lvalue]),
+ "=",
+ str(self[node.rvalue]),
+ ])
+ self[node].emit(stmt=f"{stmt};")
@pc_util.Hook(pc_ast.BinaryExpr)
def BinaryExpr(self, node):