comparison src/vim9compile.c @ 26980:8796f1384750 v8.2.4019

patch 8.2.4019: Vim9: import mechanism is too complicated Commit: https://github.com/vim/vim/commit/d5f400c607182db6d4fbe2964471d796277f67e8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 6 21:10:28 2022 +0000 patch 8.2.4019: Vim9: import mechanism is too complicated Problem: Vim9: import mechanism is too complicated. Solution: Do not use the Javascript mechanism but a much simpler one.
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Jan 2022 22:15:04 +0100
parents fceb494e22de
children eebbcc83fb75
comparison
equal deleted inserted replaced
26979:2fb4968983af 26980:8796f1384750
1355 lhs->lhs_dest = dest_script; 1355 lhs->lhs_dest = dest_script;
1356 1356
1357 // existing script-local variables should have a type 1357 // existing script-local variables should have a type
1358 lhs->lhs_scriptvar_sid = current_sctx.sc_sid; 1358 lhs->lhs_scriptvar_sid = current_sctx.sc_sid;
1359 if (import != NULL) 1359 if (import != NULL)
1360 {
1361 char_u *dot = vim_strchr(var_start, '.');
1362 char_u *p;
1363
1364 // for an import the name is what comes after the dot
1365 if (dot == NULL)
1366 {
1367 semsg(_(e_no_dot_after_imported_name_str),
1368 var_start);
1369 return FAIL;
1370 }
1371 p = skipwhite(dot + 1);
1372 var_end = to_name_end(p, TRUE);
1373 if (var_end == p)
1374 {
1375 semsg(_(e_missing_name_after_imported_name_str),
1376 var_start);
1377 return FAIL;
1378 }
1379 vim_free(lhs->lhs_name);
1380 lhs->lhs_varlen = var_end - p;
1381 lhs->lhs_name = vim_strnsave(p, lhs->lhs_varlen);
1382 if (lhs->lhs_name == NULL)
1383 return FAIL;
1384 rawname = lhs->lhs_name;
1360 lhs->lhs_scriptvar_sid = import->imp_sid; 1385 lhs->lhs_scriptvar_sid = import->imp_sid;
1386 // TODO: where do we check this name is exported?
1387
1388 // Check if something follows: "exp.var[idx]" or
1389 // "exp.var.key".
1390 lhs->lhs_has_index = lhs->lhs_dest_end
1391 > skipwhite(var_end);
1392 }
1361 if (SCRIPT_ID_VALID(lhs->lhs_scriptvar_sid)) 1393 if (SCRIPT_ID_VALID(lhs->lhs_scriptvar_sid))
1362 { 1394 {
1363 // Check writable only when no index follows. 1395 // Check writable only when no index follows.
1364 lhs->lhs_scriptvar_idx = get_script_item_idx( 1396 lhs->lhs_scriptvar_idx = get_script_item_idx(
1365 lhs->lhs_scriptvar_sid, rawname, 1397 lhs->lhs_scriptvar_sid, rawname,