added foreach()

This commit is contained in:
2020-12-12 18:16:31 -06:00
parent 219a87c79c
commit ec8f5e7e4f
3 changed files with 42 additions and 0 deletions

View File

@@ -111,6 +111,11 @@ static inline bool isObjType(CValue val, CObjType type) {
return IS_OBJ(val) && cosmoV_readObj(val)->type == type;
}
// just protects against macro expansion
static inline bool IS_CALLABLE(CValue val) {
return IS_CLOSURE(val) || IS_CFUNCTION(val);
}
CObj *cosmoO_allocateBase(CState *state, size_t sz, CObjType type);
void cosmoO_free(CState *state, CObj* obj);