patch 8.2.2687: Vim9: cannot use "const" for global variable in :def function

Problem:    Vim9: cannot use "const" for global variable in :def function.
Solution:   Do allow using :const for a global variable. (closes #8030)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index fa73de2..ca1c89c 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5752,7 +5752,8 @@
 				      &lhs->lhs_opt_flags, &lhs->lhs_vimvaridx,
 						 &lhs->lhs_type, cctx) == FAIL)
 	    return FAIL;
-	if (lhs->lhs_dest != dest_local)
+	if (lhs->lhs_dest != dest_local
+				 && cmdidx != CMD_const && cmdidx != CMD_final)
 	{
 	    // Specific kind of variable recognized.
 	    declare_error = is_decl;
@@ -6519,6 +6520,7 @@
 	else
 	{
 	    if (is_decl && cmdidx == CMD_const && (lhs.lhs_dest == dest_script
+						|| lhs.lhs_dest == dest_global
 						|| lhs.lhs_dest == dest_local))
 		// ":const var": lock the value, but not referenced variables
 		generate_LOCKCONST(cctx);