add detail location info in tokens

prepare for multi-line error reporter module
This commit is contained in:
ValKmjolnir
2023-01-10 22:22:27 +08:00
parent 268a03864e
commit 8df02d25ad
8 changed files with 137 additions and 139 deletions
+9
View File
@@ -638,9 +638,13 @@ void gc::extend(u8 type) {
size[index]+=incr[index];
for(u32 i=0;i<incr[index];++i) {
nas_val* tmp=new nas_val(type);
// failed to allocate new memory
if (!tmp) {
std::exit(-1);
}
// add to heap
memory.push_back(tmp);
unused[index].push_back(tmp);
}
@@ -718,6 +722,7 @@ void gc::info() {
if (total) {
std::clog<<" avg | "<<sec/total*1000<<" ms\n";
}
std::clog<<"\n";
}
var gc::alloc(u8 type) {
@@ -777,6 +782,8 @@ void gc::ctxchg(nas_co& ctx) {
upvalr=ctx.upvalr;
canary=ctx.canary;
stack=ctx.stack;
// set coroutine pointer
cort=&ctx;
// set coroutine state to running
@@ -805,6 +812,8 @@ void gc::ctxreserve() {
canary=mctx.canary;
top=mctx.top;
stack=mctx.stack;
// set coroutine pointer to nullptr
cort=nullptr;
}