Commit b729f4b
committed
Address PR #155 review feedback
Fixed the following issues raised in code review:
1. Added validation to reject increment/decrement on literal numbers
- Now correctly errors on expressions like `echo $(++2)`
- Operators can only be applied to variables or parenthesized expressions
2. Replaced .unwrap() calls with proper error handling
- Fixed unwrap() in unary_pre_arithmetic_expr (line 1738)
- Fixed unwrap() in unary_post_arithmetic_expr (line 1783)
- Used ok_or_else() with descriptive error messages
3. Fixed missing parse_variable_expansion function
- Restored function that was accidentally removed during merge
- Fixes compilation errors
4. Fixed stray conflict marker in types.rs
- Removed leftover "<<<<<<< HEAD" marker
All tests pass and manual testing confirms:
- Post-increment (a++) returns original value, updates variable
- Pre-increment (++a) returns new value, updates variable
- Invalid expressions like ++2 correctly produce errors1 parent 67c3cda commit b729f4b
2 files changed
+84
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1735 | 1735 | | |
1736 | 1736 | | |
1737 | 1737 | | |
1738 | | - | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
1739 | 1742 | | |
1740 | 1743 | | |
1741 | 1744 | | |
| |||
1752 | 1755 | | |
1753 | 1756 | | |
1754 | 1757 | | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
1755 | 1766 | | |
1756 | 1767 | | |
1757 | 1768 | | |
| |||
1780 | 1791 | | |
1781 | 1792 | | |
1782 | 1793 | | |
1783 | | - | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
1784 | 1798 | | |
1785 | 1799 | | |
1786 | 1800 | | |
| |||
1793 | 1807 | | |
1794 | 1808 | | |
1795 | 1809 | | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
1796 | 1818 | | |
1797 | 1819 | | |
1798 | 1820 | | |
| |||
1834 | 1856 | | |
1835 | 1857 | | |
1836 | 1858 | | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
1837 | 1919 | | |
1838 | 1920 | | |
1839 | 1921 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1122 | 1122 | | |
1123 | 1123 | | |
1124 | 1124 | | |
1125 | | - | |
1126 | 1125 | | |
1127 | 1126 | | |
1128 | 1127 | | |
| |||
0 commit comments