mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Fixed some indexing bugs
This commit is contained in:
@@ -736,17 +736,24 @@ static Opcode indexAccess(Parser* parser, Node** nodeHandle) {
|
||||
emitNodeLiteral(&second, TO_BOOLEAN_LITERAL(true));
|
||||
emitNodeLiteral(&third, TO_BOOLEAN_LITERAL(true));
|
||||
|
||||
bool readFirst = false; //pattern matching is bullcrap
|
||||
|
||||
//eat the first
|
||||
if (!match(parser, TOKEN_COLON)) {
|
||||
freeNode(first);
|
||||
parsePrecedence(parser, &first, PREC_TERNARY);
|
||||
match(parser, TOKEN_COLON);
|
||||
readFirst = true;
|
||||
}
|
||||
|
||||
if (match(parser, TOKEN_BRACKET_RIGHT)) {
|
||||
freeNode(second);
|
||||
|
||||
if (readFirst) {
|
||||
freeNode(second);
|
||||
second = NULL;
|
||||
}
|
||||
|
||||
freeNode(third);
|
||||
second = NULL;
|
||||
third = NULL;
|
||||
|
||||
emitNodeIndex(nodeHandle, first, second, third);
|
||||
|
||||
Reference in New Issue
Block a user