This commit is contained in:
Vasilii Rogin 2023-04-20 02:51:20 +03:00
parent 9549bab517
commit a51ece60ac
1 changed files with 7 additions and 1 deletions

View File

@ -46,6 +46,7 @@ ArrayId CreateArray(int len, uint32_t flags)
if (len < 0) {
flags |= SFALL_ARRAYFLAG_ASSOC;
// TODO: Implement
throw(std::invalid_argument("Not implemented yet"));
};
@ -87,7 +88,7 @@ ProgramValue GetArrayKey(ArrayId array_id, int index)
if (index == -1) { // special index to indicate if array is associative
throw(std::invalid_argument("Not implemented yet"));
};
// TODO: if assoc
// TODO: assoc
return SFallScriptValue(index);
}
@ -97,6 +98,9 @@ int LenArray(ArrayId array_id)
if (arr == nullptr) {
return -1;
};
// TODO: assoc
return arr->size();
}
@ -125,6 +129,8 @@ void SetArray(ArrayId array_id, const SFallScriptValue& key, const SFallScriptVa
return;
};
// TODO: assoc
if (key.isInt()) {
auto index = key.asInt();
if (index >= 0 && index < arr->size()) {