ModulePtr staticModule(ObjectPtr x) { switch (x->objKind) { case TYPE : { Type *y = (Type *)x.ptr(); return typeModule(y); } case PRIM_OP : { return primitivesModule(); } case MODULE : { return (Module*)x.ptr(); } case INTRINSIC : { return intrinsicsModule(); } case GLOBAL_VARIABLE : case GLOBAL_ALIAS : case EXTERNAL_PROCEDURE : case EXTERNAL_VARIABLE : case PROCEDURE : case RECORD_DECL : case VARIANT_DECL : { TopLevelItem *t = (TopLevelItem *)x.ptr(); return envModule(t->env); } default : return NULL; } }
ModulePtr staticModule(ObjectPtr x) { switch (x->objKind) { case TYPE : { Type *y = (Type *)x.ptr(); return typeModule(y); } case PRIM_OP : { return primitivesModule(); } case MODULE_HOLDER : { ModuleHolder *mh = (ModuleHolder *)x.ptr(); if (mh->import.ptr()) return mh->import->module; return NULL; } case GLOBAL_VARIABLE : case GLOBAL_ALIAS : case EXTERNAL_PROCEDURE : case EXTERNAL_VARIABLE : case PROCEDURE : case RECORD : case VARIANT : { TopLevelItem *t = (TopLevelItem *)x.ptr(); return envModule(t->env); } default : return NULL; } }