there goes the module

it was ruby after all
should be reborn as twins: namespace and aspect
This commit is contained in:
Torsten Ruger
2015-10-08 22:57:39 +03:00
parent 58b3553251
commit 486e24514b
16 changed files with 25 additions and 202 deletions

View File

@ -1,17 +0,0 @@
class Foo
module Boo
funcall(3 , var)
end
end
-- -- --
s(:expressions,
s(:class, :Foo,
s(:derives, nil),
s(:expressions,
s(:module, :Boo,
s(:expressions,
s(:call,
s(:name, :funcall),
s(:arguments,
s(:int, 3),
s(:name, :var))))))))

View File

@ -1,11 +0,0 @@
module Opers
field int abba = 5
field ref baab
end
-- -- --
s(:expressions,
s(:module, :Opers,
s(:expressions,
s(:class_field, :int, :abba,
s(:int, 5)),
s(:class_field, :ref, :baab))))

View File

@ -1,17 +0,0 @@
module Foo
class Bar
funcall(3 , var)
end
end
-- -- --
s(:expressions,
s(:module, :Foo,
s(:expressions,
s(:class, :Bar,
s(:derives, nil),
s(:expressions,
s(:call,
s(:name, :funcall),
s(:arguments,
s(:int, 3),
s(:name, :var))))))))

View File

@ -1,23 +0,0 @@
module Soho
ofthen(3 , var)
int ofthen(int n,ref m )
return 44
end
end
-- -- --
s(:expressions,
s(:module, :Soho,
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(:return,
s(:int, 44)))))))

View File

@ -1,29 +0,0 @@
module Foo
ref ofthen(int n)
if(0)
isit = 42
else
maybenot = 667
end
end
end
-- -- --
s(:expressions,
s(:module, :Foo,
s(:expressions,
s(:function, :ref,
s(:name, :ofthen),
s(:parameters,
s(:parameter, :int, :n)),
s(:expressions,
s(:if,
s(:condition,
s(:int, 0)),
s(:if_true,
s(:assign,
s(:name, :isit),
s(:int, 42))),
s(:if_false,
s(:assign,
s(:name, :maybenot),
s(:int, 667)))))))))

View File

@ -1,25 +0,0 @@
module Opers
int foo(int x)
int abba = self.index
return abba + 5
end
end
-- -- --
s(:expressions,
s(:module, :Opers,
s(:expressions,
s(:function, :int,
s(:name, :foo),
s(:parameters,
s(:parameter, :int, :x)),
s(:expressions,
s(:field_def, :int, :abba,
s(:field_access,
s(:receiver,
s(:name, :self)),
s(:field,
s(:name, :index)))),
s(:return,
s(:operator, "+",
s(:name, :abba),
s(:int, 5))))))))

View File

@ -1,8 +0,0 @@
module Simple
5
end
-- -- --
s(:expressions,
s(:module, :Simple,
s(:expressions,
s(:int, 5))))

View File

@ -1,20 +0,0 @@
module Fibo
a = 5 + foo
bar( b , a , r)
end
-- -- --
s(:expressions,
s(:module, :Fibo,
s(:expressions,
s(:assign,
s(:name, :a),
s(:operator, "+",
s(:int, 5),
s(:name, :foo))),
s(:call,
s(:name, :bar),
s(:arguments,
s(:name, :b),
s(:name, :a),
s(:name, :r))))))

View File

@ -1,15 +1,14 @@
module Fibo
class Fibo
int fibonaccit(int n)
int a = 0
return a
end
fibonaccit( 10 )
end
-- -- --
s(:expressions,
s(:module, :Fibo,
s(:class, :Fibo,
s(:derives, nil),
s(:expressions,
s(:function, :int,
s(:name, :fibonaccit),
@ -19,8 +18,4 @@ s(:expressions,
s(:field_def, :int, :a,
s(:int, 0)),
s(:return,
s(:name, :a)))),
s(:call,
s(:name, :fibonaccit),
s(:arguments,
s(:int, 10))))))
s(:name, :a)))))))

View File

@ -1,18 +0,0 @@
module FooBo
class Bar
a = 5 + foo
end
end
-- -- --
s(:expressions,
s(:module, :FooBo,
s(:expressions,
s(:class, :Bar,
s(:derives, nil),
s(:expressions,
s(:assign,
s(:name, :a),
s(:operator, "+",
s(:int, 5),
s(:name, :foo))))))))