diff src/vim9compile.c @ 19566:ec1eeb1b69e2 v8.2.0340

patch 8.2.0340: Vim9: function and partial types not tested Commit: https://github.com/vim/vim/commit/087d2e15184bea3bf455dd266bd6ed66a45396e5 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 1 15:36:42 2020 +0100 patch 8.2.0340: Vim9: function and partial types not tested Problem: Vim9: function and partial types not tested. Solution: Support more for partial, add tests.
author Bram Moolenaar <Bram@vim.org>
date Sun, 01 Mar 2020 15:45:03 +0100
parents 06f29b6ea04a
children 6b6e97d0185e
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -706,6 +706,23 @@ generate_PUSHFUNC(cctx_T *cctx, char_u *
 }
 
 /*
+ * Generate an ISN_PUSHPARTIAL instruction with partial "part".
+ * Consumes "name".
+ */
+    static int
+generate_PUSHPARTIAL(cctx_T *cctx, partial_T *part)
+{
+    isn_T	*isn;
+
+    if ((isn = generate_instr_type(cctx, ISN_PUSHPARTIAL,
+						      &t_partial_any)) == NULL)
+	return FAIL;
+    isn->isn_arg.partial = part;
+
+    return OK;
+}
+
+/*
  * Generate an ISN_STORE instruction.
  */
     static int
@@ -3605,8 +3622,7 @@ compile_assignment(char_u *arg, exarg_T 
 		generate_PUSHFUNC(cctx, NULL);
 		break;
 	    case VAR_PARTIAL:
-		// generate_PUSHPARTIAL(cctx, NULL);
-		emsg("Partial type not supported yet");
+		generate_PUSHPARTIAL(cctx, NULL);
 		break;
 	    case VAR_LIST:
 		generate_NEWLIST(cctx, 0);
@@ -5228,7 +5244,7 @@ delete_instr(isn_T *isn)
 	    break;
 
 	case ISN_PUSHPARTIAL:
-	    // TODO
+	    partial_unref(isn->isn_arg.partial);
 	    break;
 
 	case ISN_PUSHJOB: