Fix to the method/array dispatch issue
This commit is contained in:
parent
efae821996
commit
8a6a46d0d3
@ -804,7 +804,7 @@ namespace chaiscript
|
||||
|
||||
std::string fun_name;
|
||||
std::vector<std::pair<std::string, Proxy_Function > > funs;
|
||||
if (this->children[i]->identifier == AST_Node_Type::Fun_Call) {
|
||||
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;
|
||||
}
|
||||
else {
|
||||
@ -828,6 +828,23 @@ namespace chaiscript
|
||||
ss.set_stack(prev_stack);
|
||||
throw;
|
||||
}
|
||||
if (this->children[i]->identifier == AST_Node_Type::Array_Call) {
|
||||
for (unsigned int j = 1; j < this->children[i]->children.size(); ++j) {
|
||||
try {
|
||||
retval = ss.call_function("[]", retval, this->children[i]->children[j]->eval(ss));
|
||||
}
|
||||
catch(std::out_of_range &) {
|
||||
throw Eval_Error("Out of bounds exception");
|
||||
}
|
||||
catch(const dispatch_error &){
|
||||
throw Eval_Error("Can not find appropriate array lookup '[]' ");
|
||||
}
|
||||
catch(Eval_Error &ee) {
|
||||
ee.call_stack.push_back(this->children[i]->children[j]);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user