Environment
metaobjects represent bindings between names and
types.
If the name denotes a variable, it is bound to the type of that variable.
Otherwise, if the name denotes a type, it is bound to the type itself.
Programmers can look up names by the following
member functions on Environment
metaobjects:
Dump()
Lookup(Ptree* name, bool& is_type_name, TypeInfo& t)
Lookup(Ptree* name, TypeInfo& t)
LookupClassMetaobject(Ptree* class_name)
bool Lookup(Ptree* name, bool& is_type_name, TypeInfo& t)
This looks up the given name
into the environment and
returns true
if found. The type of name
is returned at t
.
If the name is a type name, is_type_name
is set to true
. If it is a variable name, is_type_name
is set to false
.
bool Lookup(Ptree* name, TypeInfo& t)
This is an alias of Lookup(Ptree*, bool&, TypeInfo&)
described above.
Class* LookupClassMetaobject(Ptree* class_name)
This looks up the given class_name
and returns the Class
metaobject of the type.
If the class_name
is not found, this function returns nil
(class_name
may be a variable name.)
void Dump()
This is for debugging and prints the elements in the environment on stderr.