patch 8.2.1851: Vim9: "!" followed by space incorrectly used

Problem:    Vim9: "!" followed by space incorrectly used.
Solution:   Skip over trailing spaces. (closes #7131)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 0f29ceb..7415624 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3041,7 +3041,7 @@
 	    ++p;
 	    break;
 	}
-	else
+	else if (*p == '!')
 	{
 	    int v = tv2bool(rettv);
 
@@ -3178,12 +3178,13 @@
 	}
 	else
 	{
-	    int  invert = TRUE;
+	    int  invert = *p == '!';
 
-	    while (p > start && p[-1] == '!')
+	    while (p > start && (p[-1] == '!' || VIM_ISWHITE(p[-1])))
 	    {
+		if (p[-1] == '!')
+		    invert = !invert;
 		--p;
-		invert = !invert;
 	    }
 	    if (generate_2BOOL(cctx, invert) == FAIL)
 		return FAIL;