浏览代码

[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
 			delay ctx PTypeField (fun() -> match follow t with
 				| 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;
 					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;