refactoring and extending offline part of type coercion analysis