Przeglądaj źródła

implemented php.Lib.getClasses()

Franco Ponticelli 17 lat temu
rodzic
commit
1886f06a4c
2 zmienionych plików z 22 dodań i 0 usunięć
  1. 1 0
      doc/CHANGES.txt
  2. 21 0
      std/php/Lib.hx

+ 1 - 0
doc/CHANGES.txt

@@ -36,6 +36,7 @@ TODO inlining : substitute class+function type parameters in order to have fully
 	added php check on the full hierarchy for colliding names
 	added php check on the full hierarchy for colliding names
 	added support for "g" modifier in EReg for PHP
 	added support for "g" modifier in EReg for PHP
 	PHP now generates __toString for classes that have toString defined
 	PHP now generates __toString for classes that have toString defined
+	implemented php.Lib.getClasses()
 
 
 2008-07-28: 2.0
 2008-07-28: 2.0
 	fixed current package bug in inherited constructor type
 	fixed current package bug in inherited constructor type

+ 21 - 0
std/php/Lib.hx

@@ -69,4 +69,25 @@ class Lib {
 		throw e;
 		throw e;
 	}
 	}
 
 
+	static function appendType(o : Dynamic, path : Array<String>, t : Dynamic) {
+		var name = path.shift();
+		if(path.length == 0)
+			untyped __php__("$o->$name = $t");
+		else {
+			var so = {};
+			appendType(so, path, t);
+			untyped __php__("$o->$name = $so");
+		}
+	}
+
+	public static function getClasses() {
+		var path : String = null;
+		var o = {};
+		untyped __call__('reset', php.Boot.__qtypes);
+		while((path = untyped __call__('key', php.Boot.__qtypes)) != null) {
+			appendType(o, path.split('.'), untyped php.Boot.__qtypes[path]);
+			untyped __call__('next', php.Boot.__qtypes);
+		}
+		return o;
+	}
 }
 }