mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
fixed a bug
This commit is contained in:
@@ -102,7 +102,7 @@ void writeCompiler(Compiler* compiler, Node* node) {
|
||||
initLiteralArray(store);
|
||||
|
||||
//emit an array or a dictionary definition
|
||||
if (node->compound.nodes->type == NODE_PAIR) {
|
||||
if (node->compound.literalType == LITERAL_DICTIONARY) {
|
||||
//ensure each literal key and value are in the cache, individually
|
||||
for (int i = 0; i < node->compound.count; i++) {
|
||||
//keys
|
||||
@@ -124,7 +124,7 @@ void writeCompiler(Compiler* compiler, Node* node) {
|
||||
//push the store to the cache, with instructions about how pack it
|
||||
index = pushLiteralArray(&compiler->literalCache, TO_DICTIONARY_LITERAL(store));
|
||||
}
|
||||
else {
|
||||
else if (node->compound.literalType == LITERAL_ARRAY) {
|
||||
//ensure each literal value is in the cache, individually
|
||||
for (int i = 0; i < node->compound.count; i++) {
|
||||
//values
|
||||
@@ -139,6 +139,9 @@ void writeCompiler(Compiler* compiler, Node* node) {
|
||||
//push the store to the cache, with instructions about how pack it
|
||||
index = pushLiteralArray(&compiler->literalCache, TO_ARRAY_LITERAL(store));
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "[Internal] Unrecognized compound type in writeCompiler()");
|
||||
}
|
||||
|
||||
//push the node opcode to the bytecode
|
||||
if (index >= 256) {
|
||||
@@ -325,7 +328,7 @@ unsigned char* collateCompiler(Compiler* compiler, int* size) {
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "[Internal] Unknown literal type encountered within literal cache\n");
|
||||
fprintf(stderr, "[Internal] Unknown literal type encountered within literal cache: %d\n", compiler->literalCache.literals[i].type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user