aboutsummaryrefslogtreecommitdiff
path: root/Sil/Compile.icl
diff options
context:
space:
mode:
Diffstat (limited to 'Sil/Compile.icl')
-rw-r--r--Sil/Compile.icl5
1 files changed, 4 insertions, 1 deletions
diff --git a/Sil/Compile.icl b/Sil/Compile.icl
index dc846d2..7ef48e4 100644
--- a/Sil/Compile.icl
+++ b/Sil/Compile.icl
@@ -30,6 +30,7 @@ import Sil.Util.Printer
instance toString CompileError
where
toString (UndefinedName n) = "Undefined name '" <+ n <+ "'."
+ toString (UndefinedField f) = "Undefined field '" <+ f <+ "'."
toString VariableLabel = "Variable stored at label."
toString FunctionOnStack = "Function stored on the stack."
toString (TypeError err e) = "Type error in '" <+ e <+ "': " <+ err
@@ -376,6 +377,7 @@ where
comment "Return" *>
gen e *>
gets returnType >>= \rettype ->
+ comment ("Checking type " <+ rettype <+ " on " <+ e <+ "...") *>
checkType rettype e *>
gets stackoffsets >>= \so ->
updateReturnFrame (typeSize rettype) so *>
@@ -495,13 +497,14 @@ where
shrinkStack {zero & asize=i}
gen e=:(Field f e`)
| isTuple =
- getType e` >>= \(TTuple arity tes) ->
+ getType e` >>= \t=:(TTuple arity tes) ->
gen e` *>
tell [ 'ABC'.ReplArgs arity arity
, 'ABC'.Pop_a (tupleEl - 1)
, 'ABC'.Update_a 0 (arity - tupleEl)
, 'ABC'.Pop_a (arity - tupleEl)
] *>
+ if (0 >= tupleEl || tupleEl > arity) (error $ TypeError (IllegalField f t) e) nop *>
case typeSize $ tes!!(tupleEl - 1) of
{bsize=0} -> nop
{btypes} -> mapM (flip toBStack 1) btypes *> nop