Handle null types

This commit is contained in:
Rafał Grodziński
2025-07-05 09:36:12 +09:00
parent ae4afd309b
commit cd3fa8b6e4
3 changed files with 16 additions and 6 deletions

View File

@@ -367,6 +367,9 @@ string Logger::toString(shared_ptr<ExpressionGrouping> expression) {
}
string Logger::toString(shared_ptr<ExpressionLiteral> expression) {
if (expression->getValueType() == nullptr)
return "?";
switch (expression->getValueType()->getKind()) {
case ValueTypeKind::NONE:
return "NONE";
@@ -392,6 +395,8 @@ string Logger::toString(shared_ptr<ExpressionCall> expression) {
string Logger::toString(shared_ptr<ExpressionBlock> expression) {
string text;
text += toString(expression->getStatementBlock());
if (!text.empty())
text += '\n';
if (expression->getResultStatementExpression() != nullptr)
text += toString(expression->getResultStatementExpression());
return text;