semantic: Generate a function stack in Context.setupFromScope.