Move to a bit smarter stack based object management

- we store all function parameters until the f
    outer function call exits

  - this results in more values being stored longer than
    they need to be, but the results are predictable
    and no leaks
This commit is contained in:
Jason Turner
2012-05-21 10:16:16 -06:00
parent ef46d1bf60
commit 3a7eff1478
3 changed files with 63 additions and 2 deletions

View File

@@ -182,6 +182,7 @@ namespace chaiscript
AST_Node(t_ast_node_text, t_id, t_fname, t_start_line, t_start_col, t_end_line, t_end_col) { }
virtual ~Fun_Call_AST_Node() {}
virtual Boxed_Value eval_internal(chaiscript::detail::Dispatch_Engine &t_ss){
chaiscript::eval::detail::Function_Push_Pop fpp(t_ss);
dispatch::Param_List_Builder plb;
if ((this->children.size() > 1) && (this->children[1]->identifier == AST_Node_Type::Arg_List)) {
@@ -190,6 +191,8 @@ namespace chaiscript
}
}
fpp.save_params(plb.objects);
Boxed_Value fn = this->children[0]->eval(t_ss);
try {
@@ -431,6 +434,7 @@ namespace chaiscript
if (this->children.size() > 1) {
for (size_t i = 2; i < this->children.size(); i+=2) {
chaiscript::eval::detail::Function_Push_Pop fpp(t_ss);
dispatch::Param_List_Builder plb;
plb << retval;
@@ -440,6 +444,8 @@ namespace chaiscript
}
}
fpp.save_params(plb.objects);
std::string fun_name;
if ((this->children[i]->identifier == AST_Node_Type::Fun_Call) || (this->children[i]->identifier == AST_Node_Type::Array_Call)) {
fun_name = this->children[i]->children[0]->text;