Bladeren bron

prot fixes.

Nicolas Cannasse 19 jaren geleden
bovenliggende
commit
bce3158bb1

+ 2 - 2
std/IntHash.hx

@@ -138,8 +138,8 @@ class IntHash<T> {
 		return untyped {
 			ref : h,
 			it : keys(),
-			hasNext : function() { return this.it.hasNext(); },
-			next : function() { var i = this.it.next(); return this.ref[i]; }
+			hasNext : function() { return this.it[__unprotect__("hasNext")](); },
+			next : function() { var i = this.it[__unprotect__("next")](); return this.ref[i]; }
 		};
 		#else js
 		return untyped {

+ 15 - 14
std/flash/Boot.hx

@@ -70,7 +70,7 @@ class Boot {
 				if( typeof(o) == "movieclip" )
 					str = "MC("+o._name+") "+str;
 				s += "    ";
-				for( k in (__keys__(o)).iterator() ) {
+				for( k in (__keys__(o))["iterator"]() ) {
 					if( str.length != 2 )
 						str += ",\n";
 					if( k == __unprotect__("__construct__") && __typeof__(o[k]) == "function" )
@@ -149,7 +149,7 @@ class Boot {
 		}
 	}
 
-	private static function __trace(v,inf) {
+	private static function __trace(v,inf : haxe.PosInfos) {
 		untyped {
 			var root = flash.Lib.current;
 			var tf : flash.TextField = root.__trace_txt;
@@ -171,8 +171,9 @@ class Boot {
 
 	private static function __clear_trace() {
 		untyped {
-			_root.__trace_txt.removeTextField();
-			_root.__trace_lines = null;
+			var root = flash.Lib.current;
+			root.__trace_txt["removeTextField"]();
+			root.__trace_lines = null;
 		}
 	}
 
@@ -180,7 +181,7 @@ class Boot {
 		// only if not set yet
 		var g : Dynamic = _global;
 		if( !g.haxeInitDone ) {
-			var obj = _global.Object;
+			var obj = _global["Object"];
 			g.haxeInitDone = true;
 			g.Int = __new__(obj);
 			g.Bool = __new__(obj);
@@ -188,12 +189,12 @@ class Boot {
 			g.Bool = __new__(obj);
 			g.Bool[__unprotect__("true")] = true;
 			g.Bool[__unprotect__("false")] = false;
-			g.Float = _global.Number;
-			Array.prototype.copy = Array.prototype.slice;
-			Array.prototype.insert = function(i,x) {
+			g.Float = _global["Number"];
+			Array.prototype["copy"] = Array.prototype["slice"];
+			Array.prototype["insert"] = function(i,x) {
 				this["splice"](i,0,x);
 			};
-			Array.prototype.remove = function(obj) {
+			Array.prototype["remove"] = function(obj) {
 				var i = 0;
 				var l = this["length"];
 				while( i < l ) {
@@ -205,21 +206,21 @@ class Boot {
 				}
 				return false;
 			}
-			Array.prototype.iterator = function() {
+			Array.prototype["iterator"] = function() {
 				return {
 					cur : 0,
 					arr : this,
 					hasNext : function() {
-						return this.cur < this.arr.length;
+						return this.cur < this.arr["length"];
 					},
 					next : function() {
 						return this.arr[this.cur++];
 					}
 				}
 			};
-			var cca = String.prototype.charCodeAt;
-			String.prototype.charCodeAt = function(i) {
-				var x = cca.call(this,i);
+			var cca = String.prototype["charCodeAt"];
+			String.prototype["charCodeAt"] = function(i) {
+				var x = cca["call"](this,i);
 				if( x <= 0 ) // fast NaN
 					return null;
 				return x;

+ 19 - 19
std/flash/FlashXml__.hx

@@ -55,9 +55,9 @@ class FlashXml__ {
 
 	public static function parse( xmlData : String ) : Xml untyped {
 		var x = __new__(_global["XML"]);
-		x.parseXML(xmlData);
-		if( x.status != 0 )
-			throw ("Xml parse error #"+x.status);
+		x["parseXML"](xmlData);
+		if( x["status"] != 0 )
+			throw ("Xml parse error #"+x["status"]);
 
 		var r = convert(x);
 		untyped r.nodeType = Xml.Document;
@@ -65,7 +65,7 @@ class FlashXml__ {
 	}
 
 	public static function createDocument() : Xml {
-		var o = untyped __new__(_global["XML"]).createElement( "#document" );
+		var o = untyped __new__(_global["XML"])["createElement"]( "#document" );
 
 		var r = convert(o);
 		untyped r.nodeType = Xml.Document;
@@ -73,20 +73,20 @@ class FlashXml__ {
 	}
 
 	public static function createCData( s : String ) : Xml {
-		var o = untyped __new__(_global["XML"]).createTextNode( s );
+		var o = untyped __new__(_global["XML"])["createTextNode"]( s );
 		var x = convert(o);
 		untyped x.nodeType = Xml.CData;
 		return x;
 	}
 
 	public static function createPCData( s : String ) : Xml {
-		var o = untyped __new__(_global["XML"]).createTextNode( s );
+		var o = untyped __new__(_global["XML"])["createTextNode"]( s );
 
 		return convert(o);
 	}
 
 	public static function createElement( s : String ) : Xml {
-		var o = untyped __new__(_global["XML"]).createElement( s );
+		var o = untyped __new__(_global["XML"])["createElement"]( s );
 
 		return convert(o);
 	}
@@ -152,7 +152,7 @@ class FlashXml__ {
 			},
 			next : function(){
 				var r = convert(this.cur);
-				this.cur = this.cur.nextSibling;
+				this.cur = this.cur["nextSibling"];
 				return r;
 			}
 		}
@@ -163,20 +163,20 @@ class FlashXml__ {
 			cur: this.__x[untyped "firstChild"],
 			hasNext : function() {
 				var r = this.cur;
-				while( r != null && r.nodeType != 1 )
-					r = r.nextSibling;
+				while( r != null && r["nodeType"] != 1 )
+					r = r["nextSibling"];
 				this.cur = r;
 				return r != null;
 			},
 			next : function(){
 				var r = this.cur;
-				while( r != null && r.nodeType != 1 )
-					r = r.nextSibling;
+				while( r != null && r["nodeType"] != 1 )
+					r = r["nextSibling"];
 				if( r == null ) {
 					this.cur = null;
 					return null;
 				}
-				this.cur = r.nextSibling;
+				this.cur = r["nextSibling"];
 				return convert(r);
 			}
 		}
@@ -187,20 +187,20 @@ class FlashXml__ {
 			cur: this.__x[untyped "firstChild"],
 			hasNext : function() {
 				var r = this.cur;
-				while( r != null && (r.nodeType != 1 || r.nodeName != nodeName) )
-					r = r.nextSibling;
+				while( r != null && (r["nodeType"] != 1 || r["nodeName"] != nodeName) )
+					r = r["nextSibling"];
 				this.cur = r;
 				return r != null;
 			},
 			next : function(){
 				var r = this.cur;
-				while( r != null && (r.nodeType != 1 || r.nodeName != nodeName) )
-					r = r.nextSibling;
+				while( r != null && (r["nodeType"] != 1 || r["nodeName"] != nodeName) )
+					r = r["nextSibling"];
 				if( r == null ) {
 					this.cur = null;
 					return null;
 				}
-				this.cur = r.nextSibling;
+				this.cur = r["nextSibling"];
 				return convert(r);
 			}
 		}
@@ -233,7 +233,7 @@ class FlashXml__ {
 	public function attributes() : Iterator<String> {
 		if( nodeType != Xml.Element )
 			throw "bad nodeType";
-		return untyped __keys__(__x["attributes"]).iterator();
+		return untyped __keys__(__x["attributes"])["iterator"]();
 	}
 
 	public function addChild( child : Xml ) {

+ 1 - 1
std/flash/system/Capabilities.hx

@@ -31,7 +31,7 @@ extern class Capabilities
 	static var windowlessDisable:Bool;
 
 	private static function __init__() : Void untyped {
-		flash.system.Capabilities = _global.System.capabilities;
+		flash.system.Capabilities = _global["System"]["capabilities"];
 	}
 
 }

+ 1 - 1
std/flash/system/IME.hx

@@ -21,7 +21,7 @@ extern class IME {
 	static function removeListener(listener:Dynamic) : Bool;
 
 	private static function __init__() : Void untyped {
-		flash.system.IME = _global.System.IME;
+		flash.system.IME = _global["System"]["IME"];
 	}
 
 }

+ 1 - 1
std/flash/system/Security.hx

@@ -7,7 +7,7 @@ extern class Security
 	static function loadPolicyFile(url:String):Void;
 
 	private static function __init__() : Void untyped {
-		flash.system.Security = _global.System.security;
+		flash.system.Security = _global["System"]["security"];
 	}
 
 }

+ 1 - 1
std/flash/text/StyleSheet.hx

@@ -13,7 +13,7 @@ extern class StyleSheet
 	function onLoad(success:Bool):Void;
 
 	private static function __init__() : Void untyped {
-		flash.text.StyleSheet = _global.TextField.StyleSheet;
+		flash.text.StyleSheet = _global["TextField"]["StyleSheet"];
 	}
 
 }