Commit de323162 authored by Matthias Braun's avatar Matthias Braun
Browse files

only set oparity_binary/oparity_unary if explicitely specified

oparity_unary, oparity_binary require opindex to be set, which wasn't
always the case.
Also people seem to expect certain semantics from unops/binops, like
being arithmetic operations. So we shouldn't automatically set
oparity_XXX.
parent 6ad7f29b
......@@ -115,14 +115,6 @@ def format_arity(node):
return "oparity_dynamic"
if arity == "variable":
return "oparity_variable"
if arity == 0:
return "oparity_zero"
if arity == 1:
return "oparity_unary"
if arity == 2:
return "oparity_binary"
if arity == 3:
return "oparity_trinary"
return "oparity_any"
def format_pinned(node):
......
......@@ -14,10 +14,11 @@ class Unop(object):
"""Unary nodes have exactly 1 input"""
name = "unop"
ins = [
("op", "operand"),
("op", "operand"),
]
op_index = 0
pinned = "no"
op_index = 0
pinned = "no"
arity_override = "oparity_unary"
@abstract
@op
......@@ -25,11 +26,12 @@ class Binop(object):
"""Binary nodes have exactly 2 inputs"""
name = "binop"
ins = [
( "left", "first operand" ),
( "right", "second operand" ),
("left", "first operand"),
("right", "second operand"),
]
op_index = 0
pinned = "no"
op_index = 0
pinned = "no"
arity_override = "oparity_binary"
@op
class Add(Binop):
......
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