瀏覽代碼

rename abstract flags

Simon Krajewski 7 年之前
父節點
當前提交
3bb04600f9

+ 1 - 1
.vscode/tasks.json

@@ -6,7 +6,7 @@
 		{
 			"label": "Compile",
 			"type": "shell",
-			"command": "make ADD_REVISION=1 -f Makefile.win -j haxe",
+			"command": "make ADD_REVISION=1 -f Makefile.win -s haxe",
 			"group": {
 				"kind": "build",
 				"isDefault": true

+ 1 - 1
src/codegen/dotnet.ml

@@ -703,7 +703,7 @@ let convert_delegate ctx p ilcls =
 		d_doc = None;
 		d_params = types;
 		d_meta = mk_metas [Meta.Delegate; Meta.Forward] p;
-		d_flags = [AIsType (underlying_type,null_pos)];
+		d_flags = [AbOver (underlying_type,null_pos)];
 		d_data = [fn_new;fn_from_hx;fn_asdel;mk_op Ast.OpAdd "Add";mk_op Ast.OpSub "Remove"];
 	}
 

+ 5 - 5
src/core/ast.ml

@@ -255,11 +255,11 @@ type class_flag =
 	| HImplements of placed_type_path
 
 type abstract_flag =
-	| APrivAbstract
-	| AFromType of type_hint
-	| AToType of type_hint
-	| AIsType of type_hint
-	| AExtern
+	| AbPrivate
+	| AbFrom of type_hint
+	| AbTo of type_hint
+	| AbOver of type_hint
+	| AbExtern
 
 type enum_constructor = {
 	ec_name : placed_name;

+ 1 - 1
src/macro/eval/evalArray.ml

@@ -200,6 +200,6 @@ let resize a l =
 		set a (l - 1) vnull;
 		()
 	end else if a.alength > l then begin
-		splice a l (a.alength - l) a.alength;
+		ignore(splice a l (a.alength - l) a.alength);
 		()
 	end else ()

+ 3 - 3
src/macro/macroApi.ml

@@ -1466,9 +1466,9 @@ let decode_type_def v =
 	| 3, [t] ->
 		ETypedef (mk (if isExtern then [EExtern] else []) (decode_ctype t))
 	| 4, [tthis;tfrom;tto] ->
-		let flags = match opt decode_array tfrom with None -> [] | Some ta -> List.map (fun t -> AFromType (decode_ctype t)) ta in
-		let flags = match opt decode_array tto with None -> flags | Some ta -> (List.map (fun t -> AToType (decode_ctype t)) ta) @ flags in
-		let flags = match opt decode_ctype tthis with None -> flags | Some t -> (AIsType t) :: flags in
+		let flags = match opt decode_array tfrom with None -> [] | Some ta -> List.map (fun t -> AbFrom (decode_ctype t)) ta in
+		let flags = match opt decode_array tto with None -> flags | Some ta -> (List.map (fun t -> AbTo (decode_ctype t)) ta) @ flags in
+		let flags = match opt decode_ctype tthis with None -> flags | Some t -> (AbOver t) :: flags in
 		EAbstract(mk flags fields)
 	| _ ->
 		raise Invalid_expr

+ 3 - 3
src/syntax/grammar.mly

@@ -144,7 +144,7 @@ and parse_type_decl s =
 			}, punion p1 (pos t))
 		| [< '(Kwd Abstract,p1); name = type_name; tl = parse_constraint_params; st = parse_abstract_subtype; sl = plist parse_abstract_relations; '(BrOpen,_); fl, p2 = parse_class_fields false p1 >] ->
 			let flags = List.map decl_flag_to_abstract_flag c in
