Omit all window-function related code when building with SQLITE_OMIT_WINDOWFUNC.

FossilOrigin-Name: 5f04b016467342b5a796bf702ed25b621eb86f2961c1e703d276c93f2cb6aa89
diff --git a/src/resolve.c b/src/resolve.c
index 221564f..84ec659 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -757,6 +757,7 @@
         }
       }
 
+#ifndef SQLITE_OMIT_WINDOWFUNC
       if( is_agg==0 && pExpr->pWin ){
         sqlite3ErrorMsg(pParse, 
             "%.*s() may not be used as a window function", nId, zId
@@ -773,6 +774,10 @@
         }else{
           zType = "aggregate";
         }
+#else
+      if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){
+        const char *zType = "aggregate";
+#endif
         sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()", zType, nId,zId);
         pNC->nErr++;
         is_agg = 0;
@@ -791,6 +796,7 @@
       if( is_agg ) pNC->ncFlags &= ~NC_AllowAgg;
       sqlite3WalkExprList(pWalker, pList);
       if( is_agg ){
+#ifndef SQLITE_OMIT_WINDOWFUNC
         if( pExpr->pWin ){
           Select *pSel = pNC->pWinSelect;
           sqlite3WindowUpdate(pParse, pSel->pWinDefn, pExpr->pWin, pDef);
@@ -800,7 +806,9 @@
             pExpr->pWin->pNextWin = pSel->pWin;
             pSel->pWin = pExpr->pWin;
           }
-        }else{
+        }else
+#endif /* SQLITE_OMIT_WINDOWFUNC */
+        {
           NameContext *pNC2 = pNC;
           pExpr->op = TK_AGG_FUNCTION;
           pExpr->op2 = 0;
@@ -1264,7 +1272,6 @@
   nCompound = 0;
   pLeftmost = p;
   while( p ){
-    assert( p->pWin==0 );
     assert( (p->selFlags & SF_Expanded)!=0 );
     assert( (p->selFlags & SF_Resolved)==0 );
     p->selFlags |= SF_Resolved;