Handle anonymous lambda calls in toplevel scope

Fixes #774