Преглед на файлове

[typer] allow `Rest` arguments on extern methods if the class isn't extern

Simon Krajewski преди 6 години
родител
ревизия
387fc96878
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/typing/typeloadFields.ml

+ 1 - 1
src/typing/typeloadFields.ml

@@ -1007,7 +1007,7 @@ let create_method (ctx,cctx,fctx) c f fd p =
 			let t, ct = TypeloadFunction.type_function_arg ctx (type_opt (ctx,cctx) p t) ct opt p in
 			let t, ct = TypeloadFunction.type_function_arg ctx (type_opt (ctx,cctx) p t) ct opt p in
 			delay ctx PTypeField (fun() -> match follow t with
 			delay ctx PTypeField (fun() -> match follow t with
 				| TAbstract({a_path = ["haxe";"extern"],"Rest"},_) ->
 				| TAbstract({a_path = ["haxe";"extern"],"Rest"},_) ->
-					if not c.cl_extern then error "Rest argument are only supported for extern methods" p;
+					if not fctx.is_extern && not c.cl_extern then error "Rest argument are only supported for extern methods" p;
 					if opt then error "Rest argument cannot be optional" p;
 					if opt then error "Rest argument cannot be optional" p;
 					begin match ct with None -> () | Some (_,p) -> error "Rest argument cannot have default value" p end;
 					begin match ct with None -> () | Some (_,p) -> error "Rest argument cannot have default value" p end;
 					if args <> [] then error "Rest should only be used for the last function argument" p;
 					if args <> [] then error "Rest should only be used for the last function argument" p;