Commit 7b528b3
committed
fix(extraction): reach a Swift URL built by a constructor
Swift has no URL literal, so almost no real code passes a bare string to a
request. It writes URL(string: "https://…")! instead, and the literal then
sits two levels below the argument list: past the trailing "!", which the
grammar models as a postfix_expression, and inside the constructor's own
value_arguments.
extract_url_or_topic_arg saw only the outer node and gave up, so the URL
never reached the service-pattern table and no Route node formed. That is
the shape issue DeusData#1892 reported from a real project — reaching a bare string
argument was only the layer underneath it.
swift_unwrap_url_constructor() steps past both wrappers. It unwraps only
URL, URLComponents and URLRequest, so any other constructor keeps its own
meaning and the outer call does not borrow the inner call's string. A
non-literal argument such as URL(string: base + path) falls through to the
ordinary handling unchanged.
The value_argument unwrap added for the bare-string case is now
swift_argument_value(), because the nested argument list needs the same
step and the code was identical.
Refs DeusData#1892
Signed-off-by: Joshua Richter <jrichter5781@gmail.com>1 parent c4e9028 commit 7b528b3
3 files changed
Lines changed: 160 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2246 | 2246 | | |
2247 | 2247 | | |
2248 | 2248 | | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
2249 | 2304 | | |
2250 | 2305 | | |
2251 | 2306 | | |
| |||
2289 | 2344 | | |
2290 | 2345 | | |
2291 | 2346 | | |
2292 | | - | |
2293 | | - | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
2301 | 2353 | | |
2302 | 2354 | | |
2303 | 2355 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4062 | 4062 | | |
4063 | 4063 | | |
4064 | 4064 | | |
| 4065 | + | |
| 4066 | + | |
| 4067 | + | |
| 4068 | + | |
| 4069 | + | |
| 4070 | + | |
| 4071 | + | |
| 4072 | + | |
| 4073 | + | |
| 4074 | + | |
| 4075 | + | |
| 4076 | + | |
| 4077 | + | |
| 4078 | + | |
| 4079 | + | |
| 4080 | + | |
| 4081 | + | |
| 4082 | + | |
| 4083 | + | |
| 4084 | + | |
| 4085 | + | |
| 4086 | + | |
| 4087 | + | |
| 4088 | + | |
| 4089 | + | |
| 4090 | + | |
| 4091 | + | |
| 4092 | + | |
| 4093 | + | |
| 4094 | + | |
| 4095 | + | |
| 4096 | + | |
| 4097 | + | |
| 4098 | + | |
| 4099 | + | |
| 4100 | + | |
| 4101 | + | |
| 4102 | + | |
| 4103 | + | |
| 4104 | + | |
| 4105 | + | |
| 4106 | + | |
| 4107 | + | |
| 4108 | + | |
| 4109 | + | |
| 4110 | + | |
4065 | 4111 | | |
4066 | 4112 | | |
4067 | 4113 | | |
| |||
6818 | 6864 | | |
6819 | 6865 | | |
6820 | 6866 | | |
| 6867 | + | |
| 6868 | + | |
| 6869 | + | |
6821 | 6870 | | |
6822 | 6871 | | |
6823 | 6872 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5485 | 5485 | | |
5486 | 5486 | | |
5487 | 5487 | | |
| 5488 | + | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
| 5495 | + | |
| 5496 | + | |
| 5497 | + | |
| 5498 | + | |
| 5499 | + | |
| 5500 | + | |
| 5501 | + | |
| 5502 | + | |
| 5503 | + | |
| 5504 | + | |
| 5505 | + | |
| 5506 | + | |
| 5507 | + | |
| 5508 | + | |
| 5509 | + | |
| 5510 | + | |
| 5511 | + | |
| 5512 | + | |
| 5513 | + | |
| 5514 | + | |
| 5515 | + | |
| 5516 | + | |
| 5517 | + | |
| 5518 | + | |
| 5519 | + | |
| 5520 | + | |
| 5521 | + | |
| 5522 | + | |
| 5523 | + | |
| 5524 | + | |
| 5525 | + | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
| 5530 | + | |
| 5531 | + | |
| 5532 | + | |
| 5533 | + | |
| 5534 | + | |
| 5535 | + | |
| 5536 | + | |
5488 | 5537 | | |
5489 | 5538 | | |
5490 | 5539 | | |
| |||
13200 | 13249 | | |
13201 | 13250 | | |
13202 | 13251 | | |
| 13252 | + | |
13203 | 13253 | | |
13204 | 13254 | | |
13205 | 13255 | | |
| |||
0 commit comments