Lines Matching refs:lhs
6213 generate_store_lhs(cctx_T *cctx, lhs_T *lhs, int instr_count) in generate_store_lhs() argument
6215 if (lhs->lhs_dest != dest_local) in generate_store_lhs()
6216 return generate_store_var(cctx, lhs->lhs_dest, in generate_store_lhs()
6217 lhs->lhs_opt_flags, lhs->lhs_vimvaridx, in generate_store_lhs()
6218 lhs->lhs_scriptvar_idx, lhs->lhs_scriptvar_sid, in generate_store_lhs()
6219 lhs->lhs_type, lhs->lhs_name); in generate_store_lhs()
6221 if (lhs->lhs_lvar != NULL) in generate_store_lhs()
6228 if (lhs->lhs_lvar->lv_from_outer == 0 in generate_store_lhs()
6236 isn->isn_arg.storenr.stnr_idx = lhs->lhs_lvar->lv_idx; in generate_store_lhs()
6241 else if (lhs->lhs_lvar->lv_from_outer > 0) in generate_store_lhs()
6242 generate_STOREOUTER(cctx, lhs->lhs_lvar->lv_idx, in generate_store_lhs()
6243 lhs->lhs_lvar->lv_from_outer); in generate_store_lhs()
6245 generate_STORE(cctx, ISN_STORE, lhs->lhs_lvar->lv_idx, NULL); in generate_store_lhs()
6265 lhs_T *lhs, in compile_lhs() argument
6274 CLEAR_POINTER(lhs); in compile_lhs()
6275 lhs->lhs_dest = dest_local; in compile_lhs()
6276 lhs->lhs_vimvaridx = -1; in compile_lhs()
6277 lhs->lhs_scriptvar_idx = -1; in compile_lhs()
6282 lhs->lhs_dest_end = skip_var_one(var_start, FALSE); in compile_lhs()
6293 if (is_decl && lhs->lhs_dest_end == var_start + 2 in compile_lhs()
6294 && lhs->lhs_dest_end[-1] == ':') in compile_lhs()
6295 --lhs->lhs_dest_end; in compile_lhs()
6300 lhs->lhs_varlen = var_end - var_start; in compile_lhs()
6301 lhs->lhs_varlen_total = lhs->lhs_varlen; in compile_lhs()
6302 lhs->lhs_name = vim_strnsave(var_start, lhs->lhs_varlen); in compile_lhs()
6303 if (lhs->lhs_name == NULL) in compile_lhs()
6306 if (lhs->lhs_dest_end > var_start + lhs->lhs_varlen) in compile_lhs()
6308 lhs->lhs_has_index = TRUE; in compile_lhs()
6311 lhs->lhs_type = &t_list_string; in compile_lhs()
6313 lhs->lhs_type = &t_any; in compile_lhs()
6319 if (get_var_dest(lhs->lhs_name, &lhs->lhs_dest, cmdidx, in compile_lhs()
6320 &lhs->lhs_opt_flags, &lhs->lhs_vimvaridx, in compile_lhs()
6321 &lhs->lhs_type, cctx) == FAIL) in compile_lhs()
6323 if (lhs->lhs_dest != dest_local in compile_lhs()
6332 if (check_reserved_name(lhs->lhs_name) == FAIL) in compile_lhs()
6335 if (lookup_local(var_start, lhs->lhs_varlen, in compile_lhs()
6336 &lhs->lhs_local_lvar, cctx) == OK) in compile_lhs()
6337 lhs->lhs_lvar = &lhs->lhs_local_lvar; in compile_lhs()
6340 CLEAR_FIELD(lhs->lhs_arg_lvar); in compile_lhs()
6341 if (arg_exists(var_start, lhs->lhs_varlen, in compile_lhs()
6342 &lhs->lhs_arg_lvar.lv_idx, &lhs->lhs_arg_lvar.lv_type, in compile_lhs()
6343 &lhs->lhs_arg_lvar.lv_from_outer, cctx) == OK) in compile_lhs()
6347 semsg(_(e_str_is_used_as_argument), lhs->lhs_name); in compile_lhs()
6350 lhs->lhs_lvar = &lhs->lhs_arg_lvar; in compile_lhs()
6353 if (lhs->lhs_lvar != NULL) in compile_lhs()
6357 semsg(_(e_variable_already_declared), lhs->lhs_name); in compile_lhs()
6363 int script_namespace = lhs->lhs_varlen > 1 in compile_lhs()
6366 ? script_var_exists(var_start + 2, lhs->lhs_varlen - 2, in compile_lhs()
6368 : script_var_exists(var_start, lhs->lhs_varlen, in compile_lhs()
6371 find_imported(var_start, lhs->lhs_varlen, cctx); in compile_lhs()
6375 char_u *rawname = lhs->lhs_name in compile_lhs()
6376 + (lhs->lhs_name[1] == ':' ? 2 : 0); in compile_lhs()
6382 lhs->lhs_name); in compile_lhs()
6385 lhs->lhs_name); in compile_lhs()
6393 semsg(_(e_unknown_variable_str), lhs->lhs_name); in compile_lhs()
6397 lhs->lhs_dest = dest_script; in compile_lhs()
6400 lhs->lhs_scriptvar_sid = current_sctx.sc_sid; in compile_lhs()
6402 lhs->lhs_scriptvar_sid = import->imp_sid; in compile_lhs()
6403 if (SCRIPT_ID_VALID(lhs->lhs_scriptvar_sid)) in compile_lhs()
6406 lhs->lhs_scriptvar_idx = get_script_item_idx( in compile_lhs()
6407 lhs->lhs_scriptvar_sid, rawname, in compile_lhs()
6408 lhs->lhs_has_index ? ASSIGN_FINAL : ASSIGN_CONST, in compile_lhs()
6410 if (lhs->lhs_scriptvar_idx >= 0) in compile_lhs()
6413 lhs->lhs_scriptvar_sid); in compile_lhs()
6416 + lhs->lhs_scriptvar_idx; in compile_lhs()
6417 lhs->lhs_type = sv->sv_type; in compile_lhs()
6421 else if (check_defined(var_start, lhs->lhs_varlen, cctx, FALSE) in compile_lhs()
6429 vim9_declare_error(lhs->lhs_name); in compile_lhs()
6435 if (lhs->lhs_varlen > 1 || var_start[lhs->lhs_varlen] != ':') in compile_lhs()
6436 var_end = lhs->lhs_dest_end; in compile_lhs()
6438 if (lhs->lhs_dest != dest_option) in compile_lhs()
6451 lhs->lhs_type = parse_type(&p, cctx->ctx_type_list, TRUE); in compile_lhs()
6452 if (lhs->lhs_type == NULL) in compile_lhs()
6454 lhs->lhs_has_type = TRUE; in compile_lhs()
6456 else if (lhs->lhs_lvar != NULL) in compile_lhs()
6457 lhs->lhs_type = lhs->lhs_lvar->lv_type; in compile_lhs()
6461 && lhs->lhs_dest != dest_global in compile_lhs()
6462 && !lhs->lhs_has_index in compile_lhs()
6463 && lhs->lhs_type->tt_type != VAR_STRING in compile_lhs()
6464 && lhs->lhs_type->tt_type != VAR_ANY) in compile_lhs()
6470 if (lhs->lhs_lvar == NULL && lhs->lhs_dest == dest_local in compile_lhs()
6476 semsg(_(e_cannot_use_operator_on_new_variable), lhs->lhs_name); in compile_lhs()
6481 semsg(_(e_unknown_variable_str), lhs->lhs_name); in compile_lhs()
6486 if ((lhs->lhs_type->tt_type == VAR_FUNC in compile_lhs()
6487 || lhs->lhs_type->tt_type == VAR_PARTIAL) in compile_lhs()
6488 && var_wrong_func_name(lhs->lhs_name, TRUE)) in compile_lhs()
6492 lhs->lhs_lvar = reserve_local(cctx, var_start, lhs->lhs_varlen, in compile_lhs()
6493 cmdidx == CMD_final || cmdidx == CMD_const, lhs->lhs_type); in compile_lhs()
6494 if (lhs->lhs_lvar == NULL) in compile_lhs()
6496 lhs->lhs_new_local = TRUE; in compile_lhs()
6499 lhs->lhs_member_type = lhs->lhs_type; in compile_lhs()
6500 if (lhs->lhs_has_index) in compile_lhs()
6510 if (var_start[lhs->lhs_varlen] == '[' in compile_lhs()
6511 || var_start[lhs->lhs_varlen] == '.') in compile_lhs()
6513 char_u *after = var_start + lhs->lhs_varlen; in compile_lhs()
6524 lhs->lhs_varlen_total = p - var_start; in compile_lhs()
6529 if (after > var_start + lhs->lhs_varlen) in compile_lhs()
6531 lhs->lhs_varlen = after - var_start; in compile_lhs()
6532 lhs->lhs_dest = dest_expr; in compile_lhs()
6535 lhs->lhs_type = &t_any; in compile_lhs()
6538 if (lhs->lhs_type->tt_member == NULL) in compile_lhs()
6539 lhs->lhs_member_type = &t_any; in compile_lhs()
6541 lhs->lhs_member_type = lhs->lhs_type->tt_member; in compile_lhs()
6558 lhs_T *lhs, in compile_assign_lhs() argument
6565 if (compile_lhs(var_start, lhs, cmdidx, heredoc, oplen, cctx) == FAIL) in compile_assign_lhs()
6568 if (!lhs->lhs_has_index && lhs->lhs_lvar == &lhs->lhs_arg_lvar) in compile_assign_lhs()
6570 semsg(_(e_cannot_assign_to_argument), lhs->lhs_name); in compile_assign_lhs()
6573 if (!is_decl && lhs->lhs_lvar != NULL in compile_assign_lhs()
6574 && lhs->lhs_lvar->lv_const && !lhs->lhs_has_index) in compile_assign_lhs()
6576 semsg(_(e_cannot_assign_to_constant), lhs->lhs_name); in compile_assign_lhs()
6612 lhs_T *lhs, in compile_assign_index() argument
6616 size_t varlen = lhs->lhs_varlen; in compile_assign_index()
6679 lhs_T *lhs, in compile_load_lhs() argument
6684 if (lhs->lhs_dest == dest_expr) in compile_load_lhs()
6686 size_t varlen = lhs->lhs_varlen; in compile_load_lhs()
6708 lhs->lhs_type = stack->ga_len == 0 ? &t_void in compile_load_lhs()
6711 if (rhs_type != NULL && lhs->lhs_type->tt_member != NULL in compile_load_lhs()
6713 && need_type(rhs_type, lhs->lhs_type->tt_member, -2, 0, cctx, in compile_load_lhs()
6718 generate_loadvar(cctx, lhs->lhs_dest, lhs->lhs_name, in compile_load_lhs()
6719 lhs->lhs_lvar, lhs->lhs_type); in compile_load_lhs()
6728 compile_load_lhs_with_index(lhs_T *lhs, char_u *var_start, cctx_T *cctx) in compile_load_lhs_with_index() argument
6730 compile_load_lhs(lhs, var_start, NULL, cctx); in compile_load_lhs_with_index()
6732 if (lhs->lhs_has_index) in compile_load_lhs_with_index()
6738 if (compile_assign_index(var_start, lhs, &range, cctx) == FAIL) in compile_load_lhs_with_index()
6762 lhs_T *lhs, in compile_assign_unlet() argument
6771 if (compile_assign_index(var_start, lhs, &range, cctx) == FAIL) in compile_assign_unlet()
6774 && lhs->lhs_type->tt_type != VAR_LIST in compile_assign_unlet()
6775 && lhs->lhs_type != &t_blob in compile_assign_unlet()
6776 && lhs->lhs_type != &t_any) in compile_assign_unlet()
6782 if (lhs->lhs_type == &t_any) in compile_assign_unlet()
6789 dest_type = lhs->lhs_type->tt_type; in compile_assign_unlet()
6822 if (compile_load_lhs(lhs, var_start, rhs_type, cctx) == FAIL) in compile_assign_unlet()
6896 lhs_T lhs; in compile_assignment() local
6911 lhs.lhs_name = NULL; in compile_assignment()
7027 vim_free(lhs.lhs_name); in compile_assignment()
7032 if (compile_assign_lhs(var_start, &lhs, cmdidx, in compile_assignment()
7038 if (lhs.lhs_has_type in compile_assignment()
7039 && need_type(&t_list_string, lhs.lhs_type, in compile_assignment()
7061 && compile_load_lhs_with_index(&lhs, var_start, in compile_assignment()
7080 if (lhs.lhs_new_local) in compile_assignment()
7085 if (lhs.lhs_new_local) in compile_assignment()
7090 if (lhs.lhs_new_local) in compile_assignment()
7113 if (lhs.lhs_lvar != NULL && (is_decl || !lhs.lhs_has_type)) in compile_assignment()
7117 && !lhs.lhs_has_index in compile_assignment()
7118 && var_wrong_func_name(lhs.lhs_name, TRUE)) in compile_assignment()
7121 if (lhs.lhs_new_local && !lhs.lhs_has_type) in compile_assignment()
7133 lhs.lhs_lvar->lv_type = &t_list_any; in compile_assignment()
7135 lhs.lhs_lvar->lv_type = &t_dict_any; in compile_assignment()
7137 lhs.lhs_lvar->lv_type = &t_any; in compile_assignment()
7139 lhs.lhs_lvar->lv_type = rhs_type; in compile_assignment()
7144 type_T *use_type = lhs.lhs_lvar->lv_type; in compile_assignment()
7154 if (lhs.lhs_has_index in compile_assignment()
7155 && !has_list_index(var_start + lhs.lhs_varlen, in compile_assignment()
7157 use_type = lhs.lhs_member_type; in compile_assignment()
7165 type_T *lhs_type = lhs.lhs_member_type; in compile_assignment()
7189 else if (!lhs.lhs_has_type || lhs.lhs_dest == dest_option) in compile_assignment()
7199 switch (lhs.lhs_member_type->tt_type) in compile_assignment()
7261 expected = lhs.lhs_member_type; in compile_assignment()
7282 operator_type(lhs.lhs_member_type, stacktype), in compile_assignment()
7283 lhs.lhs_member_type, stacktype, in compile_assignment()
7295 if (lhs.lhs_has_index) in compile_assignment()
7299 if (compile_assign_unlet(var_start, &lhs, TRUE, rhs_type, cctx) in compile_assignment()
7308 if (is_decl && cmdidx == CMD_const && (lhs.lhs_dest == dest_script in compile_assignment()
7309 || lhs.lhs_dest == dest_global in compile_assignment()
7310 || lhs.lhs_dest == dest_local)) in compile_assignment()
7315 && (lhs.lhs_type->tt_type == VAR_DICT in compile_assignment()
7316 || lhs.lhs_type->tt_type == VAR_LIST) in compile_assignment()
7317 && lhs.lhs_type->tt_member != NULL in compile_assignment()
7318 && !(lhs.lhs_type->tt_member == &t_any in compile_assignment()
7321 && rhs_type->tt_type == lhs.lhs_type->tt_type in compile_assignment()
7323 && lhs.lhs_type->tt_member != &t_unknown) in compile_assignment()
7327 generate_SETTYPE(cctx, lhs.lhs_type); in compile_assignment()
7329 if (generate_store_lhs(cctx, &lhs, instr_count) == FAIL) in compile_assignment()
7338 var_start = skipwhite(lhs.lhs_dest_end + 1); in compile_assignment()
7352 vim_free(lhs.lhs_name); in compile_assignment()
7468 lhs_T lhs; in compile_unlet() local
7477 ret = compile_lhs(p, &lhs, CMD_unlet, FALSE, 0, cctx); in compile_unlet()
7480 if (!lhs.lhs_has_index) in compile_unlet()
7489 ret = compile_assign_unlet(p, &lhs, FALSE, &t_void, cctx); in compile_unlet()
7492 vim_free(lhs.lhs_name); in compile_unlet()
9376 lhs_T *lhs = &cctx->ctx_redir_lhs; in compile_redir() local
9378 if (lhs->lhs_name != NULL) in compile_redir()
9382 if (lhs->lhs_append) in compile_redir()
9385 if (compile_load_lhs_with_index(lhs, lhs->lhs_whole, in compile_redir()
9394 if (lhs->lhs_append) in compile_redir()
9397 if (lhs->lhs_has_index) in compile_redir()
9401 if (compile_assign_unlet(lhs->lhs_whole, lhs, TRUE, in compile_redir()
9405 else if (generate_store_lhs(cctx, lhs, -1) == FAIL) in compile_redir()
9408 VIM_CLEAR(lhs->lhs_name); in compile_redir()
9409 VIM_CLEAR(lhs->lhs_whole); in compile_redir()
9429 if (compile_assign_lhs(arg, lhs, CMD_redir, in compile_redir()
9433 lhs->lhs_append = append; in compile_redir()
9434 if (lhs->lhs_has_index) in compile_redir()
9436 lhs->lhs_whole = vim_strnsave(arg, lhs->lhs_varlen_total); in compile_redir()
9437 if (lhs->lhs_whole == NULL) in compile_redir()
9441 return arg + lhs->lhs_varlen_total; in compile_redir()