Adapt to new pattern matcher.

The new pattern matcher represents partial functions as instances of
anonymous classes. This trips up our code generation so we replace the
Block with the pattern match.