summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/Compute
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2011-02-25 17:01:10 +0000
committeraarne <aarne@chalmers.se>2011-02-25 17:01:10 +0000
commit445a3aafebe02c415c76392399bdf77a00e680f5 (patch)
treedc8a3350f1dc2ebd90eb35d632273c629f2b97c3 /src/compiler/GF/Compile/Compute
parent77b02544fb91a658346f25019cbf2a21b79f9081 (diff)
Predef.error surfaces as error message in compilation and cc command
Diffstat (limited to 'src/compiler/GF/Compile/Compute')
-rw-r--r--src/compiler/GF/Compile/Compute/Concrete.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/GF/Compile/Compute/Concrete.hs b/src/compiler/GF/Compile/Compute/Concrete.hs
index 830a86c25..e38f646e4 100644
--- a/src/compiler/GF/Compile/Compute/Concrete.hs
+++ b/src/compiler/GF/Compile/Compute/Concrete.hs
@@ -12,7 +12,7 @@
-- Computation of source terms. Used in compilation and in @cc@ command.
-----------------------------------------------------------------------------
-module GF.Compile.Compute.Concrete (computeConcrete, computeTerm,computeConcreteRec) where
+module GF.Compile.Compute.Concrete (computeConcrete, computeTerm,computeConcreteRec,checkPredefError) where
import GF.Data.Operations
import GF.Grammar.Grammar
@@ -20,6 +20,7 @@ import GF.Infra.Ident
import GF.Infra.Option
import GF.Infra.Modules
import GF.Data.Str
+import GF.Grammar.ShowTerm
import GF.Grammar.Printer
import GF.Grammar.Predef
import GF.Grammar.Macros
@@ -466,3 +467,10 @@ getArgType t = case t of
V ty _ -> return ty
T (TComp ty) _ -> return ty
_ -> Bad (render (text "cannot get argument type of table" $$ nest 2 (ppTerm Unqualified 0 t)))
+
+
+checkPredefError :: SourceGrammar -> Term -> Err Term
+checkPredefError sgr t = case t of
+ App (Q (mod,f)) s | mod == cPredef && f == cError -> Bad $ showTerm sgr TermPrintOne Unqualified s
+ _ -> composOp (checkPredefError sgr) t
+