-			let flags = (match st with None -> flags | Some t -> AIsType t :: flags) in
+			let flags = (match st with None -> flags | Some t -> AbOver t :: flags) in
 			(EAbstract {
 				d_name = name;
 				d_doc = doc;
@@ -230,8 +230,8 @@ and parse_using s p1 =
 
 and parse_abstract_relations s =
 	match s with parser
-	| [< '(Const (Ident "to"),_); t = parse_complex_type >] -> AToType t
-	| [< '(Const (Ident "from"),_); t = parse_complex_type >] -> AFromType t
+	| [< '(Const (Ident "to"),_); t = parse_complex_type >] -> AbTo t
+	| [< '(Const (Ident "from"),_); t = parse_complex_type >] -> AbFrom t
 
 and parse_abstract_subtype s =
 	match s with parser

+ 2 - 2
src/syntax/parser.ml

@@ -61,8 +61,8 @@ let decl_flag_to_enum_flag = function
 	| DExtern -> EExtern
 
 let decl_flag_to_abstract_flag = function
-	| DPrivate -> APrivAbstract
-	| DExtern -> AExtern
+	| DPrivate -> AbPrivate
+	| DExtern -> AbExtern
 
 module TokenCache = struct
 	let cache = ref (DynArray.create ())

+ 0 - 5
src/typing/calls.ml

@@ -392,11 +392,6 @@ let unify_field_call ctx fa el args ret p inline =
 			cf2.cf_meta <- (Meta.NoCompletion,[],p) :: (Meta.NoUsing,[],p) :: (Meta.GenericInstance,[],p) :: metadata;
 			cf2
 		in
-		let path = match c.cl_kind with
-			| KAbstractImpl(a) ->
-				a.a_path
-			| _ -> c.cl_path
-		in
 		let e = match c.cl_kind with
 			| KAbstractImpl(a) ->
 				type_type ctx a.a_path p

+ 8 - 8
src/typing/typeload.ml

@@ -167,7 +167,7 @@ let module_pass_1 ctx m tdecls loadp =
 		 | EAbstract d ->
 		 	let name = fst d.d_name in
 			if String.length name > 0 && name.[0] = '$' then error "Type names starting with a dollar are not allowed" p;
-			let priv = List.mem APrivAbstract d.d_flags in
+			let priv = List.mem AbPrivate d.d_flags in
 			let path = make_path name priv in
 			let a = {
 				a_path = path;
@@ -201,7 +201,7 @@ let module_pass_1 ctx m tdecls loadp =
 				in
 				let rec loop = function
 					| [] -> a_t
-					| AIsType t :: _ -> t
+					| AbOver t :: _ -> t
 					| _ :: l -> loop l
 				in
 				let this_t = loop d.d_flags in
@@ -3473,9 +3473,9 @@ let init_module_type ctx context_init do_init (decl,p) =
 			t
 		in
 		List.iter (function
-			| AFromType t -> a.a_from <- (load_type t true) :: a.a_from
-			| AToType t -> a.a_to <- (load_type t false) :: a.a_to
-			| AIsType t ->
+			| AbFrom t -> a.a_from <- (load_type t true) :: a.a_from
+			| AbTo t -> a.a_to <- (load_type t false) :: a.a_to
+			| AbOver t ->
 				if a.a_impl = None then error "Abstracts with underlying type must have an implementation" a.a_pos;
 				if Meta.has Meta.CoreType a.a_meta then error "@:coreType abstracts cannot have an underlying type" p;
 				let at = load_complex_type ctx true p t in
@@ -3487,9 +3487,9 @@ let init_module_type ctx context_init do_init (decl,p) =
 				);
 				a.a_this <- at;
 				is_type := true;
-			| AExtern ->
+			| AbExtern ->
 				(match a.a_impl with Some c -> c.cl_extern <- true | None -> (* Hmmmm.... *) ())
-			| APrivAbstract -> ()
+			| AbPrivate -> ()
 		) d.d_flags;
 		if not !is_type then begin
 			if Meta.has Meta.CoreType a.a_meta then
@@ -3728,7 +3728,7 @@ let parse_module ctx m p =
 			| EClass d -> build HPrivate d
 			| EEnum d -> build EPrivate d
 			| ETypedef d -> build EPrivate d
-			| EAbstract d -> build APrivAbstract d
+			| EAbstract d -> build AbPrivate d
 			| EImport _ | EUsing _ -> acc
 		) [(EImport (List.map (fun s -> s,null_pos) (!remap @ [snd m]),INormal),null_pos)] decls)
 	else