Skip to content

Commit cb8b7a7

Browse files
committed
rename to _hx_new
1 parent 79e018d commit cb8b7a7

11 files changed

+16
-16
lines changed

src/core/abstract.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ let rec follow_with_forward_ctor ?(build=false) t = match follow t with
155155
| TAbstract(a,tl) as t ->
156156
if build then build_abstract a;
157157
if Meta.has Meta.ForwardNew a.a_meta && not (match a.a_impl with
158-
| Some c -> PMap.mem "_new" c.cl_statics
158+
| Some c -> PMap.mem "_hx_new" c.cl_statics
159159
| None -> false
160160
) then
161161
follow_with_forward_ctor (get_underlying_type ~return_first:true a tl)

src/core/display/completionItem.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ module CompletionModuleType = struct
186186
| None -> No
187187
| Some c ->
188188
try
189-
let cf = PMap.find "_new" c.cl_statics in
189+
let cf = PMap.find "_hx_new" c.cl_statics in
190190
if (has_class_flag c CExtern) || (has_class_field_flag cf CfPublic) then Yes else YesButPrivate
191191
with Not_found ->
192192
No

src/core/inheritDoc.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ and get_target_doc ctx e_target =
181181
| TAbstract ({ a_impl = Some c }, _) ->
182182
let c_opt, cf =
183183
let field_name =
184-
if field_name = "new" then "_new"
184+
if field_name = "new" then "_hx_new"
185185
else field_name
186186
in
187187
get_class_field c field_name

