comparison src/eval.c @ 5844:8ec9d2196bee v7.4.265

updated for version 7.4.265 Problem: Can't call a global function with "g:" in an expression. Solution: Skip the "g:" when looking up the function.
author Bram Moolenaar <bram@vim.org>
date Thu, 24 Apr 2014 17:12:33 +0200
parents 00acac0af680
children 1a5ed2626b26
comparison
equal deleted inserted replaced
5843:00e843ceb21b 5844:8ec9d2196bee
8483 8483
8484 8484
8485 /* execute the function if no errors detected and executing */ 8485 /* execute the function if no errors detected and executing */
8486 if (evaluate && error == ERROR_NONE) 8486 if (evaluate && error == ERROR_NONE)
8487 { 8487 {
8488 char_u *rfname = fname;
8489
8490 /* Ignore "g:" before a function name. */
8491 if (fname[0] == 'g' && fname[1] == ':')
8492 rfname = fname + 2;
8493
8488 rettv->v_type = VAR_NUMBER; /* default rettv is number zero */ 8494 rettv->v_type = VAR_NUMBER; /* default rettv is number zero */
8489 rettv->vval.v_number = 0; 8495 rettv->vval.v_number = 0;
8490 error = ERROR_UNKNOWN; 8496 error = ERROR_UNKNOWN;
8491 8497
8492 if (!builtin_function(fname, -1)) 8498 if (!builtin_function(rfname, -1))
8493 { 8499 {
8494 /* 8500 /*
8495 * User defined function. 8501 * User defined function.
8496 */ 8502 */
8497 fp = find_func(fname); 8503 fp = find_func(rfname);
8498 8504
8499 #ifdef FEAT_AUTOCMD 8505 #ifdef FEAT_AUTOCMD
8500 /* Trigger FuncUndefined event, may load the function. */ 8506 /* Trigger FuncUndefined event, may load the function. */
8501 if (fp == NULL 8507 if (fp == NULL
8502 && apply_autocmds(EVENT_FUNCUNDEFINED, 8508 && apply_autocmds(EVENT_FUNCUNDEFINED,
8503 fname, fname, TRUE, NULL) 8509 rfname, rfname, TRUE, NULL)
8504 && !aborting()) 8510 && !aborting())
8505 { 8511 {
8506 /* executed an autocommand, search for the function again */ 8512 /* executed an autocommand, search for the function again */
8507 fp = find_func(fname); 8513 fp = find_func(rfname);
8508 } 8514 }
8509 #endif 8515 #endif
8510 /* Try loading a package. */ 8516 /* Try loading a package. */
8511 if (fp == NULL && script_autoload(fname, TRUE) && !aborting()) 8517 if (fp == NULL && script_autoload(rfname, TRUE) && !aborting())
8512 { 8518 {
8513 /* loaded a package, search for the function again */ 8519 /* loaded a package, search for the function again */
8514 fp = find_func(fname); 8520 fp = find_func(rfname);
8515 } 8521 }
8516 8522
8517 if (fp != NULL) 8523 if (fp != NULL)
8518 { 8524 {
8519 if (fp->uf_flags & FC_RANGE) 8525 if (fp->uf_flags & FC_RANGE)