[Feat] 实现 std.formater库,增加 std.io.printf函数
[Fix] 修复 evaluator中处理else if condVal类型错误的低级问题 [Feat] 为 String类型增加 insert, replace, erase函数
This commit is contained in:
@@ -1037,12 +1037,15 @@ namespace Fig
|
||||
for (const auto &elif : ifSt->elifs)
|
||||
{
|
||||
ObjectPtr elifCondVal = eval(elif->condition, ctx);
|
||||
throw EvaluatorError(
|
||||
u8"TypeError",
|
||||
std::format(
|
||||
"Condition must be boolean, but got '{}'",
|
||||
condVal->getTypeInfo().toString().toBasicString()),
|
||||
ifSt->condition);
|
||||
if (elifCondVal->getTypeInfo() != ValueType::Bool)
|
||||
{
|
||||
throw EvaluatorError(
|
||||
u8"TypeError",
|
||||
std::format(
|
||||
"Condition must be boolean, but got '{}'",
|
||||
condVal->getTypeInfo().toString().toBasicString()),
|
||||
ifSt->condition);
|
||||
}
|
||||
if (elifCondVal->as<ValueType::BoolClass>())
|
||||
{
|
||||
return evalBlockStatement(elif->body, ctx);
|
||||
|
||||
Reference in New Issue
Block a user