Sfoglia il codice sorgente

[typer] no one will notice

Simon Krajewski 5 anni fa
parent
commit
71b79b6f50

+ 1 - 1
src/codegen/genxml.ml

@@ -132,7 +132,7 @@ and gen_type_decl n t pl =
 and gen_field att f =
 	let add_get_set acc name att =
 		match acc with
-		| AccNormal | AccResolve | AccRequire _ | AccCtor -> att
+		| AccNormal | AccRequire _ | AccCtor -> att
 		| AccNo | AccNever -> (name, "null") :: att
 		| AccCall -> (name,"accessor") :: att
 		| AccInline -> (name,"inline") :: att

+ 0 - 1
src/core/json/genjson.ml

@@ -504,7 +504,6 @@ and generate_class_field' ctx cfs cf =
 				| AccNo -> "AccNo",None
 				| AccNever -> "AccNever",None
 				| AccCtor -> "AccCtor",None
-				| AccResolve -> "AccResolve",None
 				| AccCall -> "AccCall",None
 				| AccInline -> "AccInline",None
 				| AccRequire(s,so) -> "AccRequire",Some (jobject ["require",jstring s;"message",jopt jstring so])

+ 0 - 1
src/core/tPrinting.ml

@@ -117,7 +117,6 @@ let s_access is_read = function
 	| AccNormal -> "default"
 	| AccNo -> "null"
 	| AccNever -> "never"
-	| AccResolve -> "resolve"
 	| AccCall -> if is_read then "get" else "set"
 	| AccInline	-> "inline"
 	| AccRequire (n,_) -> "require " ^ n

+ 0 - 1
src/core/tType.ml

