No longer allow a local variable to be used as a function during dot notation sugar lookup. It's far less confusing this way

This commit is contained in:
Jason Turner 2010-01-27 03:54:42 +00:00
parent d8213a4206
commit faaa964565
3 changed files with 8 additions and 19 deletions

View File

@ -509,25 +509,18 @@ namespace chaiscript
}
}
//std::string fun_name;
Boxed_Value fn;
try {
if (node->children[i]->identifier == Token_Type::Fun_Call) {
//fun_name = node->children[i]->children[0]->text;
fn = eval_token(ss, node->children[i]->children[0]);
}
else {
//fun_name = node->children[i]->text;
fn = eval_token(ss, node->children[i]);
}
std::string fun_name;
std::vector<std::pair<std::string, Proxy_Function > > funs;
if (node->children[i]->identifier == Token_Type::Fun_Call) {
fun_name = node->children[i]->children[0]->text;
}
catch(Eval_Error &ee) {
ss.set_stack(prev_stack);
throw Eval_Error(ee.reason, node->children[i]);
else {
fun_name = node->children[i]->text;
}
try {
ss.set_stack(new_stack);
retval = (*boxed_cast<Const_Proxy_Function >(fn))(plb);
retval = ss.call_function(fun_name, plb);
ss.set_stack(prev_stack);
}
catch(const dispatch_error &e){

View File

@ -1,3 +0,0 @@
var addit = fun(x, y) { return x+y }
print(3.addit(4))

View File

@ -1 +0,0 @@
7