Mercurial > vim
comparison src/vim9compile.c @ 21146:465d6e40e79c v8.2.1124
patch 8.2.1124: Vim9: no line break allowed in :import command
Commit: https://github.com/vim/vim/commit/1c991144c502ade477e1a32fdfd0f78b6299fdc7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 4 13:15:31 2020 +0200
patch 8.2.1124: Vim9: no line break allowed in :import command
Problem: Vim9: no line break allowed in :import command.
Solution: Skip over line breaks.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 Jul 2020 13:30:04 +0200 |
parents | 4d844a65183d |
children | eb6c27af07dd |
comparison
equal
deleted
inserted
replaced
21145:9761ed6ea124 | 21146:465d6e40e79c |
---|---|
2611 if (import != NULL) | 2611 if (import != NULL) |
2612 { | 2612 { |
2613 if (import->imp_all) | 2613 if (import->imp_all) |
2614 { | 2614 { |
2615 char_u *p = skipwhite(*end); | 2615 char_u *p = skipwhite(*end); |
2616 int name_len; | 2616 char_u *exp_name; |
2617 int cc; | |
2617 ufunc_T *ufunc; | 2618 ufunc_T *ufunc; |
2618 type_T *type; | 2619 type_T *type; |
2619 | 2620 |
2620 // Used "import * as Name", need to lookup the member. | 2621 // Used "import * as Name", need to lookup the member. |
2621 if (*p != '.') | 2622 if (*p != '.') |
2628 { | 2629 { |
2629 emsg(_("E1074: no white space allowed after dot")); | 2630 emsg(_("E1074: no white space allowed after dot")); |
2630 return FAIL; | 2631 return FAIL; |
2631 } | 2632 } |
2632 | 2633 |
2633 idx = find_exported(import->imp_sid, &p, &name_len, &ufunc, &type); | 2634 // isolate one name |
2635 exp_name = p; | |
2636 while (eval_isnamec(*p)) | |
2637 ++p; | |
2638 cc = *p; | |
2639 *p = NUL; | |
2640 | |
2641 idx = find_exported(import->imp_sid, exp_name, &ufunc, &type); | |
2642 *p = cc; | |
2643 p = skipwhite(p); | |
2644 | |
2634 // TODO: what if it is a function? | 2645 // TODO: what if it is a function? |
2635 if (idx < 0) | 2646 if (idx < 0) |
2636 return FAIL; | 2647 return FAIL; |
2637 *end = p; | 2648 *end = p; |
2638 | 2649 |
2979 return p; | 2990 return p; |
2980 } | 2991 } |
2981 | 2992 |
2982 /* | 2993 /* |
2983 * Like to_name_end() but also skip over a list or dict constant. | 2994 * Like to_name_end() but also skip over a list or dict constant. |
2995 * This intentionally does not handle line continuation. | |
2984 */ | 2996 */ |
2985 char_u * | 2997 char_u * |
2986 to_name_const_end(char_u *arg) | 2998 to_name_const_end(char_u *arg) |
2987 { | 2999 { |
2988 char_u *p = to_name_end(arg, TRUE); | 3000 char_u *p = to_name_end(arg, TRUE); |
5630 * Compile an :import command. | 5642 * Compile an :import command. |
5631 */ | 5643 */ |
5632 static char_u * | 5644 static char_u * |
5633 compile_import(char_u *arg, cctx_T *cctx) | 5645 compile_import(char_u *arg, cctx_T *cctx) |
5634 { | 5646 { |
5635 return handle_import(arg, &cctx->ctx_imports, 0, cctx); | 5647 return handle_import(arg, &cctx->ctx_imports, 0, NULL, cctx); |
5636 } | 5648 } |
5637 | 5649 |
5638 /* | 5650 /* |
5639 * generate a jump to the ":endif"/":endfor"/":endwhile"/":finally"/":endtry". | 5651 * generate a jump to the ":endif"/":endfor"/":endwhile"/":finally"/":endtry". |
5640 */ | 5652 */ |