summaryrefslogtreecommitdiff
path: root/src/GF/Grammar/Lockfield.hs
diff options
context:
space:
mode:
authoraarne <unknown>2005-02-15 10:06:30 +0000
committeraarne <unknown>2005-02-15 10:06:30 +0000
commitf8df4df53065fdafc76306e20e5e12b335254042 (patch)
treed1cb99ac2114eb7cc289a71e6be1fb8bbb72f82f /src/GF/Grammar/Lockfield.hs
parent1befa19e222c0c44142696e4aaf7d942ae348653 (diff)
record type extension freshness check
Diffstat (limited to 'src/GF/Grammar/Lockfield.hs')
-rw-r--r--src/GF/Grammar/Lockfield.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/GF/Grammar/Lockfield.hs b/src/GF/Grammar/Lockfield.hs
index 3cdfdaa54..f283dde93 100644
--- a/src/GF/Grammar/Lockfield.hs
+++ b/src/GF/Grammar/Lockfield.hs
@@ -24,6 +24,11 @@ import Operations
-- AR 8/2/2005 detached from compile/MkResource
lockRecType :: Ident -> Type -> Err Type
+lockRecType c t@(RecType rs) =
+ let lab = lockLabel c in
+ return $ if elem lab (map fst rs)
+ then t --- don't add an extra copy of the lock field
+ else RecType (rs ++ [(lockLabel c, RecType [])])
lockRecType c t = plusRecType t $ RecType [(lockLabel c, RecType [])]
unlockRecord :: Ident -> Term -> Err Term