Loading ...
Sorry, an error occurred while loading the content.
 

Re: Vim expr parsing bug

Expand Messages
  • Andy Wokula
    ... (obsolete patch) ... So far, this latest patch works ok for me. -- Andy -- You received this message from the vim_dev maillist. Do not top-post! Type
    Message 1 of 9 , Jan 4, 2013
      Am 23.11.2012 22:09, schrieb Bram Moolenaar:
      >
      > Christian Brabandt wrote:
      >
      >> On Fr, 23 Nov 2012, Bram Moolenaar wrote:
      >>
      >>> Christian Brabandt wrote:
      >>>
      >>>> On Do, 22 Nov 2012, Bram Moolenaar wrote:
      >>>>
      >>>>>
      >>>>> Andy Wokula wrote:
      >>>>>
      >>>>>> " Vim Parsing Bug
      >>>>>>
      >>>>>> func! Add2(x1, x2)
      >>>>>> return a:x1 + a:x2
      >>>>>> endfunc
      >>>>>>
      >>>>>> :echo function('Add2')(2,3)
      >>>>>> " 5 (ok)
      >>>>>>
      >>>>>> " Bug:
      >>>>>> :echo 1 ? function('Add2')(1,2) : function('Add2')(2,3)
      >>>>>> :echo 0 ? function('Add2')(1,2) : function('Add2')(2,3)
      >>>>>>
      >>>>>> " Error detected while processing D1223.vim:
      >>>>>> " line 17:
      >>>>>> " E110: Missing ')'
      >>>>>> " E15: Invalid expression: (2,3)
      >>>>>> " line 18:
      >>>>>> " E109: Missing ':' after '?'
      >>>>>> " E15: Invalid expression: 0 ? function('Add2')(1,2) : function('Add2')(2,3)
      >>>>>>
      >>>>>>
      >>>>>> Adding parentheses 1 ? (...) : (...) doesn't help.
      >>>>>
      >>>>> Strange. I'll add it to the todo list.
      >>>>
      >>>> Problem is, in expr1 ? expr2 : expr3
      >>>> Vim explicitly resets evaluate in the false case which leads to being
      >>>> rettv.v_type being VAR_UNKNOWN and then handle_subscript doesn't handle
      >>>> the subscript anymore.
      >>>>
      >>>> Here is a patch:
      (obsolete patch)
      >>>
      >>> Thanks for the quick fix.
      >>>
      >>> Now, how about a test?
      >>
      >> Well, I am not sure, what caused the segfault for Andy. But I have been
      >> checking with him privately, that this patch works and added some tests.
      >> So here we go, a different patch, including a test.
      >
      > Thanks!

      So far, this latest patch works ok for me.

      --
      Andy

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.