fix(gen): replace named function with anonymous

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