fix: 修复了在解析字面量时的条件逻辑,确保整数转换在浮点数转换之后进行

This commit is contained in:
2026-02-25 19:15:25 +08:00
parent a0fb8cdffb
commit 12dc31a6c0

View File

@@ -54,9 +54,12 @@ namespace Fig
double d = std::stod(lexeme.toStdString()); double d = std::stod(lexeme.toStdString());
v = Value::FromDouble(d); v = Value::FromDouble(d);
} }
else
{
std::int32_t i = std::stoi(lexeme.toStdString()); std::int32_t i = std::stoi(lexeme.toStdString());
v = Value::FromInt(i); v = Value::FromInt(i);
} }
}
else else
{ {
assert("false" && "CompileLiteral: unsupport literal"); assert("false" && "CompileLiteral: unsupport literal");