mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-07-26 12:59:05 +08:00
bug fixed
a gc bug which causes fatal error. add member value collect to make sure that nasal_val is not collected repeatedly. use builtin_alloc in builtin function to avoid incorrect collection of value in use(gc_alloc). change free_list to free_list[vm_type_size] to avoid too many calls of new/delete(but seems useless?) but the most important thing is fixing this bug.
This commit is contained in:
+14
-15
@@ -103,17 +103,17 @@ public:
|
||||
nasal_ast(const nasal_ast&);
|
||||
~nasal_ast();
|
||||
nasal_ast& operator=(const nasal_ast&);
|
||||
void print_ast(int);
|
||||
void clear();
|
||||
void set_line(int);
|
||||
void set_type(int);
|
||||
void set_str(std::string&);
|
||||
void set_num(double);
|
||||
void add_child(nasal_ast);
|
||||
int get_line();
|
||||
int get_type();
|
||||
double get_num();
|
||||
std::string get_str();
|
||||
void print_ast(int);
|
||||
void clear();
|
||||
void set_line(int);
|
||||
void set_type(int);
|
||||
void set_str(std::string&);
|
||||
void set_num(double);
|
||||
void add_child(nasal_ast);
|
||||
int get_line();
|
||||
int get_type();
|
||||
double get_num();
|
||||
std::string& get_str();
|
||||
std::vector<nasal_ast>& get_children();
|
||||
};
|
||||
|
||||
@@ -207,7 +207,7 @@ int nasal_ast::get_type()
|
||||
return type;
|
||||
}
|
||||
|
||||
std::string nasal_ast::get_str()
|
||||
std::string& nasal_ast::get_str()
|
||||
{
|
||||
return str;
|
||||
}
|
||||
@@ -233,9 +233,8 @@ void nasal_ast::print_ast(int depth)
|
||||
else if(type==ast_num)
|
||||
std::cout<<":"<<num;
|
||||
std::cout<<'\n';
|
||||
int child_size=children.size();
|
||||
for(int i=0;i<child_size;++i)
|
||||
children[i].print_ast(depth+1);
|
||||
for(auto& i:children)
|
||||
i.print_ast(depth+1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user