2013-11-12 17:40:29 +00:00
|
|
|
env = environment()
|
|
|
|
env:add_var("N", Type())
|
|
|
|
env:add_var("x", Const("N"))
|
2013-11-13 22:26:01 +00:00
|
|
|
for v in env:objects() do
|
2013-11-18 02:11:44 +00:00
|
|
|
if v:has_name() then
|
|
|
|
print(v:get_name())
|
|
|
|
end
|
2013-11-12 17:40:29 +00:00
|
|
|
end
|
2013-12-08 07:21:07 +00:00
|
|
|
assert(env:find_object("N"))
|
2013-12-08 22:37:38 +00:00
|
|
|
assert(not env:find_object("Z"))
|
2013-11-12 17:40:29 +00:00
|
|
|
assert(env:find_object("N"):is_var_decl())
|
|
|
|
assert(env:find_object("N"):has_type())
|
|
|
|
assert(env:find_object("N"):has_name())
|
|
|
|
assert(env:find_object("N"):get_type() == Type())
|
|
|
|
assert(env:find_object("N"):get_name() == name("N"))
|
|
|
|
assert(env:find_object("x"):get_type() == Const("N"))
|
|
|
|
assert(not env:has_parent())
|
|
|
|
assert(not env:has_children())
|