soml-parser/test/cases/class_definition/class_function.tst
2015-10-09 17:21:15 +03:00

37 lines
821 B
Scilab

class Pifi
ofthen(3 , var)
int self.ofthen(int n , ref m)
n = n + m.index
return n
end
end
-- -- --
s(:expressions,
s(:class, :Pifi,
s(:derives, nil),
s(:expressions,
s(:call,
s(:name, :ofthen),
s(:arguments,
s(:int, 3),
s(:name, :var))),
s(:function, :int,
s(:name, :ofthen),
s(:parameters,
s(:parameter, :int, :n),
s(:parameter, :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))),
s(:receiver, :self)))))