Compare commits

..

No commits in common. "a337e26229bbd820710d25a86f4e8d71894ead2b" and "7f5e3ae8dcf7b6f717af75b62d69a9729935b1ea" have entirely different histories.

2 changed files with 6 additions and 30 deletions

View File

@ -182,32 +182,6 @@ int cosmoB_ogetProto(CState *state, int nargs, CValue *args)
return 1; // 1 result
}
int cosmoB_ogetKeys(CState *state, int nargs, CValue *args)
{
if (nargs != 1)
cosmoV_error(state, "Expected 1 argument, got %d!", nargs);
if (!IS_OBJECT(args[0])) {
cosmoV_typeError(state, "object.__keys", "<object>", "%s", cosmoV_typeStr(args[0]));
}
// push keys
CObjObject *obj = cosmoV_readObject(args[0]);
int cap = cosmoT_getCapacity(&obj->tbl);
int indx = 0;
for (int i = 0; i < cap; i++) {
CTableEntry *entry = &obj->tbl.table[i];
if (IS_NIL(entry->key))
continue;
cosmoV_pushNumber(state, indx++);
cosmoV_pushValue(state, entry->key);
}
cosmoV_makeTable(state, indx);
return 1; // 1 result
}
int cosmoB_oisChild(CState *state, int nargs, CValue *args)
{
if (nargs != 2) {
@ -229,9 +203,9 @@ int cosmoB_oisChild(CState *state, int nargs, CValue *args)
COSMO_API void cosmoB_loadObjLib(CState *state)
{
const char *identifiers[] = {"ischild", "keys"};
const char *identifiers[] = {"ischild"};
CosmoCFunction objLib[] = {cosmoB_oisChild, cosmoB_ogetKeys};
CosmoCFunction objLib[] = {cosmoB_oisChild};
// make object library object
cosmoV_pushString(state, "object");
@ -239,11 +213,11 @@ COSMO_API void cosmoB_loadObjLib(CState *state)
// make __getter object for debug proto
cosmoV_pushString(state, "__getter");
// key & value pairs
// key & value pair
cosmoV_pushString(state, "__proto"); // key
cosmoV_pushCFunction(state, cosmoB_ogetProto); // value
cosmoV_makeTable(state, 2);
cosmoV_makeTable(state, 1);
// make __setter table
cosmoV_pushString(state, "__setter");

View File

@ -592,6 +592,8 @@ static void group(CParseState *pstate, bool canAssign, Precedence prec)
consume(pstate, TOKEN_RIGHT_PAREN, "Expected ')'");
}
#define WRITE_GLOBAL_OP(pstate, op, arg)
static void _etterAB(CParseState *pstate, uint8_t a, int b, bool isGlobal)
{
writeu8(pstate, a);