Permalink
Browse files

[enhance] compiler: QmlAstCons.apply added optional ty argument

  • Loading branch information...
1 parent 28521d4 commit 75cbb3ee760d9a2177de2f57bbf7ef6224bda8f5 @BourgerieQuentin BourgerieQuentin committed Jan 24, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 libqmlcompil/qmlAstCons.ml
  2. +1 −1 libqmlcompil/qmlAstCons.mli
View
4 libqmlcompil/qmlAstCons.ml
@@ -660,7 +660,7 @@ struct
let tparams = List.map (fun param -> QmlAnnotMap.find_ty param.annot annotmap) params in
*)
let tparams = List.map (fun _ -> Q.TypeVar (TypeVar.next ())) params in
- let t_body = Q.TypeVar (TypeVar.next ()) in
+ let t_body = Option.default (Q.TypeVar (TypeVar.next ())) tyres in
let t_func = Q.TypeArrow (tparams, t_body) in
let annotmap, func = coerce annotmap func t_func in
let annotmap, label = typed_label ~pos annotmap t_body in
@@ -670,7 +670,7 @@ struct
(* FIXME: this may happen in overloads; check if in any other case. *)
aux ty_func
- let apply gamma annotmap func params = apply_gen gamma annotmap ~partial:false func params
+ let apply ?ty gamma annotmap func params = apply_gen ?ty gamma annotmap ~partial:false func params
let apply_partial gamma annotmap func params = apply_gen gamma annotmap ~partial:true func params
(**
View
2 libqmlcompil/qmlAstCons.mli
@@ -274,7 +274,7 @@ sig
val may_lambda : ?pos:FilePos.pos -> annotmap -> (QmlAst.ident * QmlAst.ty) list -> QmlAst.expr -> annotmap * QmlAst.expr
(** apply (m : tx, ty -> t) [(x : tx); (y : ty)] : t *)
- val apply : gamma -> annotmap -> QmlAst.expr -> QmlAst.expr list -> annotmap * QmlAst.expr
+ val apply : ?ty:QmlAst.ty -> gamma -> annotmap -> QmlAst.expr -> QmlAst.expr list -> annotmap * QmlAst.expr
(** [apply_partial] allows to apply not enough arguments or to apply one group of arguments
when the type has two arrows *)
val apply_partial : gamma -> annotmap -> QmlAst.expr -> QmlAst.expr list -> annotmap * QmlAst.expr

0 comments on commit 75cbb3e

Please sign in to comment.