2015-09-18 20:55:02 +02:00
|
|
|
class Pifi
|
|
|
|
ofthen(3 , var)
|
|
|
|
int ofthen(int n , ref m)
|
2015-09-20 11:50:06 +02:00
|
|
|
n = n + m.index
|
|
|
|
return n
|
2015-09-18 20:55:02 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
-- -- --
|
2015-09-20 11:50:06 +02:00
|
|
|
s(:expressions,
|
|
|
|
s(:class, :Pifi,
|
|
|
|
s(:derives, nil),
|
|
|
|
s(:call,
|
|
|
|
s(:name, :ofthen),
|
|
|
|
s(:arguments,
|
|
|
|
s(:int, 3),
|
|
|
|
s(:name, :var))),
|
|
|
|
s(:function, :int,
|
|
|
|
s(:name, :ofthen),
|
|
|
|
s(:parameters,
|
|
|
|
s(:field, :int, :n),
|
|
|
|
s(:field, :ref, :m)),
|
|
|
|
s(:expressions,
|
|
|
|
s(:assign,
|
|
|
|
s(:name, :n),
|
|
|
|
s(:operator, "+",
|
|
|
|
s(:name, :n),
|
|
|
|
s(:field_access,
|
|
|
|
s(:receiver,
|
|
|
|
s(:name, :m)),
|
|
|
|
s(:field,
|
|
|
|
s(:name, :index))))),
|
|
|
|
s(:return,
|
|
|
|
s(:name, :n))))))
|