From 973a0cacb7c2f68dfed29ff0dc355fdcebfef3ae Mon Sep 17 00:00:00 2001 From: krasimir Date: Thu, 18 Mar 2010 20:21:57 +0000 Subject: pattern @ should be propagated to PGF --- src/compiler/GF/Compile/Abstract/TC.hs | 2 ++ src/compiler/GF/Compile/GrammarToPGF.hs | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src/compiler/GF') diff --git a/src/compiler/GF/Compile/Abstract/TC.hs b/src/compiler/GF/Compile/Abstract/TC.hs index bca54b93c..211e8c743 100644 --- a/src/compiler/GF/Compile/Abstract/TC.hs +++ b/src/compiler/GF/Compile/Abstract/TC.hs @@ -236,11 +236,13 @@ checkBranch th tenv b@(ps,t) ty = errIn ("branch" +++ show b) $ p2t p (ps,i,g,k) = case p of PW -> (Meta i : ps, i+1,g,k) PV x -> (Vr x : ps, i, upd x k g,k+1) + PAs x p -> p2t p (ps,i,g,k) PString s -> (K s : ps, i, g, k) PInt n -> (EInt n : ps, i, g, k) PFloat n -> (EFloat n : ps, i, g, k) PP m c xs -> (mkApp (Q m c) xss : ps, j, g',k') where (xss,j,g',k') = foldr p2t ([],i,g,k) xs + PImplArg p -> p2t p (ps,i,g,k) PTilde t -> (t : ps, i, g, k) _ -> error $ render (text "undefined p2t case" <+> ppPatt Unqualified 0 p <+> text "in checkBranch") diff --git a/src/compiler/GF/Compile/GrammarToPGF.hs b/src/compiler/GF/Compile/GrammarToPGF.hs index 13bd1a27b..3db308f68 100644 --- a/src/compiler/GF/Compile/GrammarToPGF.hs +++ b/src/compiler/GF/Compile/GrammarToPGF.hs @@ -141,10 +141,14 @@ mkPatt scope p = A.PP _ c ps -> let (scope',ps') = mapAccumL mkPatt scope ps in (scope',C.PApp (i2i c) ps') A.PV x -> (x:scope,C.PVar (i2i x)) + A.PAs x p -> let (scope',p') = mkPatt scope p + in (x:scope',C.PAs (i2i x) p') A.PW -> ( scope,C.PWild) A.PInt i -> ( scope,C.PLit (C.LInt (fromIntegral i))) A.PFloat f -> ( scope,C.PLit (C.LFlt f)) A.PString s -> ( scope,C.PLit (C.LStr s)) + A.PImplArg p-> let (scope',p') = mkPatt scope p + in (scope',C.PImplArg p') A.PTilde t -> ( scope,C.PTilde (mkExp scope t)) -- cgit v1.2.3