Bif const: make sure const is indeed a constant.

This commit is contained in:
Gregor Maier 2011-02-14 10:43:26 -08:00
parent 782f007b5c
commit f3aa7b2fac
3 changed files with 13 additions and 1 deletions

View file

@ -343,6 +343,17 @@ Val* internal_val(const char* name)
return id->ID_Val();
}
Val* internal_const_val(const char* name)
{
ID* id = lookup_ID(name, GLOBAL_MODULE_NAME);
if ( ! id )
internal_error("internal variable %s missing", name);
if ( ! id->IsConst())
internal_error("internal variable %s is not constant", name);
return id->ID_Val();
}
Val* opt_internal_val(const char* name)
{
ID* id = lookup_ID(name, GLOBAL_MODULE_NAME);