improve fscript

This commit is contained in:
lixianjing 2022-01-02 08:20:15 +08:00
parent 84da6b5380
commit b7442a473a
3 changed files with 14 additions and 0 deletions

View File

@ -1,4 +1,6 @@
# 最新动态
2022/01/02
* 修复fscript中while语句对return的处理。
2022/01/01
* 优化fscript函数调用。

View File

@ -386,6 +386,8 @@ static ret_t fscript_exec_while(fscript_t* fscript, fscript_func_call_t* iter, v
done = TRUE;
fscript->breaked = FALSE;
break;
} else if (fscript->returned) {
done = TRUE;
} else if (fscript->continued) {
fscript->continued = FALSE;
break;

View File

@ -1544,3 +1544,13 @@ TEST(FScript, on_error) {
value_reset(&v);
TK_OBJECT_UNREF(obj);
}
TEST(FScript, while_return) {
value_t v;
tk_object_t* obj = object_default_create();
fscript_eval(obj, "while(true){return}", &v);
value_reset(&v);
TK_OBJECT_UNREF(obj);
}