Commit c006cc2b authored by Stefan Behnel's avatar Stefan Behnel

implement in-place assignment operators on SliceIndexNode by converting it into an IndexNode

parent c3d51649
...@@ -1091,7 +1091,13 @@ def p_expression_or_assignment(s): ...@@ -1091,7 +1091,13 @@ def p_expression_or_assignment(s):
if len(expr_list) == 1: if len(expr_list) == 1:
if re.match(r"([+*/\%^\&|-]|<<|>>|\*\*|//)=", s.sy): if re.match(r"([+*/\%^\&|-]|<<|>>|\*\*|//)=", s.sy):
lhs = expr_list[0] lhs = expr_list[0]
if not isinstance(lhs, (ExprNodes.AttributeNode, ExprNodes.IndexNode, ExprNodes.NameNode) ): if isinstance(lhs, ExprNodes.SliceIndexNode):
# implementation requires IndexNode
lhs = ExprNodes.IndexNode(
lhs.pos,
base=lhs.base,
index=make_slice_node(lhs.pos, lhs.start, lhs.stop))
elif not isinstance(lhs, (ExprNodes.AttributeNode, ExprNodes.IndexNode, ExprNodes.NameNode) ):
error(lhs.pos, "Illegal operand for inplace operation.") error(lhs.pos, "Illegal operand for inplace operation.")
operator = s.sy[:-1] operator = s.sy[:-1]
s.next() s.next()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment