> **Describe the bug**
> 
> In Vim9 script, we cannot compile an `:if` command when it's preceded by the 
> `:legacy` modifier.
> 
> **To Reproduce**
> 
> Run this shell command:
> 
>     vim -Nu NONE -S <(cat <<'EOF'
>         vim9script
>         def Func()
>             legacy if 1
>                 echo 'no error'
>             endif
>         enddef
>         defcompile
>     EOF
>     )
> 
> `E580` is raised:
> 
>     E580: :endif without :if
> 
> **Expected behavior**
> 
> No error is raised.

Using :if, :for, :while, :try, etc. in a :def function with :legacy is
not going to work, because it depends on interpreting lines at runtime.
There could be a better error message for this.


-- 
If an elephant is left tied to a parking meter, the parking fee has to be paid
just as it would for a vehicle.
                [real standing law in Florida, United States of America]

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106021442.152EgV9o2596463%40masaka.moolenaar.net.

Raspunde prin e-mail lui