|
@@ -3290,6 +3290,15 @@ let generate_static ctx c f =
|
|
|
add_native lib name
|
|
|
| (Meta.HlNative,[(EConst(String(lib)),_)] ,_ ) :: _ ->
|
|
|
add_native lib f.cf_name
|
|
|
+ | (Meta.HlNative,[(EConst(Float(ver)),_)] ,_ ) :: _ ->
|
|
|
+ let cur_ver = (try Common.raw_defined_value ctx.com "hl-ver" with Not_found -> "") in
|
|
|
+ if cur_ver < ver then
|
|
|
+ let gen_content() =
|
|
|
+ op ctx (OThrow (make_string ctx ("Requires compiling with -D hl-ver=" ^ ver ^ " or higher") null_pos));
|
|
|
+ in
|
|
|
+ ignore(make_fun ctx ~gen_content (s_type_path c.cl_path,f.cf_name) (alloc_fid ctx c f) (match f.cf_expr with Some { eexpr = TFunction f } -> f | _ -> abort "Missing function body" f.cf_pos) None None)
|
|
|
+ else
|
|
|
+ add_native "std" f.cf_name
|
|
|
| (Meta.HlNative,[] ,_ ) :: _ ->
|
|
|
add_native "std" f.cf_name
|
|
|
| (Meta.HlNative,_ ,p) :: _ ->
|