@@ -31,22 +31,78 @@ class BuiltInDeclaration extends AstNode
31
31
void visit (Visitation visitation) => visitation.visitBuiltInDeclaration (this );
32
32
}
33
33
34
- const _objectDecl =
35
- BuiltInDeclaration (id: 'c:objc(cs)NSObject' , name: 'NSObject' );
36
- const _stringDecl = BuiltInDeclaration (id: 's:SS' , name: 'String' );
37
34
const _intDecl = BuiltInDeclaration (id: 's:Si' , name: 'Int' );
38
35
const _floatDecl = BuiltInDeclaration (id: 's:Sf' , name: 'Float' );
39
36
const _doubleDecl = BuiltInDeclaration (id: 's:Sd' , name: 'Double' );
40
37
const _boolDecl = BuiltInDeclaration (id: 's:Sb' , name: 'Bool' );
41
38
const _voidDecl = BuiltInDeclaration (id: 's:s4Voida' , name: 'Void' );
42
39
40
+ // Certain types are toll-free bridged between Swift and ObjC. These types don't
41
+ // need @objc compatible wrappers. There's no complete list of these types in
42
+ // the documentation. The closest thing is this, but it's incomplete:
43
+ // https://developer.apple.com/documentation/swift/working-with-foundation-types
44
+ // TODO(https://github.com/dart-lang/native/issues/2485): Add Array, Set, and
45
+ // Dictionary to this list.
46
+ const _objectDecl =
47
+ BuiltInDeclaration (id: 'c:objc(cs)NSObject' , name: 'NSObject' );
48
+ const _errorDecl = BuiltInDeclaration (id: 'c:objc(cs)NSError' , name: 'NSError' );
49
+ const _affineTransformDecl = BuiltInDeclaration (
50
+ id: 's:10Foundation15AffineTransformV' , name: 'AffineTransform' );
51
+ const _calendarDecl =
52
+ BuiltInDeclaration (id: 's:10Foundation8CalendarV' , name: 'Calendar' );
53
+ const _characterSetDecl = BuiltInDeclaration (
54
+ id: 's:10Foundation12CharacterSetV' , name: 'CharacterSet' );
55
+ const _dataDecl = BuiltInDeclaration (id: 's:10Foundation4DataV' , name: 'Data' );
56
+ const _dateDecl = BuiltInDeclaration (id: 's:10Foundation4DateV' , name: 'Date' );
57
+ const _dateComponentsDecl = BuiltInDeclaration (
58
+ id: 's:10Foundation14DateComponentsV' , name: 'DateComponents' );
59
+ const _dateIntervalDecl = BuiltInDeclaration (
60
+ id: 's:10Foundation12DateIntervalV' , name: 'DateInterval' );
61
+ const _indexPathDecl =
62
+ BuiltInDeclaration (id: 's:10Foundation9IndexPathV' , name: 'IndexPath' );
63
+ const _indexSetDecl =
64
+ BuiltInDeclaration (id: 's:10Foundation8IndexSetV' , name: 'IndexSet' );
65
+ const _localeDecl =
66
+ BuiltInDeclaration (id: 's:10Foundation6LocaleV' , name: 'Locale' );
67
+ const _notificationDecl = BuiltInDeclaration (
68
+ id: 's:10Foundation12NotificationV' , name: 'Notification' );
69
+ const _stringDecl = BuiltInDeclaration (id: 's:SS' , name: 'String' );
70
+ const _timeZoneDecl =
71
+ BuiltInDeclaration (id: 's:10Foundation8TimeZoneV' , name: 'TimeZone' );
72
+ const _urlDecl = BuiltInDeclaration (id: 's:10Foundation3URLV' , name: 'URL' );
73
+ const _urlComponentsDecl = BuiltInDeclaration (
74
+ id: 's:10Foundation13URLComponentsV' , name: 'URLComponents' );
75
+ const _urlQueryItemDecl = BuiltInDeclaration (
76
+ id: 's:10Foundation12URLQueryItemV' , name: 'URLQueryItem' );
77
+ const _urlRequestDecl =
78
+ BuiltInDeclaration (id: 's:10Foundation10URLRequestV' , name: 'URLRequest' );
79
+ const _uuidDecl = BuiltInDeclaration (id: 's:10Foundation4UUIDV' , name: 'UUID' );
80
+
43
81
const builtInDeclarations = [
82
+ _affineTransformDecl,
83
+ _boolDecl,
84
+ _calendarDecl,
85
+ _characterSetDecl,
86
+ _dataDecl,
87
+ _dateComponentsDecl,
88
+ _dateDecl,
89
+ _dateIntervalDecl,
90
+ _doubleDecl,
91
+ _errorDecl,
92
+ _floatDecl,
93
+ _indexPathDecl,
94
+ _indexSetDecl,
95
+ _intDecl,
96
+ _localeDecl,
97
+ _notificationDecl,
44
98
_objectDecl,
45
99
_stringDecl,
46
- _intDecl,
47
- _floatDecl,
48
- _doubleDecl,
49
- _boolDecl,
100
+ _timeZoneDecl,
101
+ _urlComponentsDecl,
102
+ _urlDecl,
103
+ _urlQueryItemDecl,
104
+ _urlRequestDecl,
105
+ _uuidDecl,
50
106
_voidDecl,
51
107
];
52
108
0 commit comments