Explorar o código

export abstract structure

Simon Krajewski %!s(int64=12) %!d(string=hai) anos
pai
achega
7fdc42c2c2
Modificáronse 2 ficheiros con 18 adicións e 2 borrados
  1. 9 1
      interp.ml
  2. 9 1
      std/haxe/macro/Type.hx

+ 9 - 1
interp.ml

@@ -252,7 +252,8 @@ let constants =
 	"constraints";"opt";"type";"value";"ret";"expr";"field";"values";"get";"__string";"toString";
 	"$";"add";"remove";"has";"__t";"module";"isPrivate";"isPublic";"isExtern";"isInterface";"exclude";
 	"constructs";"names";"superClass";"interfaces";"fields";"statics";"constructor";"init";"t";
-	"gid";"uid";"atime";"mtime";"ctime";"dev";"ino";"nlink";"rdev";"size";"mode";"pos";"len"];
+	"gid";"uid";"atime";"mtime";"ctime";"dev";"ino";"nlink";"rdev";"size";"mode";"pos";"len";
+	"binops";"unops";"from";"to";"array";"op";"isPostfix";"impl"];
 	h
 
 let h_get = hash "__get" and h_set = hash "__set"
@@ -4092,6 +4093,13 @@ and encode_tenum e =
 
 and encode_tabstract a =
 	encode_mtype (TAbstractDecl a) [
+		"type", encode_type a.a_this;
+		"impl", (match a.a_impl with None -> VNull | Some c -> encode_clref c);
+		"binops", enc_array (List.map (fun (op,cf) -> enc_obj [ "op",encode_binop op; "field",encode_cfield cf]) a.a_ops);
+		"unops", enc_array (List.map (fun (op,postfix,cf) -> enc_obj [ "op",encode_unop op; "isPostfix",VBool (match postfix with Postfix -> true | Prefix -> false); "field",encode_cfield cf]) a.a_unops);
+		"from", enc_array (List.map (fun (t,cfo) -> enc_obj [ "t",encode_type t; "field",match cfo with None -> VNull | Some cf -> encode_cfield cf]) a.a_from);
+		"to", enc_array (List.map (fun (t,cfo) -> enc_obj [ "t",encode_type t; "field",match cfo with None -> VNull | Some cf -> encode_cfield cf]) a.a_to);
+		"array", enc_array (List.map encode_cfield a.a_array);
 	]
 
 and encode_efield f =

+ 9 - 1
std/haxe/macro/Type.hx

@@ -112,7 +112,15 @@ typedef DefType = {> BaseType,
 }
 
 
-typedef AbstractType = BaseType;
+typedef AbstractType = {>BaseType,
+	var type : Type;
+	var impl : Null<Ref<ClassType>>;
+	var binops : Array<{op:Expr.Binop, field:ClassField}>;
+	var unops : Array<{op:Expr.Unop, postFix:Bool, field:ClassField}>;
+	var from : Array<{t:Type, field:Null<ClassField>}>;
+	var to : Array<{t:Type, field:Null<ClassField>}>;
+	var array : Array<ClassField>;
+}
 
 typedef MetaAccess = {
 	function get() : Expr.Metadata;