🎨 formating

This commit is contained in:
ValKmjolnir 2025-01-01 16:39:25 +08:00
parent 4dc4c1d2b7
commit 688fbe8c5d
1 changed files with 71 additions and 64 deletions

View File

@ -511,10 +511,10 @@ inline void vm::o_lnk() {
// concat two vectors into one
if (ctx.top[-1].is_vec() && ctx.top[0].is_vec()) {
ngc.temp = ngc.alloc(vm_type::vm_vec);
for(auto i : ctx.top[-1].vec().elems) {
for(auto& i : ctx.top[-1].vec().elems) {
ngc.temp.vec().elems.push_back(i);
}
for(auto i : ctx.top[0].vec().elems) {
for(auto& i : ctx.top[0].vec().elems) {
ngc.temp.vec().elems.push_back(i);
}
ctx.top[-1] = ngc.temp;
@ -847,12 +847,17 @@ inline void vm::o_callh() {
} else {
ctx.top[0] = val.map().get_value(str);
}
// report key not found if get_value returns none
if (ctx.top[0].is_none()) {
val.is_hash()?
die(report_key_not_found(str, val.hash())):
die("cannot find symbol \"" + str + "\"");
val.is_hash()
? die(report_key_not_found(str, val.hash()))
: die("cannot find symbol \"" + str + "\"");
return;
} else if (ctx.top[0].is_func()) {
}
// if get function from hash, set 'me'
if (ctx.top[0].is_func() && val.is_hash()) {
ctx.top[0].func().local[0] = val; // 'me'
}
}
@ -920,9 +925,11 @@ inline void vm::o_callfv() {
for(u64 i = min_size + 1; i<func.local_size; ++i) {
local[i] = func.local[i];
}
// load dynamic argument
local[func.dynamic_parameter_index>=0?
parameter_size+1:func.local_size-1] = dynamic;
local[func.dynamic_parameter_index >= 0
? parameter_size + 1
: func.local_size - 1] = dynamic;
ctx.top[0] = ctx.upvalr;
(++ctx.top)[0] = var::addr(ctx.localr);