Commit 3fe1151
committed
Migrate compound state reads to struct field guards
This PR migrates all pattern-match reads of compound state tuples
({:driving, status, drive}, {:charging, cproc}, {:updating, update})
to use the corresponding Data struct fields instead.
Changes:
- vehicle_in_service driving case: guard on data.current_drive != nil,
read drive from data.current_drive, clear both current_drive and
driving_status on exit from driving state
- remaining_distance interval: use {current_drive, current_charging_process}
tuple instead of compound state pattern match
- asleep handler: guard on driving_status != nil && driving_status != :available
to detect offline sub-states, clear driving_status on :start exit
- fetch can_fall_asleep?: add guards on current_drive/update/charging_process
- fetch reachable: same guards added
- All 6 transitions to :start from driving state now clear driving_status: nil
The compound state tuples remain in next_state positions (handled in prior
PR), so this is purely a read migration. No behaviour changes expected.
No behaviour changes - all guards are guaranteed true at runtime given
correct dual-write population from prior PR.1 parent 3ef21e1 commit 3fe1151
1 file changed
Lines changed: 32 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
472 | 474 | | |
473 | 475 | | |
474 | 476 | | |
| |||
478 | 480 | | |
479 | 481 | | |
480 | 482 | | |
481 | | - | |
| 483 | + | |
| 484 | + | |
482 | 485 | | |
483 | 486 | | |
484 | 487 | | |
| |||
525 | 528 | | |
526 | 529 | | |
527 | 530 | | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
533 | 543 | | |
534 | 544 | | |
535 | 545 | | |
| |||
1206 | 1216 | | |
1207 | 1217 | | |
1208 | 1218 | | |
1209 | | - | |
| 1219 | + | |
| 1220 | + | |
1210 | 1221 | | |
1211 | 1222 | | |
1212 | 1223 | | |
| |||
1269 | 1280 | | |
1270 | 1281 | | |
1271 | 1282 | | |
1272 | | - | |
| 1283 | + | |
1273 | 1284 | | |
1274 | 1285 | | |
1275 | 1286 | | |
1276 | 1287 | | |
1277 | 1288 | | |
1278 | | - | |
| 1289 | + | |
1279 | 1290 | | |
1280 | 1291 | | |
1281 | 1292 | | |
| |||
1287 | 1298 | | |
1288 | 1299 | | |
1289 | 1300 | | |
1290 | | - | |
| 1301 | + | |
| 1302 | + | |
1291 | 1303 | | |
1292 | | - | |
| 1304 | + | |
1293 | 1305 | | |
1294 | 1306 | | |
1295 | 1307 | | |
| |||
1345 | 1357 | | |
1346 | 1358 | | |
1347 | 1359 | | |
1348 | | - | |
| 1360 | + | |
| 1361 | + | |
1349 | 1362 | | |
1350 | 1363 | | |
1351 | 1364 | | |
| |||
1513 | 1526 | | |
1514 | 1527 | | |
1515 | 1528 | | |
1516 | | - | |
| 1529 | + | |
1517 | 1530 | | |
1518 | 1531 | | |
1519 | | - | |
| 1532 | + | |
1520 | 1533 | | |
1521 | 1534 | | |
1522 | | - | |
| 1535 | + | |
1523 | 1536 | | |
1524 | 1537 | | |
1525 | 1538 | | |
| |||
1545 | 1558 | | |
1546 | 1559 | | |
1547 | 1560 | | |
1548 | | - | |
1549 | | - | |
1550 | | - | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
1551 | 1564 | | |
1552 | 1565 | | |
1553 | 1566 | | |
| |||
0 commit comments