Working on refactoring, read more

The main program segfaults, but right now I'm working on the tests, mainly.
This commit is contained in:
2022-08-29 10:21:25 +10:00
parent 4fb2dea1b4
commit 1937d727bb
18 changed files with 142 additions and 141 deletions

View File

@@ -20,15 +20,7 @@ int pushLiteralArray(LiteralArray* array, Literal literal) {
array->literals = GROW_ARRAY(Literal, array->literals, oldCapacity, array->capacity);
}
//if it's a string or an identifier, make a local copy
if (IS_STRING(literal)) {
literal = TO_STRING_LITERAL(copyString(AS_STRING(literal), strlen( AS_STRING(literal) )), strlen( AS_STRING(literal) ));
}
if (IS_IDENTIFIER(literal)) {
literal = TO_IDENTIFIER_LITERAL(copyString(AS_IDENTIFIER(literal), strlen( AS_IDENTIFIER(literal) )), strlen( AS_IDENTIFIER(literal) ));
}
array->literals[array->count] = literal;
array->literals[array->count] = copyLiteral(literal);
return array->count++;
}
@@ -75,4 +67,4 @@ void printLiteralArray(LiteralArray* array, const char* delim) {
printLiteral(array->literals[i]);
printf("%s", delim);
}
}
}