-void callBuiltinField(Thread* thread, size_t argumentCount) {
- assert(argumentCount == 2);
-
- assert(!Stack_isEmpty(&(thread->stack)));
- Object key = Stack_pop(&(thread->stack));
- assert(key.type == SYMBOL);
-
- assert(!Stack_isEmpty(&(thread->stack)));
- Object structure = Stack_pop(&(thread->stack));
- assert(structure.type == STRUCTURE);
-
- while(structure.value.structure != NULL) {
- if(strcmp(structure.value.structure->key, key.value.string) == 0) {
- Stack_push(&(thread->stack), structure.value.structure->value);
- return;
- }
- structure.value.structure = structure.value.structure->next;
- }
-
- assert(false); // Symbol wasn't found in structure
-}
-