@@ -15,7 +15,6 @@ and var_access =
 	| AccNo             (* can't be accessed outside of the class itself and its subclasses *)
 	| AccNever          (* can't be accessed, even in subclasses *)
 	| AccCtor           (* can only be accessed from the constructor *)
-	| AccResolve        (* call resolve("field") when accessed *)
 	| AccCall           (* perform a method call when accessed *)
 	| AccInline         (* similar to Normal but inline when accessed *)
 	| AccRequire of string * string option (* set when @:require(cond) fails *)

+ 1 - 1
src/core/tUnification.ml

@@ -375,7 +375,7 @@ let unify_access a1 a2 =
 
 let direct_access = function
 	| AccNo | AccNever | AccNormal | AccInline | AccRequire _ | AccCtor -> true
-	| AccResolve | AccCall -> false
+	| AccCall -> false
 
 let unify_kind k1 k2 =
 	k1 = k2 || match k1, k2 with

+ 0 - 2
src/generators/gencpp.ml

@@ -5476,7 +5476,6 @@ let access_str a = match a with
    | AccNormal -> "AccNormal"
    | AccNo -> "AccNo"
    | AccNever -> "AccNever"
-   | AccResolve -> "AccResolve"
    | AccCall -> "AccCall"
    | AccInline -> "AccInline"
    | AccRequire(_,_) -> "AccRequire"
@@ -8225,7 +8224,6 @@ let generate_script_class common_ctx script class_def =
          | AccNormal | AccCtor -> IaAccessNormal
          | AccNo -> IaAccessNot
          | AccNever -> IaAccessNot
-         | AccResolve -> IaAccessResolve
          | AccCall -> if ( (has_meta_key class_def.cl_meta Meta.NativeProperty) ||
                            (has_meta_key field.cf_meta Meta.NativeProperty) ||
                            (Common.defined common_ctx Define.ForceNativeProperty) )

+ 1 - 3
src/generators/genpy.ml

@@ -1750,8 +1750,6 @@ module Generator = struct
 		let methods = DynArray.create () in
 		List.iter (fun cf ->
 			match cf.cf_kind with
-				| Var({v_read = AccResolve}) ->
-					()
 				| Var _ when not (is_physical_field cf) ->
 					()
 				| Var({v_read = AccCall}) ->
@@ -1958,7 +1956,7 @@ module Generator = struct
 			print ctx "    @staticmethod\n    def _hx_empty_init(_hx_o):";
 			let found_fields = ref false in
 			List.iter (fun cf -> match cf.cf_kind with
-					| Var ({v_read = AccResolve | AccCall}) ->
+					| Var ({v_read = AccCall}) ->
 						()
 					| Var _ ->
 						found_fields := true;

+ 0 - 2
src/macro/macroApi.ml

@@ -965,7 +965,6 @@ and encode_var_access a =
 		| AccNormal -> 0, []
 		| AccNo -> 1, []
 		| AccNever -> 2, []
-		| AccResolve -> 3, []
 		| AccCall -> 4, []
 		| AccInline	-> 5, []
 		| AccRequire (s,msg) -> 6, [encode_string s; null encode_string msg]
@@ -1289,7 +1288,6 @@ let decode_var_access v =
 	| 0, [] -> AccNormal
 	| 1, [] -> AccNo
 	| 2, [] -> AccNever
-	| 3, [] -> AccResolve
 	| 4, [] -> AccCall
 	| 5, [] -> AccInline
 	| 6, [s1;s2] -> AccRequire(decode_string s1, opt decode_string s2)

+ 0 - 4
src/typing/fields.ml

@@ -226,10 +226,6 @@ let field_access ctx mode f fmode t e p =
 				AKSet (e,t,f)
 			else
 				AKExpr (make_call ctx (mk (TField (e,quick_field_dynamic e.etype m)) (tfun [] t) p) [] t p)
-		| AccResolve ->
-			let fstring = mk (TConst (TString f.cf_name)) ctx.t.tstring p in
-			let tresolve = tfun [ctx.t.tstring] t in
-			AKExpr (make_call ctx (mk (TField (e,FDynamic "resolve")) tresolve p) [fstring] t p)
 		| AccNever ->
 			if ctx.untyped then normal() else AKNo f.cf_name
 		| AccInline ->

+ 0 - 44
src/typing/magicTypes.ml

@@ -87,47 +87,6 @@ let extend_remoting ctx c t p async prot =
 	| TClassDecl c2 when c2.cl_params = [] -> ignore(c2.cl_build()); c.cl_super <- Some (c2,[]);
 	| _ -> error "Remoting proxy must be a class without parameters" p
 
-(* -------------------------------------------------------------------------- *)
-(* HAXE.XML.PROXY *)
-
-let extend_xml_proxy ctx c t file p =
-	let t = load_complex_type ctx false (t,p) in
-	let file = (try Common.find_file ctx.com file with Not_found -> file) in
-	add_dependency c.cl_module (create_fake_module ctx file);
-	let used = ref PMap.empty in
-	let print_results() =
-		PMap.iter (fun id used ->
-			if not used then ctx.com.warning (id ^ " is not used") p;
-		) (!used)
-	in
-	let check_used = Common.defined ctx.com Define.CheckXmlProxy in
-	if check_used then ctx.g.hook_generate <- print_results :: ctx.g.hook_generate;
-	try
-		let rec loop = function
-			| Xml.Element (_,attrs,childs) ->
-				(try
-					let id = List.assoc "id" attrs in
-					if PMap.mem id c.cl_fields then error ("Duplicate id " ^ id) p;
-					let t = if not check_used then t else begin
-						used := PMap.add id false (!used);
-						let ft() = used := PMap.add id true (!used); t in
-						TLazy (ref (lazy_wait ft))
-					end in
-					let f = {
-						(mk_field id t p null_pos) with
-						cf_kind = Var { v_read = AccResolve; v_write = AccNo };
-					} in
-					c.cl_fields <- PMap.add id f c.cl_fields;
-				with
-					Not_found -> ());
-				List.iter loop childs;
-			| Xml.PCData _ -> ()
-		in
-		loop (Xml.parse_file file)
-	with
-		| Xml.Error e -> error ("XML error " ^ Xml.error e) p
-		| Xml.File_not_found f -> error ("XML File not found : " ^ f) p
-
 let on_inherit ctx c p (is_extends,tp) =
 	if not is_extends then
 		true
@@ -138,8 +97,5 @@ let on_inherit ctx c p (is_extends,tp) =
 	| { tpackage = ["haxe";"remoting"]; tname = "AsyncProxy"; tparams = [TPType(CTPath t,null_pos)] } ->
 		extend_remoting ctx c t p true true;
 		false
-	| { tpackage = ["haxe";"xml"]; tname = "Proxy"; tparams = [TPExpr(EConst (String(file,SDoubleQuotes)),p);TPType (t,_)] } ->
-		extend_xml_proxy ctx c t file p;
-		true
 	| _ ->
 		true

+ 0 - 52
std/haxe/xml/Proxy.hx

@@ -1,52 +0,0 @@
-/*
- * Copyright (C)2005-2019 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-package haxe.xml;
-
-/**
-	This proxy can be inherited with an XML file name parameter.
-	It will	only allow access to fields which corresponds to an "id" attribute
-	value in the XML file :
-
-	```haxe
-	class MyXml extends haxe.xml.Proxy<"my.xml", MyStructure> {
-	}
-
-	var h = new haxe.ds.StringMap<MyStructure>();
-	// ... fill h with "my.xml" content
-	var m = new MyXml(h.get);
-	trace(m.myNode.structField);
-	// Access to "myNode" is only possible if you have an id="myNode" attribute
-	// in your XML, and completion works as well.
-	```
-**/
-class Proxy<Const, T> {
-	var __f:String->T;
-
-	public function new(f) {
-		this.__f = f;
-	}
-
-	public function resolve(k) {
-		return __f(k);
-	}
-}