Browse Source

haxe.rtti.Infos -> @:rrtiInfos, haxe.rtti.Generic -> @:generic

Simon Krajewski 12 years ago
parent
commit
43008ffc92
5 changed files with 5 additions and 88 deletions
  1. 2 15
      codegen.ml
  2. 2 0
      main.ml
  3. 0 30
      std/haxe/rtti/Generic.hx
  4. 0 29
      std/haxe/rtti/Infos.hx
  5. 1 14
      typeload.ml

+ 2 - 15
codegen.ml

@@ -556,8 +556,6 @@ let on_inherit ctx c p h =
 	| HExtends { tpackage = ["mt"]; tname = "AsyncProxy"; tparams = [TPType(CTPath t)] } ->
 		extend_remoting ctx c t p true false;
 		false
-	| HImplements { tpackage = ["haxe";"rtti"]; tname = "Generic"; tparams = [] } ->
-		error ("Implementing haxe.rtti.Generic is deprecated in haxe 3, please use @:generic instead") c.cl_pos;
 	| HExtends { tpackage = ["haxe";"xml"]; tname = "Proxy"; tparams = [TPExpr(EConst (String file),p);TPType t] } ->
 		extend_xml_proxy ctx c t file p;
 		true
@@ -635,19 +633,8 @@ let apply_native_paths ctx t =
 
 (* Adds the __rtti field if required *)
 let add_rtti ctx t =
-	let has_rtti c =
-		let rec has_rtti_new c =
-			Meta.has Meta.RttiInfos c.cl_meta || match c.cl_super with None -> false | Some (csup,_) -> has_rtti_new csup
-		in
-		let rec has_rtti_old c =
-			List.exists (function (t,pl) ->
-				match t, pl with
-				| { cl_path = ["haxe";"rtti"],"Infos" },[] -> true
-				| _ -> false
-			) c.cl_implements || (match c.cl_super with None -> false | Some (c,_) -> has_rtti_old c)
-		in
-		if has_rtti_old c then error ("Implementing haxe.rtti.Infos is deprecated in haxe 3, please use @:rttiInfos instead") c.cl_pos;
-		has_rtti_new c
+	let rec has_rtti c =
+		Meta.has Meta.RttiInfos c.cl_meta || match c.cl_super with None -> false | Some (csup,_) -> has_rtti csup
 	in
 	match t with
 	| TClassDecl c when has_rtti c && not (PMap.mem "__rtti" c.cl_statics) ->

+ 2 - 0
main.ml

@@ -88,6 +88,8 @@ let deprecated = [
 	"Class not found : Int32","Int32 has been removed, use Int instead";
 	"Identifier 'EType' is not part of enum haxe.macro.ExprDef","EType has been removed, use EField instead";
 	"Identifier 'CType' is not part of enum haxe.macro.Constant","CType has been removed, use CIdent instead";
+	"Class not found : haxe.rtti.Infos","Use @:rttiInfos instead of implementing haxe.rttiInfos";
+	"Class not found : haxe.rtti.Generic","Use @:generic instead of implementing haxe.Generic";
 ]
 
 let error ctx msg p =

+ 0 - 30
std/haxe/rtti/Generic.hx

@@ -1,30 +0,0 @@
-/*
- * Copyright (C)2005-2012 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.rtti;
-
-/**
-	You can implement this interface with a parametrized type. For each type
-	parameter used, a duplicate class with be created. This is useful on
-	platforms that supports runtime typing (such as flash9).
-**/
-interface Generic {
-}

+ 0 - 29
std/haxe/rtti/Infos.hx

@@ -1,29 +0,0 @@
-/*
- * Copyright (C)2005-2012 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.rtti;
-
-/**
-	This is a magic interface. When a class implements [haxe.rtti.Infos], this class and all its
-	subclass will get an additional static field [__rtti] storing the class type informations.
-**/
-interface Infos {
-}

+ 1 - 14
typeload.ml

@@ -1788,20 +1788,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 	| EClass d ->
 		let c = (match get_type d.d_name with TClassDecl c -> c | _ -> assert false) in
 		let herits = d.d_flags in
-		(*
-			we need to check rtti has early as class declaration, but we can't resolve imports,
-			so let's have a quick heuristic for backward compatibility
-		*)
-		let implements_rtti() =
-			let rtti = List.exists (function
-				| HImplements { tpackage = ["haxe";"rtti"]; tname = "Generic" } -> true
-				| HImplements { tpackage = []; tname = "Generic" } -> List.exists (fun t -> t_path t = (["haxe";"rtti"],"Generic")) ctx.m.module_types
-				| _ -> false
-			) herits in
-			if rtti then error ("Implementing haxe.rtti.Generic is deprecated in haxe 3, please use @:generic instead") c.cl_pos;
-			Meta.has Meta.Generic c.cl_meta || rtti
-		in
-		if implements_rtti() && c.cl_types <> [] then c.cl_kind <- KGeneric;
+		if Meta.has Meta.Generic c.cl_meta && c.cl_types <> [] then c.cl_kind <- KGeneric;
 		if c.cl_path = (["haxe";"macro"],"MacroType") then c.cl_kind <- KMacroType;
 		c.cl_extern <- List.mem HExtern herits;
 		c.cl_interface <- List.mem HInterface herits;