(source *Signature, target *Signature, callback func(s *Type, t *Type))
| 832 | } |
| 833 | |
| 834 | func (c *Checker) applyToParameterTypes(source *Signature, target *Signature, callback func(s *Type, t *Type)) { |
| 835 | sourceCount := c.getParameterCount(source) |
| 836 | targetCount := c.getParameterCount(target) |
| 837 | sourceRestType := c.getEffectiveRestType(source) |
| 838 | targetRestType := c.getEffectiveRestType(target) |
| 839 | targetNonRestCount := targetCount |
| 840 | if targetRestType != nil { |
| 841 | targetNonRestCount-- |
| 842 | } |
| 843 | paramCount := targetNonRestCount |
| 844 | if sourceRestType == nil { |
| 845 | paramCount = min(sourceCount, targetNonRestCount) |
| 846 | } |
| 847 | sourceThisType := c.getThisTypeOfSignature(source) |
| 848 | if sourceThisType != nil { |
| 849 | targetThisType := c.getThisTypeOfSignature(target) |
| 850 | if targetThisType != nil { |
| 851 | callback(sourceThisType, targetThisType) |
| 852 | } |
| 853 | } |
| 854 | for i := range paramCount { |
| 855 | callback(c.getTypeAtPosition(source, i), c.getTypeAtPosition(target, i)) |
| 856 | } |
| 857 | if targetRestType != nil { |
| 858 | callback(c.getRestTypeAtPosition(source, paramCount, c.isConstTypeVariable(targetRestType, 0) && !someType(targetRestType, c.isMutableArrayLikeType) /*readonly*/), targetRestType) |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | func (c *Checker) applyToReturnTypes(source *Signature, target *Signature, callback func(s *Type, t *Type)) { |
| 863 | targetTypePredicate := c.getTypePredicateOfSignature(target) |
no test coverage detected