Famous last words: I think I fixed it

This commit is contained in:
2023-03-04 22:15:39 +11:00
parent 502032e514
commit e6d9809da5
3 changed files with 9 additions and 4 deletions

View File

@@ -130,7 +130,7 @@ static int writeNodeCompoundToCache(Toy_Compiler* compiler, Toy_ASTNode* node) {
} }
//push the store to the cache, with instructions about how pack it //push the store to the cache, with instructions about how pack it
Toy_Literal literal = TOY_TO_DICTIONARY_LITERAL(store); Toy_Literal literal = TOY_TO_DICTIONARY_LITERAL((Toy_LiteralDictionary*)store); //cast from array to dict, because it's intermediate
literal.type = TOY_LITERAL_DICTIONARY_INTERMEDIATE; //god damn it - nested in a dictionary literal.type = TOY_LITERAL_DICTIONARY_INTERMEDIATE; //god damn it - nested in a dictionary
index = Toy_pushLiteralArray(&compiler->literalCache, literal); index = Toy_pushLiteralArray(&compiler->literalCache, literal);
Toy_freeLiteral(literal); Toy_freeLiteral(literal);

View File

@@ -1862,6 +1862,9 @@ static bool execIndexAssign(Toy_Interpreter* interpreter) {
Toy_freeLiteral(op); Toy_freeLiteral(op);
Toy_freeLiteralArray(&arguments); Toy_freeLiteralArray(&arguments);
//if we loop, then we need to be assigning
opStr = "=";
} }
//BUGFIX: make sure the compound name can be assigned //BUGFIX: make sure the compound name can be assigned

View File

@@ -8,6 +8,7 @@
struct Toy_Literal; struct Toy_Literal;
struct Toy_Interpreter; struct Toy_Interpreter;
struct Toy_LiteralArray; struct Toy_LiteralArray;
struct Toy_LiteralDictionary;
struct Toy_Scope; struct Toy_Scope;
typedef int (*Toy_NativeFn)(struct Toy_Interpreter* interpreter, struct Toy_LiteralArray* arguments); typedef int (*Toy_NativeFn)(struct Toy_Interpreter* interpreter, struct Toy_LiteralArray* arguments);
typedef int (*Toy_HookFn)(struct Toy_Interpreter* interpreter, struct Toy_Literal identifier, struct Toy_Literal alias); typedef int (*Toy_HookFn)(struct Toy_Interpreter* interpreter, struct Toy_Literal identifier, struct Toy_Literal alias);
@@ -49,8 +50,8 @@ typedef struct Toy_Literal {
//string hash? //string hash?
} string; //8 } string; //8
void* array; //8 struct Toy_LiteralArray* array; //8
void* dictionary; //8 struct Toy_LiteralDictionary* dictionary; //8
struct { struct {
union { union {
@@ -67,7 +68,8 @@ typedef struct Toy_Literal {
} identifier; //16 } identifier; //16
struct { struct {
void* subtypes; //8
struct Toy_Literal* subtypes; //8
Toy_LiteralType typeOf; //4 Toy_LiteralType typeOf; //4
unsigned char capacity; //1 unsigned char capacity; //1
unsigned char count; //1 unsigned char count; //1