Quellcode durchsuchen

public __resolve

Nicolas Cannasse vor 18 Jahren
Ursprung
Commit
c71795ce2d

+ 1 - 0
doc/CHANGES.txt

@@ -23,6 +23,7 @@
 	fixed stack overflow with static setter
 	fixed package completion bug when -cp points to an not existing dir
 	fix duplicate sandboxes tags with -swf
+	__resolve in haXe Remoting is now public
 
 2007-07-25: 1.14
 	fixed no error when invalid "catch" expression

+ 0 - 1
std/haxe/ImportAll.hx

@@ -306,7 +306,6 @@ import flash.system.Security;
 
 // generated by haxe
 import flash9.Boot;
-import flash9.Event;
 import flash9.Lib;
 import flash9.FlashXml__;
 import flash9.accessibility.Accessibility;

+ 55 - 0
std/haxe/remoting/AsyncAdapter.hx

@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2005-2007, 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.remoting;
+
+/**
+	Build an AsyncConnection from a synchronized Connection.
+**/
+class AsyncAdapter extends AsyncConnection {
+
+	public override function __resolve( name ) {
+		var s = new AsyncAdapter(__data.__resolve(name),null);
+		s.__error = __error;
+		return s;
+	}
+
+	public function call( params : Array<Dynamic>, ?onData : Dynamic -> Void ) : Void {
+		var ret;
+		try {
+			var c : Connection = __data;
+			ret = c.call(params);
+		} catch( e : Dynamic ) {
+			onError(e);
+			return;
+		}
+		if( onData != null )
+			onData(ret);
+	}
+
+	public static function create( c : Connection ) {
+		return new AsyncAdapter(c,null);
+	}
+
+}

+ 1 - 1
std/haxe/remoting/AsyncConnection.hx

@@ -37,7 +37,7 @@ class AsyncConnection implements Dynamic<AsyncConnection> {
 		__error = { ref : function(e) { throw e; } };
 	}
 
-	function __resolve(field) {
+	public function __resolve(field) {
 		var s = new AsyncConnection(__data,__path.copy());
 		s.__error = __error;
 		s.__path.push(field);

+ 1 - 1
std/haxe/remoting/AsyncDebugConnection.hx

@@ -46,7 +46,7 @@ class AsyncDebugConnection extends AsyncConnection, implements Dynamic<AsyncDebu
 		return f;
 	}
 
-	override function __resolve(field : String) : AsyncConnection {
+	public override function __resolve(field : String) : AsyncConnection {
 		var s = new AsyncDebugConnection(__data.__resolve(field));
 		s.lastCalls = lastCalls;
 		s.__error = __error;

+ 1 - 1
std/haxe/remoting/Connection.hx

@@ -34,7 +34,7 @@ class Connection implements Dynamic<Connection> {
 		__path = path;
 	}
 
-	function __resolve(field) {
+	public function __resolve(field) {
 		var s = new Connection(__data,__path.copy());
 		s.__path.push(field);
 		return s;

+ 1 - 1
std/haxe/remoting/DelayedConnection.hx

@@ -33,7 +33,7 @@ class DelayedConnection extends AsyncConnection, implements Dynamic<DelayedConne
 
 	public var connection(getConnection,setConnection) : AsyncConnection;
 
-	override function __resolve( field : String ) : AsyncConnection {
+	public override function __resolve( field : String ) : AsyncConnection {
 		var d = new DelayedConnection(__data,__path.copy());
 		d.__error = __error;
 		d.__path.push(field);

+ 1 - 1
std/haxe/remoting/FlashJsConnection.hx

@@ -4,7 +4,7 @@ class FlashJsConnection extends haxe.remoting.AsyncConnection {
 
 	#if flash
 
-	override function __resolve( field : String ) : AsyncConnection {
+	public override function __resolve( field : String ) : AsyncConnection {
 		var c = new FlashJsConnection(__data,__path.copy());
 		c.__error = __error;
 		c.__path.push(field);

+ 1 - 1
std/haxe/remoting/LocalConnection.hx

@@ -32,7 +32,7 @@ class LocalConnection extends AsyncConnection {
 
 	var __funs : List<Dynamic -> Void>;
 
-	override function __resolve(field) : AsyncConnection {
+	public override function __resolve(field) : AsyncConnection {
 		var s = new LocalConnection(__data,__path.copy());
 		s.__error = __error;
 		s.__funs = __funs;

+ 1 - 1
std/haxe/remoting/NekoSocketConnection.hx

@@ -29,7 +29,7 @@ class NekoSocketConnection extends Connection {
 
 	var __r : neko.net.RemotingServer;
 
-	override function __resolve(field) : Connection {
+	public override function __resolve(field) : Connection {
 		var s = new NekoSocketConnection(__data,__path.copy());
 		s.__r = __r;
 		s.__path.push(field);

+ 1 - 1
std/haxe/remoting/SocketConnection.hx

@@ -32,7 +32,7 @@ class SocketConnection extends AsyncConnection {
 	var __r : neko.net.RemotingServer;
 	#end
 
-	override function __resolve(field) : AsyncConnection {
+	public override function __resolve(field) : AsyncConnection {
 		var s = new SocketConnection(__data,__path.copy());
 		s.__error = __error;
 		s.__funs = __funs;

+ 1 - 2
std/haxe/remoting/SocketWrapper.hx

@@ -36,8 +36,7 @@ class SocketWrapper {
 		throw "Not implemented";
 		#else true
 		var s = new flash.XMLSocket();
-		var cnx : { private function __resolve( id : String ) : haxe.remoting.Connection; } = haxe.remoting.Connection.jsConnect().js.XMLSocket.sockets;
-		var cnx = cnx.__resolve(id);
+		var cnx = haxe.remoting.Connection.jsConnect().js.XMLSocket.sockets.__resolve(id);
 		Reflect.setField(sockets,id,s);
 		s.onConnect = function(b) {
 			cnx.onConnect.call([b]);

+ 1 - 2
std/js/XMLSocket.hx

@@ -40,8 +40,7 @@ class XMLSocket {
 		id = "s"+(ID++);
 		rcnx = haxe.remoting.Connection.flashConnect(flashObject).haxe.remoting.SocketWrapper;
 		rcnx.create.call([id]);
-		var cnx : { private function __resolve( id : String ) : haxe.remoting.Connection; } = rcnx.sockets;
-		this.cnx = cnx.__resolve(Std.string(id));
+		this.cnx = rcnx.sockets.__resolve(Std.string(id));
 		Reflect.setField(sockets,id,this);
 	}