Skip to content

Commit

Permalink
added isAbstract to structs in haxe.macro.Type (#9720)
Browse files Browse the repository at this point in the history
  • Loading branch information
RealyUniqueName committed Dec 16, 2020
1 parent b0c8b5b commit da80ab2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/macro/macroApi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ and encode_cfield f =
"overloads", encode_ref f.cf_overloads (encode_and_map_array encode_cfield) (fun() -> "overloads");
"isExtern", vbool (has_class_field_flag f CfExtern);
"isFinal", vbool (has_class_field_flag f CfFinal);
"isAbstract", vbool (has_class_field_flag f CfAbstract);
]

and encode_field_kind k =
Expand Down Expand Up @@ -1007,6 +1008,7 @@ and encode_tclass c =
"exclude", vfun0 (fun() -> add_class_flag c CExtern; c.cl_init <- None; vnull);
"isInterface", vbool (has_class_flag c CInterface);
"isFinal", vbool (has_class_flag c CFinal);
"isAbstract", vbool (has_class_flag c CAbstract);
"superClass", (match c.cl_super with
| None -> vnull
| Some (c,pl) -> encode_obj ["t",encode_clref c;"params",encode_tparams pl]
Expand Down Expand Up @@ -1316,6 +1318,7 @@ let decode_cfield v =
let public = decode_bool (field v "isPublic") in
let extern = decode_bool (field v "isExtern") in
let final = decode_bool (field v "isFinal") in
let abstract = decode_bool (field v "isAbstract") in
let cf = {
cf_name = decode_string (field v "name");
cf_type = decode_type (field v "type");
Expand All @@ -1333,6 +1336,7 @@ let decode_cfield v =
if public then add_class_field_flag cf CfPublic;
if extern then add_class_field_flag cf CfExtern;
if final then add_class_field_flag cf CfFinal;
if abstract then add_class_field_flag cf CfAbstract;
cf

let decode_efield v =
Expand Down
10 changes: 10 additions & 0 deletions std/haxe/macro/Type.hx
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ typedef ClassField = {
**/
var isFinal:Bool;

/**
Whether or not the class field is abstract.
**/
var isAbstract:Bool;

/**
The type parameters of the class field.
**/
Expand Down Expand Up @@ -417,6 +422,11 @@ typedef ClassType = BaseType & {
**/
var isFinal:Bool;

/**
If true the class is abstract and cannot be instantiated directly.
**/
var isAbstract:Bool;

/**
The parent class and its type parameters, if available.
**/
Expand Down

0 comments on commit da80ab2

Please sign in to comment.