Browse Source

removed haxe.Proxy

Nicolas Cannasse 18 years ago
parent
commit
bdbe17a1ea
3 changed files with 0 additions and 98 deletions
  1. 0 1
      std/haxe/ImportAll.hx
  2. 0 44
      std/haxe/Proxy.hx
  3. 0 53
      typer.ml

+ 0 - 1
std/haxe/ImportAll.hx

@@ -53,7 +53,6 @@ import haxe.ImportAll;
 import haxe.Log;
 import haxe.Md5;
 import haxe.PosInfos;
-import haxe.Proxy;
 import haxe.Serializer;
 import haxe.Stack;
 import haxe.Template;

+ 0 - 44
std/haxe/Proxy.hx

@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2005, The haXe Project Contributors
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *   - Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *   - Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- */
-package haxe;
-
-/**
-	While an [haxe.Proxy] has the same type as the class it's created with, all
-	its methods calls are forwarded to the [handleCall] method which enable
-	tracing and other usages.
-**/
-class Proxy<T> {
-
-	var c : T;
-
-	public function new( c : T ) {
-		this.c = c;
-	}
-
-	public function handleCall( method : String, params : Array<Dynamic> ) : Dynamic {
-		return Reflect.callMethod(c,Reflect.field(c,method),params);
-	}
-
-}

+ 0 - 53
typer.ml

@@ -515,57 +515,6 @@ let extend_remoting ctx c t p async prot =
 		| _ -> assert false
 	)
 
-let extend_proxy ctx c t p =
-	if c.cl_super <> None then error "Cannot extend several classes" p;
-	let tclass = load_normal_type ctx t p false in
-	let tdyn = TPNormal { tpackage = []; tname = "Dynamic"; tparams = []; } in
-	let make_field f args =
-		let args = List.map (fun (name,o,t) -> name , o, Some tdyn) args in
-		let eargs = List.map (fun (name,_,_) -> EConst (Ident name) , p) args in
-		f.cf_name , (FFun (f.cf_name,None,[if f.cf_public then APublic else APrivate],[], {
-			f_args = args;
-			f_type = None;
-			f_expr = (EBlock [
-				(EReturn (Some (ECall (
-					(EConst (Ident "handleCall"),p),
-					[(ECall ((EConst (Ident "__unprotect__"),p),[EConst (String f.cf_name),p]),p); (EArrayDecl eargs,p)]
-				),p)),p)
-			],p);
-		}),p)
-	in
-	let class_fields = (match tclass with
-		| TInst (c,params) ->
-			let rec loop c =
-				PMap.fold (fun f acc ->
-					match follow f.cf_type with
-					| TFun (args,ret) ->
-						(try
-							ignore(List.assoc f.cf_name acc);
-							acc
-						with
-							Not_found -> make_field f args :: acc)
-					| _ -> acc
-				) c.cl_fields (match c.cl_super with None -> [] | Some (c,_) -> loop c)
-			in
-			List.map snd (loop c)
-		| _ ->
-			error "Proxy type parameter should be a class" p
-	) in
-	let tproxy = { tpackage = ["haxe"]; tname = "Proxy"; tparams = [TPType (TPNormal t)] } in
-	let pname = "P" ^ t.tname in
-	let class_decl = (EClass {
-		d_name = pname;
-		d_doc = None;
-		d_params = List.map (fun (s,_) -> s,[]) c.cl_types;
-		d_flags = [HExtends tproxy; HImplements t];
-		d_data = class_fields;
-	},p) in
-	let m = (!type_module_ref) ctx ("Proxy" :: t.tpackage, pname) [class_decl] p in
-	c.cl_super <- Some (match m.mtypes with
-		| [TClassDecl c2] -> (c2,List.map snd c.cl_types)
-		| _ -> assert false
-	)
-
 let extend_xml_proxy ctx c t file p =
 	let t = load_type ctx p t in
 	let file = (try Plugin.find_file file with Not_found -> file) in
@@ -606,8 +555,6 @@ let set_heritance ctx c herits p =
 			extend_remoting ctx c t p true true
 		| HExtends { tpackage = ["mt"]; tname = "AsyncProxy"; tparams = [TPType(TPNormal t)] } ->
 			extend_remoting ctx c t p true false
-		| HExtends { tpackage = ["haxe"]; tname = "Proxy"; tparams = [TPType(TPNormal t)] } when match c.cl_path with "Proxy" :: _ , _ -> false | _ -> true ->
-			extend_proxy ctx c t p
 		| HExtends t ->
 			if c.cl_super <> None then error "Cannot extend several classes" p;
 			(match t with