From 66665caf9da212c121c99de95a18e6ae3470cdbc Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Sun, 10 Aug 2025 22:01:56 +0200 Subject: String literal deduplication --- parser.fun | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'parser.fun') diff --git a/parser.fun b/parser.fun index 754aab6..0d2c774 100644 --- a/parser.fun +++ b/parser.fun @@ -272,9 +272,8 @@ functor Parser(structure Tree: TREE; structure P: PPC; strlits: int list } - val intCompare = fn a => fn b => Int.compare (a, b) - val lookup = fn z => Tree.lookup intCompare z - val lookup2 = fn z => Tree.lookup2 intCompare z + val lookup = fn z => Tree.lookup compare z + val lookup2 = fn z => Tree.lookup2 compare z fun updateCtx (Ctx ctx) = fn z => let @@ -2621,7 +2620,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; = let val newBufId = D.length types - val (_, aggrTypeNames) = Tree.insert intCompare aggrTypeNames id newBufId + val (_, aggrTypeNames) = Tree.insert compare aggrTypeNames id newBufId val status = if isSome body then "complete" else "incomplete" @@ -3347,7 +3346,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; val () = D.push localVars ({ name = id, pos, t, onStack = not $ isScalar t }) - val (_, scope) = Tree.insert intCompare scope id varId + val (_, scope) = Tree.insert compare scope id varId in (varId, id, updateCtx (Ctx ctx) u#localScopes (fn scs => scope :: tl scs) %) @@ -3844,7 +3843,7 @@ functor Parser(structure Tree: TREE; structure P: PPC; = let val localVar = { name = id, pos, t, onStack = false } - val (_, scope) = Tree.insert intCompare scope id curVarId + val (_, scope) = Tree.insert compare scope id curVarId in D.push localVars localVar; createLocalVars scope (curVarId + 1) ts params -- cgit v1.2.3