aboutsummaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
Diffstat (limited to 'boot')
-rw-r--r--boot/lex.c3
-rw-r--r--boot/tree.c10
2 files changed, 9 insertions, 4 deletions
diff --git a/boot/lex.c b/boot/lex.c
index 0fc6ed1..c66d160 100644
--- a/boot/lex.c
+++ b/boot/lex.c
@@ -275,7 +275,8 @@ token_kind_to_string(enum Token_Kind kind)
return "ASSIGN_RIGHT_SHIFT";
default:
- return "";
+ failure("unknown token kind passed to `token_kind_to_string`");
+ return nil;
}
}
diff --git a/boot/tree.c b/boot/tree.c
index e6c5b78..593103a 100644
--- a/boot/tree.c
+++ b/boot/tree.c
@@ -40,7 +40,8 @@ unary_operation_to_string(enum Unary_Operation operation)
return "~";
default:
- return "unknown";
+ failure("unexpected unary operation passed to `unary_operation_to_string`");
+ return nil;
}
}
@@ -212,6 +213,7 @@ binary_operation_precedence(enum Binary_Operation operation)
// strongest
default:
+ failure("unexpected binary operation passed to `binary_operation_precedence`");
return 0;
}
}
@@ -316,7 +318,8 @@ binary_operation_to_string(enum Binary_Operation operation)
return ">>=";
default:
- return "unknown";
+ failure("unexpected binary operation passed to `binary_operation_to_string`");
+ return nil;
}
}
@@ -511,6 +514,7 @@ expression_print(const struct Expression* expression)
printf(")");
break;
default:
+ failure("unexpected expression kind passed to `expression_print`");
break;
}
printf(")");
@@ -572,7 +576,7 @@ statement_print(const struct Statement* statement)
break;
}
default:
- printf("unknown");
+ failure("unexpected statement kind passed to `statement_print`");
break;
}
printf(")");