Mercurial > vim
comparison src/vim9compile.c @ 21743:a7e0091a4669 v8.2.1421
patch 8.2.1421: Vim9: handling "+" and "-" before number differs from script
Commit: https://github.com/vim/vim/commit/4301a729eabafee388aaf8465cf780d3f84cec95
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 11 20:51:08 2020 +0200
patch 8.2.1421: Vim9: handling "+" and "-" before number differs from script
Problem: Vim9: handling "+" and "-" before number differs from Vim script.
Solution: Use the same sequence of commands.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 11 Aug 2020 21:00:06 +0200 |
parents | caf0286cf02b |
children | cc8188c22a47 |
comparison
equal
deleted
inserted
replaced
21742:6f8dfb98904b | 21743:a7e0091a4669 |
---|---|
3204 case '7': | 3204 case '7': |
3205 case '8': | 3205 case '8': |
3206 case '9': | 3206 case '9': |
3207 case '.': if (eval_number(arg, rettv, TRUE, FALSE) == FAIL) | 3207 case '.': if (eval_number(arg, rettv, TRUE, FALSE) == FAIL) |
3208 return FAIL; | 3208 return FAIL; |
3209 // Apply "-" and "+" just before the number now, right to | |
3210 // left. Matters especially when "->" follows. Stops at | |
3211 // '!'. | |
3212 if (apply_leader(rettv, TRUE, | |
3213 start_leader, &end_leader) == FAIL) | |
3214 { | |
3215 clear_tv(rettv); | |
3216 return FAIL; | |
3217 } | |
3209 break; | 3218 break; |
3210 | 3219 |
3211 /* | 3220 /* |
3212 * String constant: "string". | 3221 * String constant: "string". |
3213 */ | 3222 */ |
3342 if (ret == FAIL) | 3351 if (ret == FAIL) |
3343 return FAIL; | 3352 return FAIL; |
3344 | 3353 |
3345 if (rettv->v_type != VAR_UNKNOWN && used_before == ppconst->pp_used) | 3354 if (rettv->v_type != VAR_UNKNOWN && used_before == ppconst->pp_used) |
3346 { | 3355 { |
3347 // apply the '-' and '+' before the constant, but not '!' | |
3348 if (apply_leader(rettv, TRUE, start_leader, &end_leader) == FAIL) | |
3349 { | |
3350 clear_tv(rettv); | |
3351 return FAIL; | |
3352 } | |
3353 | |
3354 if (cctx->ctx_skip == SKIP_YES) | 3356 if (cctx->ctx_skip == SKIP_YES) |
3355 clear_tv(rettv); | 3357 clear_tv(rettv); |
3356 else | 3358 else |
3357 // A constant expression can possibly be handled compile time, | 3359 // A constant expression can possibly be handled compile time, |
3358 // return the value instead of generating code. | 3360 // return the value instead of generating code. |