Commit e5d33b0
committed
Phase 112 Part 1: Operator type safety - use enum classes directly
Changed FuncState operator method signatures to accept enum types:
- prefix(UnOpr op, ...) - was prefix(int op, ...)
- infix(BinOpr op, ...) - was infix(int op, ...)
- posfix(BinOpr op, ...) - was posfix(int op, ...)
Impact:
- Eliminated 6 redundant static_cast operations (enum→int→enum roundtrip)
- Improved type safety - prevents passing invalid operator values
- Self-documenting function signatures
- Zero performance impact - enums compile to same underlying type
Files changed:
- src/compiler/lparser.h (function signatures)
- src/compiler/lcode.cpp (implementations)
- src/compiler/parser.cpp (call sites - removed casts)
Performance: 4.49s avg (baseline 4.20s, variance 4.01-4.95s)
All tests passing: "final OK !!!"1 parent 17291bf commit e5d33b0
3 files changed
+12
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1485 | 1485 | | |
1486 | 1486 | | |
1487 | 1487 | | |
1488 | | - | |
1489 | | - | |
| 1488 | + | |
1490 | 1489 | | |
1491 | 1490 | | |
1492 | 1491 | | |
| |||
1495 | 1494 | | |
1496 | 1495 | | |
1497 | 1496 | | |
1498 | | - | |
| 1497 | + | |
1499 | 1498 | | |
1500 | 1499 | | |
1501 | 1500 | | |
| |||
1506 | 1505 | | |
1507 | 1506 | | |
1508 | 1507 | | |
1509 | | - | |
1510 | | - | |
| 1508 | + | |
1511 | 1509 | | |
1512 | 1510 | | |
1513 | 1511 | | |
| |||
1551 | 1549 | | |
1552 | 1550 | | |
1553 | 1551 | | |
1554 | | - | |
1555 | | - | |
| 1552 | + | |
1556 | 1553 | | |
1557 | | - | |
| 1554 | + | |
1558 | 1555 | | |
1559 | 1556 | | |
1560 | 1557 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
585 | 584 | | |
586 | 585 | | |
587 | 586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
879 | 879 | | |
880 | 880 | | |
881 | 881 | | |
882 | | - | |
| 882 | + | |
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
| |||
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
892 | | - | |
| 892 | + | |
893 | 893 | | |
894 | 894 | | |
895 | | - | |
| 895 | + | |
896 | 896 | | |
897 | 897 | | |
898 | 898 | | |
| |||
0 commit comments