Commit f7e3382
authored
feat(runtime): add nullability annotations to NativeScript.h (#461)
* feat(runtime): add nullability annotations to NativeScript.h
Without them every pointer in the embedder API imports into Swift as
implicitly unwrapped, which hides the contract the implementation
already has: BaseDir, the script string and the Config argument are
required (their UTF8String feeds a std::string), while ApplicationPath,
MetadataPtr and Arguments are optional with defaults (BaseDir/app, the
__TNSMetadata section, no inspector arguments). initWithConfig: never
returns nil.
* fix(runtime): read no inspector flags from a nil Arguments array
Config.Arguments is optional, but ArgumentsCount was handed to the
inspector as is, so a nil array with a count above one made debug
startup index a null argv. Pass a count of 0 when the array is nil;
the argv loop keeps the C contract and trusts the count it is given.1 parent 8c35e95 commit f7e3382
2 files changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
6 | | - | |
7 | | - | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | | - | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| |||
0 commit comments