Commit 64f021c
committed
Insert explicit return expressions in functions/macros/do-blocks
This patch make sure that function and macro definitions, as well as
do-blocks, end with an explicit `return` statement before the last
expression in the body. The following exceptions are made:
- If the last expression is a `for` or `while` loop (which both always
evaluate to `nothing`) `return nothing` is added *after* the loop.
- If the last expression is a `if` or `try` block the `return` is only
added in case there is no `return` inside any of the branches.
- If the last expression is a `let` or `begin` block the `return` is
only added in case there is no `return` inside the block.
- If the last expression is a function call, and the function name is
`throw`, `rethrow`, or `error`, no `return` is added. This is because
it is pretty obvious that these calls terminate the function without
the explicit `return`.
Closes #43.1 parent 57e5cd3 commit 64f021c
File tree
5 files changed
+115
-25
lines changed- src
- test
5 files changed
+115
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| |||
399 | 400 | | |
400 | 401 | | |
401 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
402 | 439 | | |
403 | 440 | | |
404 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3371 | 3371 | | |
3372 | 3372 | | |
3373 | 3373 | | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + | |
| 3391 | + | |
| 3392 | + | |
| 3393 | + | |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
3374 | 3403 | | |
3375 | 3404 | | |
3376 | 3405 | | |
3377 | | - | |
3378 | | - | |
3379 | | - | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
3380 | 3413 | | |
3381 | 3414 | | |
3382 | 3415 | | |
3383 | 3416 | | |
3384 | | - | |
3385 | | - | |
3386 | | - | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
3387 | 3421 | | |
3388 | 3422 | | |
3389 | 3423 | | |
3390 | 3424 | | |
3391 | | - | |
| 3425 | + | |
3392 | 3426 | | |
3393 | 3427 | | |
3394 | 3428 | | |
| |||
3403 | 3437 | | |
3404 | 3438 | | |
3405 | 3439 | | |
3406 | | - | |
| 3440 | + | |
3407 | 3441 | | |
3408 | 3442 | | |
3409 | 3443 | | |
3410 | 3444 | | |
3411 | | - | |
| 3445 | + | |
3412 | 3446 | | |
3413 | 3447 | | |
3414 | 3448 | | |
| |||
3445 | 3479 | | |
3446 | 3480 | | |
3447 | 3481 | | |
3448 | | - | |
| 3482 | + | |
3449 | 3483 | | |
3450 | 3484 | | |
3451 | | - | |
| 3485 | + | |
3452 | 3486 | | |
3453 | 3487 | | |
3454 | 3488 | | |
| |||
3469 | 3503 | | |
3470 | 3504 | | |
3471 | 3505 | | |
3472 | | - | |
3473 | | - | |
3474 | | - | |
3475 | | - | |
3476 | | - | |
3477 | | - | |
3478 | | - | |
3479 | | - | |
3480 | | - | |
3481 | | - | |
3482 | 3506 | | |
3483 | 3507 | | |
3484 | 3508 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1238 | 1238 | | |
1239 | 1239 | | |
1240 | 1240 | | |
1241 | | - | |
| 1241 | + | |
| 1242 | + | |
1242 | 1243 | | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
1243 | 1252 | | |
1244 | 1253 | | |
1245 | 1254 | | |
| |||
1249 | 1258 | | |
1250 | 1259 | | |
1251 | 1260 | | |
1252 | | - | |
| 1261 | + | |
1253 | 1262 | | |
1254 | 1263 | | |
1255 | | - | |
| 1264 | + | |
1256 | 1265 | | |
1257 | 1266 | | |
1258 | 1267 | | |
1259 | 1268 | | |
1260 | 1269 | | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
1261 | 1289 | | |
1262 | 1290 | | |
1263 | 1291 | | |
| |||
0 commit comments