fix(gen): replace named function with anonymous

factory and provider have anonymous functions, so for consistency reasons service also should have one.