Consider the following MWE:

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\shade[top color=yellow,bottom color=green] (-2,0) to[out=-90,in=180] (0,-2) to[out=0,in=-90] (2,0) to[out=-90-35,in=0] (0,-.7) to[out=180,in=-55] (-2,0);
\end{tikzpicture}
\end{document}


whose output is

As you can see, the top color=yellow only affects the upper tips/vertices of the shape. I was expecting something of the form

where I apologise for the crappy paint job. In any case, I wanted the shading to follow the shape of the object: that the upper edge is yellow, the bottom one is green, and that the gradient affects the whole figure, and not only the upper vertices.

How can this be done (in TikZ)? It would be nice to understand the general case but, if it's not possible, the shape above suffices for my purposes.

The shades available are only radial or linear, but you can solve this using a clipped area and draw the shape many times shifted by some value in the y coordinate while the color is changed. Also you can use many clipped shapes to draw another elements outside if you put it in a scope.

RESULT:

MWE:

\documentclass[tikz,border=20pt]{standalone}
\begin{document}
\begin{tikzpicture}

\begin{scope}
\clip
(-2,0)
to[out=-90,in=180] (0,-2)
to[out=0,in=-90] (2,0)
to[out=-90-35,in=0](0,-.7)
to[out=180,in=-55] (-2,0);

\foreach \x [evaluate=\x as \xn using {\x*4}] in {1,...,25} {
\fill[green!\xn!yellow,yshift=2-\x]
(-2,0)
to[out=-90,in=180] (0,-2)
to[out=0,in=-90] (2,0)
to[out=-90-35,in=0](0,-.7)
to[out=180,in=-55] (-2,0);
}
\end{scope}
\end{tikzpicture}
\end{document}


Welcome to TeX.SE! The answer is, AFAIK, that there is no predefined way of doing this. However, you can cheat and use some of the options that come with the shadings library together with clip to do something along the lines you are suggesting.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\clip (-2,0) to[out=-90,in=180] (0,-2) to[out=0,in=-90] (2,0) to[out=-90-35,in=0] (0,-.7) to[out=180,in=-55] (-2,0);
\end{tikzpicture}
\end{document}


I could not resist adding something more fancy based on cfr's fancy radial shading. This also is meant to illustrate how one can customize shading.

\documentclass[border=3.14mm,x11names,dvipsnames,svgnames]{standalone}
\usepackage{tikz}
}
\tikzset{%
\tikzset{%
#1
}
},
},
},
},
inner color/.style={
},
outer color/.style={
},
mid color/.style={

And, of course, there are all the advanced options described in section 109 of the pgfmanual. In principle you could try to use \pgfsetadditionalshadetransform but this is major effort and also won't lead to a universal solution. I'd also like to mention that it seems nontrivial to implement nonlinear transformations here (see here). If this problem was not there, one may be able to construct a general solution in a similar way as the bending library works, i.e. define a nonlinear transformation from a path.