Commit Graph

18 Commits

Author SHA1 Message Date
Xi Ge
f83ccd6438 migrator: handle changed parameter declarations by introducing bridging local variables.
When users override a SDK function whose parameter types have been changed,
we should introduce a local variable in the body of the function definition
to shadow the changed parameter. Also, a proper conversion function should
be applied to bridge the parameter to the local variable.

rdar://41828411
2018-07-11 13:41:37 -07:00
Xi Ge
c40ebd1d2d migrator: support migration of raw representable initializer calls without explicit labels. rdar://41740103
Some raw representable struct from SDK can be initialized without
explicit labels (rawValue:). When their types have been changed to type
alias, we should migrate the initializer calls to the argument alone.
2018-07-03 11:44:21 -07:00
Xi Ge
8e0e779cc2 migrator: handle the composite change of updating type alias to raw-representable and rename the referenced variables simultaneously. rdar://41732485 2018-07-02 12:13:20 -07:00
Xi Ge
9a0196e991 migrator: avoid adding conversion functions when expression types change as well.
When inserting conversion functions around expressions, we should check
whether the type of the expression is a recognized name alias that is
known to be changed to raw-value representable type. We should avoid
inserting conversion functions in this case because doing so causes
build errors.

resolves: rdar://40463990
2018-06-25 14:44:58 -07:00
Xi Ge
90303d12a6 migrator: handle the reversion of raw representable changes. rdar://39498127 2018-06-15 16:51:57 -07:00
Xi Ge
6433bc59e7 migrator: avoid migrating synthesized initializer calls. rdar://40860228 2018-06-11 15:30:38 -07:00
Xi Ge
55495ec267 migrator: avoid inserting round-trip conversion functions.
By postponing the insertion of conversion function calls, we can filter
out the expressions that require more than one helper function wrapper.

resolves: rdar://40979943
2018-06-11 15:08:26 -07:00
Xi Ge
0f71331d73 migrator: avoid inserting helper function call for nil expression. rdar://40173366 2018-05-11 17:24:52 -07:00
Xi Ge
d89b716cf1 migrator: handle composite changes that're necessary to both side of an assignment expression. rdar://40106370 2018-05-10 12:08:00 -07:00
Xi Ge
740e336e02 migrator: make sure we can handle the composite change of rename and string representable update. radr://40076924 2018-05-09 15:53:51 -07:00
Xi Ge
3ee07be5ba migrator: handle the migration of string enum variable references. 2018-04-18 14:24:19 -07:00
Xi Ge
5db971de0e migrator: handle assignment of attribute dictionary and others.
When users' codebase assigns an attribute dictionary that used to be of
type [String: Any], this migration inserts a helper function call on the source of
the assignment to bridge the type.
2018-04-18 11:11:27 -07:00
Xi Ge
6a4df3e820 migrator: handle return value migration introduced by string enum changes.
This patch migrates the function call whose return type used to "String" and
now becomes "StringRepresentableStruct".
2018-04-17 15:18:33 -07:00
Xi Ge
7cf8bf4d55 migrator: correct a typo in the inserted helper function. NFC 2018-04-16 13:36:00 -07:00
Xi Ge
65eaccb2fa migrator: teach the tool to handle ArrayMemberUpdate and OptionalArrayMemberUpdate attributes emitted from swift-api-digester.
This bridges the function call arguments that used to be of type [String] and
now become [StringRepresentableStruct].
2018-04-16 13:30:53 -07:00
Xi Ge
a138744e45 migrator: teach the tool to handle OptionalDictionaryKeyUpdate attributes emitted from swift-api-digester.
For a function call used to take [String: Any]? as argument and now
takes [StringRepresentableStruct: Any]?, a helper function is inserted
to help the bridging of types.
2018-04-16 10:57:36 -07:00
Xi Ge
4c10f16c0e migrator: teach the tool to handle DictionaryKeyUpdate attribute on arguments.
When a user's code calls a function that used to take [String: Any] as
argument and now takes [StringRepresentableStruct: Any], this migration
inserts a helper function to convert the argument to the
expected type.
2018-04-13 16:55:19 -07:00
Xi Ge
4c4e4d2b79 migrator: handle simple attribute assignment and reference.
This patch migrates simple attribute assignment and reference when the
attribute used to be of type String and later became StringRepresentable struct.

Related: rdar://38192995
2018-04-12 11:54:28 -07:00