src/optimization/inline.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ let inline_default_config cf t =
232232
let inline_config cls_opt cf call_args return_type =
233233
match cls_opt with
234234
| Some ({cl_kind = KAbstractImpl _}) when has_class_field_flag cf CfImpl ->
235-
let t = if cf.cf_name = "_new" then
235+
let t = if cf.cf_name = "_hx_new" then
236236
return_type
237237
else if call_args = [] then
238238
raise_typing_error "Invalid abstract implementation function" cf.cf_pos
@@ -580,7 +580,7 @@ class inline_state ctx ethis params cf f p = object(self)
580580
(match follow ethis.etype with
581581
| TAnon a -> (match !(a.a_status) with
582582
| ClassStatics {cl_kind = KAbstractImpl a } when has_class_field_flag cf CfImpl ->
583-
if cf.cf_name <> "_new" then begin
583+
if cf.cf_name <> "_hx_new" then begin
584584
(* the first argument must unify with a_this for abstract implementation functions *)
585585
let tb = (TFun(("",false,map_type a.a_this) :: (List.tl tl),tret)) in
586586
unify_raise mt tb p

src/typing/callUnification.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ let unify_field_call ctx fa el_typed el p inline =
232232
cfl,Some c,false,TClass.get_map_function c tl,(fun t -> t)
233233
| FHAbstract(a,tl,c) ->
234234
let map = apply_params a.a_params tl in
235-
let tmap = if fa.fa_field.cf_name = "_new" (* TODO: BAD BAD BAD BAD *) then (fun t -> t) else (fun t -> map a.a_this) in
235+
let tmap = if fa.fa_field.cf_name = "_hx_new" (* TODO: BAD BAD BAD BAD *) then (fun t -> t) else (fun t -> map a.a_this) in
236236
expand_overloads fa.fa_field,Some c,true,map,tmap
237237
in
238238
let is_forced_inline = is_forced_inline co fa.fa_field in

src/typing/calls.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ let make_call ctx e params t ?(force_inline=false) p =
5454
(match cl, ctx.c.curclass.cl_kind, params with
5555
| Some c, KAbstractImpl _, { eexpr = TLocal { v_meta = v_meta } } :: _ when c == ctx.c.curclass ->
5656
if
57-
f.cf_name <> "_new"
57+
f.cf_name <> "_hx_new"
5858
&& has_meta Meta.This v_meta
5959
&& has_class_field_flag f CfModifiesThis
6060
then

src/typing/fieldAccess.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ let get_constructor_access c tl p =
163163
| _ -> c, tl
164164
in
165165
let cf, fh = match c.cl_kind with
166-
| KAbstractImpl a -> PMap.find "_new" c.cl_statics, FHAbstract(a,tl,c)
166+
| KAbstractImpl a -> PMap.find "_hx_new" c.cl_statics, FHAbstract(a,tl,c)
167167
| _ -> Type.get_constructor c, FHInstance(c,tl)
168168
in
169169
create e_static cf fh false p

src/typing/typeloadFields.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ let transform_abstract_field com this_t a_t a f =
271271
);
272272
f_type = Some a_t;
273273
} in
274-
{ f with cff_name = "_new",pos f.cff_name; cff_kind = FFun fu; cff_meta = meta }
274+
{ f with cff_name = "_hx_new",pos f.cff_name; cff_kind = FFun fu; cff_meta = meta }
275275
| FFun fu when not stat ->
276276
if Meta.has Meta.From f.cff_meta then raise_typing_error "@:from cast functions must be static" f.cff_pos;
277277
{ f with cff_kind = FFun fu }
@@ -631,7 +631,7 @@ let check_field_display ctx fctx c cf =
631631
let scope, cf = match c.cl_kind with
632632
| KAbstractImpl _ ->
633633
if has_class_field_flag cf CfImpl then
634-
(if cf.cf_name = "_new" then
634+
(if cf.cf_name = "_hx_new" then
635635
CFSConstructor, {cf with cf_name = "new"}
636636
else
637637
CFSMember, cf)
@@ -979,7 +979,7 @@ let check_abstract (ctx,cctx,fctx) a c cf fd t ret p =
979979
let r = make_lazy ctx.g t (fun () ->
980980
let args = if is_multitype_cast then begin
981981
let ctor = try
982-
PMap.find "_new" c.cl_statics
982+
PMap.find "_hx_new" c.cl_statics
983983
with Not_found ->
984984
raise_typing_error "Constructor of multi-type abstract must be defined before the individual @:to-functions are" cf.cf_pos
985985
in
@@ -1087,7 +1087,7 @@ let check_abstract (ctx,cctx,fctx) a c cf fd t ret p =
10871087
| _ -> ();
10881088
in
10891089
List.iter check_meta cf.cf_meta;
1090-
if cf.cf_name = "_new" && Meta.has Meta.MultiType a.a_meta then fctx.do_bind <- false;
1090+
if cf.cf_name = "_hx_new" && Meta.has Meta.MultiType a.a_meta then fctx.do_bind <- false;
10911091
if fd.f_expr = None then begin
10921092
if fctx.is_inline then missing_expression ctx.com fctx "Inline functions must have an expression" cf.cf_pos;
10931093
if fd.f_type = None then raise_typing_error ("Functions without expressions must have an explicit return type") cf.cf_pos;
@@ -1160,7 +1160,7 @@ let setup_args_ret ctx cctx fctx name fd p =
11601160
maybe_use_property_type fd.f_type (fun () -> match Lazy.force mk with MKGetter | MKSetter -> true | _ -> false) def
11611161
end in
11621162
let abstract_this = match cctx.abstract with
1163-
| Some a when fctx.is_abstract_member && name <> "_new" (* TODO: this sucks *) && not fctx.is_macro ->
1163+
| Some a when fctx.is_abstract_member && name <> "_hx_new" (* TODO: this sucks *) && not fctx.is_macro ->
11641164
Some a.a_this
11651165
| _ ->
11661166
None

src/typing/typer.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,7 @@ and type_array_comprehension ctx e with_type p =
14791479
]) v.v_type p
14801480

14811481
and type_return ?(implicit=false) ctx e with_type p =
1482-
let is_abstract_ctor = ctx.e.curfun = FunMemberAbstract && ctx.f.curfield.cf_name = "_new" in
1482+
let is_abstract_ctor = ctx.e.curfun = FunMemberAbstract && ctx.f.curfield.cf_name = "_hx_new" in
14831483
match e with
14841484
| None when is_abstract_ctor ->
14851485
let e_cast = mk (TCast(get_this ctx p,None)) ctx.e.ret p in

src/typing/typerBase.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ let assign_to_this_is_allowed ctx =
188188
| KAbstractImpl _ ->
189189
(match ctx.f.curfield.cf_kind with
190190
| Method MethInline -> true
191-
| Method _ when ctx.f.curfield.cf_name = "_new" -> true
191+
| Method _ when ctx.f.curfield.cf_name = "_hx_new" -> true
192192
| _ -> false
193193
)
194194
| _ -> false

src/typing/typerDisplay.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ let handle_display ctx e_ast dk mode with_type =
619619
| TClassDecl c -> has_constructor c
620620
| TAbstractDecl a -> (match Abstract.follow_with_forward_ctor ~build:true (TAbstract(a,extract_param_types a.a_params)) with
621621
| TInst(c,_) -> has_constructor c
622-
| TAbstract({a_impl = Some c},_) -> PMap.mem "_new" c.cl_statics
622+
| TAbstract({a_impl = Some c},_) -> PMap.mem "_hx_new" c.cl_statics
623623
| _ -> false)
624624
| _ -> false
625625
end

0 commit comments

Comments
 (0)