Skip to content

Commit

Permalink
some more verifyExpr cases
Browse files Browse the repository at this point in the history
--HG--
branch : com.mozilla.es4.smlnj
extra : convert_revision : 678863e45c9d52d076762b8bf6081e6484a62fd9
  • Loading branch information
[email protected] committed May 3, 2007
1 parent 3e35cd6 commit 4c0c2b4
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions verify.sml
Original file line number Diff line number Diff line change
Expand Up @@ -605,17 +605,32 @@ and verifyExpr (env:ENV)
return (Ast.LiteralExpr le, resultType)
end

(* TODO: ---------- left off here ---------- *)

| Ast.CallExpr {func, actuals} =>
let
val (func', t) = verifySub func
val (actuals', ts) = verifySubList actuals
val resultType = case t of
Ast.FunctionType { result, ... } => result
| _ => anyType
in
return (Ast.CallExpr { func = func',
actuals = actuals' }, dummyType)
whenStrict (fn () =>
case t of
(* FIXME: deal with type parameters *)
Ast.FunctionType { typeParams, params, result, thisType, hasRest, minArgs } =>
if (List.length actuals) < minArgs then
verifyError ["too few actuals"]
else if (not hasRest) andalso
((List.length actuals) > (List.length params)) then
verifyError ["too many actuals"]
else
List.app (fn (formal, actual) => checkCompatible formal actual)
(ListPair.zip (params, ts))
| Ast.SpecialType Ast.Any => ()
| _ => verifyError ["ill-typed call"]);
return (Ast.CallExpr { func = func', actuals = actuals' }, resultType)
end

(* TODO: what is this? *)
| Ast.ApplyTypeExpr { expr, actuals } =>
let
val (expr', t) = verifySub expr
Expand All @@ -625,6 +640,8 @@ and verifyExpr (env:ENV)
actuals = actuals' }, dummyType)
end

(* TODO: ---------- left off here ---------- *)

| Ast.LetExpr { defs, body, head } =>
let
val defs' = defs (* TODO *)
Expand Down

0 comments on commit 4c0c2b4

Please sign in to comment.