mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-09-19 00:36:02 -06:00
categories in PredefCnc should also have lock fields
This commit is contained in:
@@ -25,9 +25,9 @@ import GF.Data.Operations(ErrorMonad,Err(..))
|
|||||||
lock :: Ident -> Term -> Term
|
lock :: Ident -> Term -> Term
|
||||||
lock c t@(RecType rs) =
|
lock c t@(RecType rs) =
|
||||||
let lbl = lockLabel c
|
let lbl = lockLabel c
|
||||||
in if elem lbl [l | (l,_,_)<-rs] || elem c [cString,cInt]
|
in if null [l | (l,_,_)<-rs, l == lbl]
|
||||||
then t --- don't add an extra copy of lock field, nor predef cats
|
then RecType (rs ++ [(lbl, [], RecType [])])
|
||||||
else RecType (rs ++ [(lbl, [], RecType [])])
|
else t --- don't add an extra copy of lock field, nor predef cats
|
||||||
lock c t@(R rs) =
|
lock c t@(R rs) =
|
||||||
let lbl = lockLabel c
|
let lbl = lockLabel c
|
||||||
in if elem lbl (map fst rs)
|
in if elem lbl (map fst rs)
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ lookupAbsDef gr q@(m,c) = errIn (render ("looking up absdef of" <+> c)) $ do
|
|||||||
_ -> return Nothing
|
_ -> return Nothing
|
||||||
|
|
||||||
lookupLincat :: ErrorMonad m => Grammar -> ModuleName -> Ident -> m Type
|
lookupLincat :: ErrorMonad m => Grammar -> ModuleName -> Ident -> m Type
|
||||||
lookupLincat gr m c | isPredefCat c = return defLinType --- ad hoc; not needed?
|
lookupLincat gr m c | isPredefCat c = return (lock c defLinType) --- ad hoc; not needed?
|
||||||
lookupLincat gr m c = do
|
lookupLincat gr m c = do
|
||||||
info <- lookupQIdentInfo gr (m,c)
|
info <- lookupQIdentInfo gr (m,c)
|
||||||
case info of
|
case info of
|
||||||
@@ -247,7 +247,7 @@ lookupLincat gr m c = do
|
|||||||
lookupAbsType :: ErrorMonad m => Grammar -> QIdent -> m (Term,Type)
|
lookupAbsType :: ErrorMonad m => Grammar -> QIdent -> m (Term,Type)
|
||||||
lookupAbsType gr q@(m,c)
|
lookupAbsType gr q@(m,c)
|
||||||
| m == cPredefAbs =
|
| m == cPredefAbs =
|
||||||
if elem c [cInt,cFloat,cString]
|
if isPredefCat c
|
||||||
then return (QC q,typeType)
|
then return (QC q,typeType)
|
||||||
else no_type
|
else no_type
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
|
|||||||
Reference in New Issue
Block a user