[VER] 0.3.4-alpha

[FEAT] 异常系统, try/catch/finally
This commit is contained in:
2025-12-30 17:42:41 +08:00
parent 6982f169aa
commit 9f24392034
13 changed files with 857 additions and 470 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,8 @@ namespace Fig
Normal,
Return,
Break,
Continue
Continue,
Error
} flow;
StatementResult(ObjectPtr val, Flow f = Flow::Normal) :
@@ -43,11 +44,16 @@ namespace Fig
{
return StatementResult(Object::getNullInstance(), Flow::Continue);
}
static StatementResult errorFlow(ObjectPtr val)
{
return StatementResult(val, Flow::Error);
}
bool isNormal() const { return flow == Flow::Normal; }
bool shouldReturn() const { return flow == Flow::Return; }
bool shouldBreak() const { return flow == Flow::Break; }
bool shouldContinue() const { return flow == Flow::Continue; }
bool isError() const { return flow == Flow::Error; }
};
class Evaluator