To: vim-dev@vim.org Subject: Patch 6.1.280 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.280 Problem: It's possible to use an argument "firstline" or "lastline" for a function but using "a:firstline" or "a:lastline" in the function won't work. (Benji Fisher) Solution: Give an error message for these arguments. Also avoid that the following function body causes a whole row of errors, skip over it after an error in the first line. Files: src/eval.c *** ../vim61.279/src/eval.c Sun Jan 5 22:14:46 2003 --- src/eval.c Mon Jan 6 22:34:33 2003 *************** *** 7878,7889 **** arg = p; while (ASCII_ISALPHA(*p) || isdigit(*p) || *p == '_') ++p; ! if (arg == p || isdigit(*arg)) { ! if (eap->skip) ! break; ! EMSG2(_("E125: Illegal argument: %s"), arg); ! goto erret; } if (ga_grow(&newargs, 1) == FAIL) goto erret; --- 7893,7905 ---- arg = p; while (ASCII_ISALPHA(*p) || isdigit(*p) || *p == '_') ++p; ! if (arg == p || isdigit(*arg) ! || (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0) ! || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0)) { ! if (!eap->skip) ! EMSG2(_("E125: Illegal argument: %s"), arg); ! break; } if (ga_grow(&newargs, 1) == FAIL) goto erret; *************** *** 7904,7913 **** p = skipwhite(p); if (mustend && *p != ')') { ! if (eap->skip) ! break; ! EMSG2(_(e_invarg2), eap->arg); ! goto erret; } } ++p; /* skip the ')' */ --- 7920,7928 ---- p = skipwhite(p); if (mustend && *p != ')') { ! if (!eap->skip) ! EMSG2(_(e_invarg2), eap->arg); ! break; } } ++p; /* skip the ')' */ *************** *** 7930,7940 **** break; } ! if (*p != NUL && *p != '"' && *p != '\n' && !eap->skip) ! { EMSG(_(e_trailing)); - goto erret; - } /* * Read the body of the function, until ":endfunction" is found. --- 7945,7952 ---- break; } ! if (*p != NUL && *p != '"' && *p != '\n' && !eap->skip && !did_emsg) EMSG(_(e_trailing)); /* * Read the body of the function, until ":endfunction" is found. *************** *** 7945,7954 **** * whole function before telling him it doesn't work! For a script we * need to skip the body to be able to find what follows. */ if (!eap->skip && !eap->forceit && find_func(name) != NULL) - { EMSG2(_(e_funcexts), name); - goto erret; - } msg_putchar('\n'); /* don't overwrite the function name */ cmdline_row = msg_row; --- 7957,7963 ---- *************** *** 8031,8037 **** newlines.ga_room--; } ! if (eap->skip) goto erret; /* --- 8040,8048 ---- newlines.ga_room--; } ! /* Don't define the function when skipping commands or when an error was ! * detected. */ ! if (eap->skip || did_emsg) goto erret; /* *** ../vim61.279/src/version.c Mon Jan 6 21:55:57 2003 --- src/version.c Mon Jan 6 22:48:39 2003 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 280, /**/ -- MORTICIAN: Bring out your dead! [clang] Bring out your dead! [clang] Bring out your dead! CUSTOMER: Here's one -- nine pence. DEAD PERSON: I'm not dead! The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///