3e1fd06903
After this commit, a value of type 'expr' cannot be a reference to nullptr. This commit also fixes several bugs due to the use of 'null' expressions. TODO: do the same for kernel objects, sexprs, etc. Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
18 lines
569 B
Lua
18 lines
569 B
Lua
env = environment()
|
|
env:add_var("N", Type())
|
|
env:add_var("x", Const("N"))
|
|
for v in env:objects() do
|
|
if v:has_name() then
|
|
print(v:get_name())
|
|
end
|
|
end
|
|
assert(env:find_object("N"))
|
|
assert(env:find_object("Z"):is_null())
|
|
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())
|