1
0
forked from GitHub/gf-core

working on resource doc and exx, fixing bugs

This commit is contained in:
aarne
2005-02-18 13:53:29 +00:00
parent b7ced424be
commit e4f6d7e913
20 changed files with 621 additions and 170 deletions

View File

@@ -24,6 +24,7 @@ import Macros
import Lookup
import Refresh
import PatternMatch
import Lockfield (isLockLabel) ----
import AppPredefined
@@ -82,6 +83,12 @@ computeTerm gr = comp where
(S (T i cs) e,_) -> prawitz g i (flip App a') cs e
_ -> returnC $ appPredefined $ App f' a'
P t l | isLockLabel l -> return $ R []
---- a workaround 18/2/2005: take this away and find the reason
---- why earlier compilation destroys the lock field
P t l -> do
t' <- comp g t
case t' of

View File

@@ -12,7 +12,7 @@
-- Creating and using lock fields in reused resource grammars.
-----------------------------------------------------------------------------
module Lockfield (lockRecType, unlockRecord, lockLabel) where
module Lockfield (lockRecType, unlockRecord, lockLabel, isLockLabel) where
import Grammar
import Ident
@@ -40,3 +40,7 @@ unlockRecord c ft = do
lockLabel :: Ident -> Label
lockLabel c = LIdent $ "lock_" ++ prt c ----
isLockLabel :: Label -> Bool
isLockLabel l = case l of
LIdent c -> take 5 c == "lock_"
_ -> False

View File

@@ -60,8 +60,17 @@ lookupResType gr m c = do
-- used in reused concrete
CncCat _ _ _ -> return typeType
CncFun (Just (_,(cont,val))) _ _ -> return $ mkProd (cont, val, [])
CncFun (Just (cat,(cont,val))) _ _ -> do
val' <- lockRecType cat val
return $ mkProd (cont, val', [])
CncFun _ _ _ -> do
a <- abstractOfConcrete gr m
mu <- lookupModMod gr a
info <- lookupInfo mu c
case info of
AbsFun (Yes ty) _ -> return $ redirectTerm m ty
AbsCat _ _ -> return typeType
_ -> prtBad "cannot find type of reused function" c
AnyInd _ n -> lookupResType gr n c
ResParam _ -> return $ typePType
ResValue (Yes t) -> return $ qualifAnnotPar m t

View File

@@ -486,6 +486,12 @@ patt2term pt = case pt of
PInt i -> EInt i
PString s -> K s
redirectTerm :: Ident -> Term -> Term
redirectTerm n t = case t of
QC _ f -> QC n f
Q _ f -> Q n f
_ -> composSafeOp (redirectTerm n) t
-- to gather s-fields; assumes term in normal form, preserves label
allLinFields :: Term -> Err [[(Label,Term)]]
allLinFields trm = case unComputed trm of