ClassScalarInliner: fix edge cases and internal refactoring