freeSolsToken()

This commit is contained in:
2026-02-05 20:22:25 +11:00
parent 6cd9e6764c
commit d5692369d4
2 changed files with 18 additions and 0 deletions

View File

@@ -46,3 +46,18 @@ ResultType(SolsToken, charptr) createSolsToken(SolsTokenType type, ...) {
va_end(args);
return Success(SolsToken, charptr, token);
}
void freeSolsToken(SolsToken* token) {
if (token->type == STT_IDENTIFIER && token->as.idName != NULL) {
free(token->as.idName);
}
if (token->type == STT_KW_GROUND && token->as.inlineGround != NULL) {
free(token->as.inlineGround);
}
if (token->type == STT_LITERAL) {
freeSolsLiteral(&token->as.literal);
}
if (token->type == STT_TYPE) {
freeSolsType(&token->as.type);
}
}