full tracking of the characteristics of globals when compiling scripts to C++

This commit is contained in:
Vern Paxson 2025-09-15 14:21:32 -07:00
parent b25a844210
commit bfc6508dff
6 changed files with 48 additions and 22 deletions

View file

@ -135,12 +135,21 @@ void activate_bodies__CPP(const char* fn, const char* module, bool exported, Typ
event_registry->Register(e);
}
IDPtr lookup_global__CPP(const char* g, const TypePtr& t, bool exported) {
IDPtr lookup_global__CPP(const char* g, const TypePtr& t, const GlobalCharacteristics& gc) {
auto gl = lookup_ID(g, GLOBAL_MODULE_NAME, false, false, false);
if ( ! gl ) {
gl = install_ID(g, GLOBAL_MODULE_NAME, true, exported);
gl = install_ID(g, GLOBAL_MODULE_NAME, true, gc.is_exported);
gl->SetType(t);
if ( gc.is_const )
gl->SetConst();
if ( gc.is_option )
gl->SetOption();
if ( gc.is_enum_const )
gl->SetEnumConst();
if ( gc.is_type )
gl->MakeType();
}
return gl;