comparison src/vim9execute.c @ 33678:7d9d2404a3d4 v9.0.2076

patch 9.0.2076: Vim9: No support for type aliases Commit: https://github.com/vim/vim/commit/ec3cebbd2b6b7583d2f683f5e66345163ec122aa Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Fri Oct 27 19:35:26 2023 +0200 patch 9.0.2076: Vim9: No support for type aliases Problem: Vim9: No support for type aliases Solution: Implement :type command A type definition is giving a name to a type specification. This also known type alias. :type ListOfStrings = list<string> The type alias can be used wherever a built-in type can be used. The type alias name must start with an upper case character. closes: #13407 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Fri, 27 Oct 2023 19:45:05 +0200
parents 31fb1a760ad6
children f126ffc85f7c
comparison
equal deleted inserted replaced
33677:96debbc2abd9 33678:7d9d2404a3d4
3805 3805
3806 // store local variable 3806 // store local variable
3807 case ISN_STORE: 3807 case ISN_STORE:
3808 --ectx->ec_stack.ga_len; 3808 --ectx->ec_stack.ga_len;
3809 tv = STACK_TV_VAR(iptr->isn_arg.number); 3809 tv = STACK_TV_VAR(iptr->isn_arg.number);
3810 if (STACK_TV_BOT(0)->v_type == VAR_TYPEALIAS)
3811 {
3812 semsg(_(e_using_typealias_as_variable),
3813 STACK_TV_BOT(0)->vval.v_typealias->ta_name);
3814 clear_tv(STACK_TV_BOT(0));
3815 goto on_error;
3816 }
3810 clear_tv(tv); 3817 clear_tv(tv);
3811 *tv = *STACK_TV_BOT(0); 3818 *tv = *STACK_TV_BOT(0);
3812 break; 3819 break;
3813 3820
3814 // store s: variable in old script or autoload import 3821 // store s: variable in old script or autoload import
7515 case VAR_ANY: 7522 case VAR_ANY:
7516 case VAR_VOID: 7523 case VAR_VOID:
7517 case VAR_INSTR: 7524 case VAR_INSTR:
7518 case VAR_CLASS: 7525 case VAR_CLASS:
7519 case VAR_OBJECT: 7526 case VAR_OBJECT:
7527 case VAR_TYPEALIAS:
7520 break; 7528 break;
7521 } 7529 }
7522 return FALSE; 7530 return FALSE;
7523 } 7531 }
7524 7532