@@ -1764,13 +1764,49 @@ bool TypeSystemSwiftTypeRef::IsFunctionPointerType(
1764
1764
VALIDATE_AND_RETURN (impl, IsFunctionPointerType, type,
1765
1765
(ReconstructType (type)));
1766
1766
}
1767
+
1767
1768
bool TypeSystemSwiftTypeRef::IsPossibleDynamicType (opaque_compiler_type_t type,
1768
1769
CompilerType *target_type,
1769
1770
bool check_cplusplus,
1770
1771
bool check_objc) {
1771
- return m_swift_ast_context->IsPossibleDynamicType (
1772
- ReconstructType (type), target_type, check_cplusplus, check_objc);
1772
+ if (target_type)
1773
+ target_type->Clear ();
1774
+
1775
+ if (!type)
1776
+ return false ;
1777
+
1778
+ auto impl = [&]() {
1779
+ using namespace swift ::Demangle;
1780
+ Demangler dem;
1781
+ auto *node = DemangleCanonicalType (dem, type);
1782
+ if (!node)
1783
+ return false ;
1784
+
1785
+ switch (node->getKind ()) {
1786
+ case Node::Kind::Class:
1787
+ case Node::Kind::BoundGenericClass:
1788
+ case Node::Kind::Protocol:
1789
+ case Node::Kind::ProtocolList:
1790
+ case Node::Kind::ProtocolListWithClass:
1791
+ case Node::Kind::DynamicSelf:
1792
+ return true ;
1793
+ case Node::Kind::BuiltinTypeName: {
1794
+ if (!node->hasText ())
1795
+ return false ;
1796
+ auto name = node->getText ();
1797
+ return name == swift::BUILTIN_TYPE_NAME_RAWPOINTER ||
1798
+ name == swift::BUILTIN_TYPE_NAME_NATIVEOBJECT ||
1799
+ name == swift::BUILTIN_TYPE_NAME_BRIDGEOBJECT;
1800
+ }
1801
+ default :
1802
+ return ContainsGenericTypeParameter (node);
1803
+ }
1804
+ };
1805
+ VALIDATE_AND_RETURN (
1806
+ impl, IsPossibleDynamicType, type,
1807
+ (ReconstructType (type), nullptr , check_cplusplus, check_objc));
1773
1808
}
1809
+
1774
1810
bool TypeSystemSwiftTypeRef::IsPointerType (opaque_compiler_type_t type,
1775
1811
CompilerType *pointee_type) {
1776
1812
auto impl = [&]() {
0 commit comments