|
@@ -131,14 +131,14 @@ let make_module ctx mpath file tdecls loadp =
|
|
| FFun fu when f.cff_name = "new" && not stat ->
|
|
| FFun fu when f.cff_name = "new" && not stat ->
|
|
let init p = (EVars ["this",Some this_t,None],p) in
|
|
let init p = (EVars ["this",Some this_t,None],p) in
|
|
let ret p = (EReturn (Some (EConst (Ident "this"),p)),p) in
|
|
let ret p = (EReturn (Some (EConst (Ident "this"),p)),p) in
|
|
- if Meta.has Meta.Generic a.a_meta then begin
|
|
|
|
- if List.mem AInline f.cff_access then error "Generic constructors cannot be inline" f.cff_pos;
|
|
|
|
- if fu.f_expr <> None then error "Generic constructors cannot have a body" f.cff_pos;
|
|
|
|
|
|
+ if Meta.has Meta.MultiType a.a_meta then begin
|
|
|
|
+ if List.mem AInline f.cff_access then error "MultiType constructors cannot be inline" f.cff_pos;
|
|
|
|
+ if fu.f_expr <> None then error "MultiType constructors cannot have a body" f.cff_pos;
|
|
end;
|
|
end;
|
|
let fu = {
|
|
let fu = {
|
|
fu with
|
|
fu with
|
|
f_expr = (match fu.f_expr with
|
|
f_expr = (match fu.f_expr with
|
|
- | None -> if Meta.has Meta.Generic a.a_meta then Some (EConst (Ident "null"),p) else None
|
|
|
|
|
|
+ | None -> if Meta.has Meta.MultiType a.a_meta then Some (EConst (Ident "null"),p) else None
|
|
| Some (EBlock [EBinop (OpAssign,(EConst (Ident "this"),_),e),_],_ | EBinop (OpAssign,(EConst (Ident "this"),_),e),_) ->
|
|
| Some (EBlock [EBinop (OpAssign,(EConst (Ident "this"),_),e),_],_ | EBinop (OpAssign,(EConst (Ident "this"),_),e),_) ->
|
|
Some (EReturn (Some e), pos e)
|
|
Some (EReturn (Some e), pos e)
|
|
| Some (EBlock el,p) -> Some (EBlock (init p :: el @ [ret p]),p)
|
|
| Some (EBlock el,p) -> Some (EBlock (init p :: el @ [ret p]),p)
|
|
@@ -1371,7 +1371,7 @@ let init_class ctx c p context_init herits fields =
|
|
unify ctx t (tfun [ta] m) f.cff_pos;
|
|
unify ctx t (tfun [ta] m) f.cff_pos;
|
|
if not (Meta.has Meta.Impl cf.cf_meta) then cf.cf_meta <- (Meta.Impl,[],cf.cf_pos) :: cf.cf_meta;
|
|
if not (Meta.has Meta.Impl cf.cf_meta) then cf.cf_meta <- (Meta.Impl,[],cf.cf_pos) :: cf.cf_meta;
|
|
a.a_to <- (follow m, Some cf) :: a.a_to
|
|
a.a_to <- (follow m, Some cf) :: a.a_to
|
|
- end else if f.cff_name = "_new" && Meta.has Meta.Generic a.a_meta then
|
|
|
|
|
|
+ end else if f.cff_name = "_new" && Meta.has Meta.MultiType a.a_meta then
|
|
do_bind := false
|
|
do_bind := false
|
|
else (try match Meta.get Meta.Op cf.cf_meta with
|
|
else (try match Meta.get Meta.Op cf.cf_meta with
|
|
| _,[EBinop(op,_,_),_],_ ->
|
|
| _,[EBinop(op,_,_),_],_ ->
|