Resolve warnings
This commit is contained in:
parent
dc566b4345
commit
1d297cf0f0
3 changed files with 3 additions and 10 deletions
|
@ -133,10 +133,9 @@ value_t visit_binary(expr_t *expr)
|
|||
}
|
||||
|
||||
// String/number comparisons
|
||||
if (left.type == VAL_STRING && right.type == VAL_NUMBER ||
|
||||
left.type == VAL_NUMBER && right.type == VAL_STRING ) {
|
||||
if ((left.type == VAL_STRING && right.type == VAL_NUMBER) ||
|
||||
(left.type == VAL_NUMBER && right.type == VAL_STRING)) {
|
||||
runtime_error("Operands must be numbers.", expr->line);
|
||||
|
||||
}
|
||||
|
||||
runtime_error("Operands must be two numbers or two strings.", expr->line);
|
||||
|
|
|
@ -263,13 +263,7 @@ array_t *tokenize(char *filename)
|
|||
int found = 0;
|
||||
for (int i = 0; i < sizeof(reserved_keywords) / sizeof(reserved_keywords[0]); i++) {
|
||||
if (strcmp(id, reserved_keywords[i].keyword) == 0) {
|
||||
char upper_id[len + 1];
|
||||
for (int i = 0; i < len; i++) {
|
||||
upper_id[i] = toupper(id[i]);
|
||||
}
|
||||
upper_id[len] = 0;
|
||||
token_add(tokens, token_gen(reserved_keywords[i].token_type, id, line));
|
||||
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ stmt_t var_declaration(void)
|
|||
{
|
||||
token_t *name = consume(TOKEN_IDENTIFIER, "Expect variable name.");
|
||||
|
||||
expr_t *initializer;
|
||||
expr_t *initializer = NULL;
|
||||
if (check(TOKEN_EQUAL)) {
|
||||
initializer = expression();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue