diff options
author | Vladimir Azarov <avm@intermediate-node.net> | 2025-08-11 23:11:32 +0200 |
---|---|---|
committer | Vladimir Azarov <avm@intermediate-node.net> | 2025-08-11 23:11:32 +0200 |
commit | aad6f4f80e3196b052e96176ff412ddb7ceb7ef6 (patch) | |
tree | 71cce0d0423b699f63ad51826cddfc75d17f4489 /parser.fun | |
parent | 47ce22ee86ad9fb329585e7d9ae2052772248c95 (diff) |
Mul/Div by constant transformation
Diffstat (limited to 'parser.fun')
-rw-r--r-- | parser.fun | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -235,6 +235,9 @@ functor Parser(structure Tree: TREE; structure P: PPC; in case t of remote_t id => resolve id + | array_t (n, elT) => array_t (n, resolveType elT) + | function_t (rt, args, variadic) => + function_t (resolveType rt, map resolveType args, variadic) | t => t end @@ -1511,7 +1514,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; end and isLvalue (EA (_, _, lvalue, _)) = lvalue - and getT (EA (_, _, _, t)) = t + and getT (EA (_, _, _, t)) = resolveType t and getPos (EA (_, pos, _, _)) = pos and setT (EA (binop, pos, lvalue, _)) t = EA (binop, pos, lvalue, t) @@ -1703,7 +1706,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; else P.error (getPos right) `"expression has a type incompatible with its sibling: " - `"(" Pctype leftT `", >" Pctype rightT `")" % + `"(" Pctype leftT `", >>" Pctype rightT `")" % else P.error (getPos left) `"expected value of an arithmetic type or a pointer" % @@ -2235,9 +2238,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; and eval' (EA (e, pos, _, t)) = case e of Eid _ => P.error pos `"variable in constant expression" % - | Econst (_, Ninteger w) => - (printf `"eval num: " W w `": " Pctype t `"\n" %; - ER (w, t)) + | Econst (_, Ninteger w) => ER (w, t) | Econst _ => raise Unreachable | Estrlit _ => P.error pos `"string literal in constant expression" % | EmemberByV _ | EmemberByP _ => |