Переглянути джерело

php: removed any reference to »

Franco Ponticelli 12 роки тому
батько
коміт
bcd53a2c84
6 змінених файлів з 95 додано та 122 видалено
  1. 31 43
      genphp.ml
  2. 0 13
      std/haxe/io/Bytes.hx
  3. 60 62
      std/php/Boot.hx
  4. 1 1
      std/php/Lib.hx
  5. 2 2
      std/php/_std/Reflect.hx
  6. 1 1
      std/php/_std/Type.hx

+ 31 - 43
genphp.ml

@@ -158,6 +158,12 @@ let s_expr_name e =
 let s_type_name t =
 	s_type (print_context()) t
 
+
+
+and start_with s test =
+	let len = String.length test in
+	(String.length s > len && String.sub s 0 len = test)
+
 let rec is_uncertain_type t =
 	match follow t with
 	| TInst (c, _) -> c.cl_interface
@@ -341,7 +347,7 @@ let write_resource dir name data =
 	close_out ch
 
 let stack_init com use_add =
-	Codegen.stack_context_init com "GLOBALS['%s']" "GLOBALS['%e']" "»spos" "»tmp" use_add null_pos
+	Codegen.stack_context_init com "GLOBALS['%s']" "GLOBALS['%e']" "__hx__spos" "tmp" use_add null_pos
 
 let init com cwd path def_type =
 	let rec create acc = function
@@ -358,7 +364,7 @@ let init com cwd path def_type =
 		| [], "List" -> "HList";
 		| _, s -> s) in
 	(*--php-prefix*)
-	let ch = open_out_bin (String.concat "/" dir ^ "/" ^ (filename path) ^ (if def_type = 0 then ".class" else if def_type = 1 then ".enum"  else if def_type = 2 then ".interface" else ".extern") ^ ".php") in
+	let ch = open_out (String.concat "/" dir ^ "/" ^ (filename path) ^ (if def_type = 0 then ".class" else if def_type = 1 then ".enum"  else if def_type = 2 then ".interface" else ".extern") ^ ".php") in
 	let imports = Hashtbl.create 0 in
 	Hashtbl.add imports (snd path) [fst path];
 	{
@@ -455,7 +461,7 @@ let define_local ctx l =
 	loop 1
 
 let this ctx =
-	if ctx.in_value <> None then "$»this" else "$this"
+	if ctx.in_value <> None then "$__hx__this" else "$this"
 
 let gen_constant ctx p = function
 	| TInt i -> print ctx "%ld" i
@@ -1020,7 +1026,7 @@ and gen_expr ctx e =
 			(match e.eexpr with
 			| TArray(te1, te2) ->
 				gen_value ctx te1;
-				spr ctx "->»a[";
+				spr ctx "->a[";
 				gen_value ctx te2;
 				spr ctx "]";
 			| _ ->
@@ -1029,7 +1035,7 @@ and gen_expr ctx e =
 			(match e.eexpr with
 			| TArray(te1, te2) ->
 				gen_value ctx te1;
-				spr ctx "->»a[";
+				spr ctx "->a[";
 				gen_value ctx te2;
 				spr ctx "]";
 			| TField (e1,s) ->
@@ -1068,11 +1074,14 @@ and gen_expr ctx e =
 		| Ast.OpAssignOp(Ast.OpAdd) when (is_uncertain_expr e1 && is_uncertain_expr e2) ->
 			(match e1.eexpr with
 			| TArray(te1, te2) ->
-				spr ctx "_hx_array_assign($»t1 = ";
+				let t1 = define_local ctx "__hx__t1" in
+				let t2 = define_local ctx "__hx__t2" in
+
+				print ctx "_hx_array_assign($%s = " t1;
 				gen_value ctx te1;
-				spr ctx ", $»t2 = ";
+				print ctx ", $%s = " t2;
 				gen_value ctx te2;
-				spr ctx ", $»t1->»a[$»t2] + ";
+				print ctx ", $%s->a[$%s] + " t1 t2;
 				gen_value_op ctx e2;
 				spr ctx ")";
 			| _ ->
@@ -1419,16 +1428,6 @@ and gen_expr ctx e =
 				spr ctx ",";
 				gen_value ctx te2;
 				spr ctx ")";
-(*
-				let t = define_local ctx "»t" in
-				gen_value ctx te1;
-				print ctx "[%s = " t;
-				gen_value ctx te2;
-				spr ctx "] = ";
-				gen_value ctx te1;
-				print ctx "[%s]" t;
-				print ctx "[%s]" t;
-*)
 			| _ ->
 				spr ctx (Ast.s_unop op);
 				gen_value ctx te1;
@@ -1446,7 +1445,7 @@ and gen_expr ctx e =
 		(match e.eexpr with
 		| TArray(te1, te2) ->
 			gen_value ctx te1;
-			spr ctx "->»a[";
+			spr ctx "->a[";
 			gen_value ctx te2;
 			spr ctx "]";
 		| TField (e1,s) ->
@@ -1481,7 +1480,7 @@ and gen_expr ctx e =
 		spr ctx "))"
 	| TFor (v,it,e) ->
 		let b = save_locals ctx in
-		let tmp = define_local ctx "»it" in
+		let tmp = define_local ctx "__hx__it" in
 		let v = define_local ctx v.v_name in
 		(match it.eexpr with
 		| TCall (e,_) ->
@@ -1512,7 +1511,7 @@ and gen_expr ctx e =
 		restore_in_block ctx in_block;
 		gen_expr ctx (mk_block e);
 		let old = save_locals ctx in
-		let ex = define_local ctx "»e" in
+		let ex = define_local ctx "__hx__e" in
 		print ctx "catch(Exception $%s) {" ex;
 		let bend = open_block ctx in
 		let first = ref true in
@@ -1573,7 +1572,7 @@ and gen_expr ctx e =
 		spr ctx "}"
 	| TMatch (e,_,cases,def) ->
 		let b = save_locals ctx in
-		let tmp = define_local ctx "»t" in
+		let tmp = define_local ctx "__hx__t" in
 		print ctx "$%s = " tmp;
 		gen_value ctx e;
 		newline ctx;
@@ -1670,7 +1669,7 @@ and gen_expr ctx e =
 
 and argument_list_from_locals include_this in_var l =
 	let lst = ref [] in
-	if (include_this && in_var) then lst := "»this" :: !lst
+	if (include_this && in_var) then lst := "__hx__this" :: !lst
 	else if include_this then lst := "this" :: !lst;
 	PMap.iter (fun n _ ->
 		lst := !lst @ [n];
@@ -1678,7 +1677,7 @@ and argument_list_from_locals include_this in_var l =
 	!lst
 
 and remove_internals args =
-	List.filter (fun a -> a = "»this" or '»' <> String.get a 0) args;
+	List.filter (fun a -> a = "__hx__this" || not (start_with a "__hx__")) args;
 
 and inline_block ctx e =
 		let index = ctx.inline_index in
@@ -1916,7 +1915,7 @@ let generate_field ctx static f =
 					(match follow f.cf_type with
 					| TFun _
 					| TDynamic _ ->
-						print ctx "static function %s() { $»args = func_get_args(); return call_user_func_array(self::$%s, $»args); }" name name;
+						print ctx "static function %s() { $args = func_get_args(); return call_user_func_array(self::$%s, $args); }" name name;
 						newline ctx;
 					| _ ->
 						()
@@ -1985,8 +1984,8 @@ let generate_inline_method ctx c m =
 	let in_value = (match ctx.in_value with Some _ -> true | _ -> false) in
 	let arguments = remove_internals (argument_list_from_locals m.ihasthis in_value ctx.locals) in
 	let arguments = match arguments with
-	| [h] when h = "this" -> ["»this"]
-	| h :: t when h = "this" -> "»this" :: t
+	| [h] when h = "this" -> ["__hx__this"]
+	| h :: t when h = "this" -> "__hx__this" :: t
 	| _ -> arguments
 	in
 
@@ -2004,21 +2003,10 @@ let generate_inline_method ctx c m =
 
 	(* blocks *)
 	if ctx.com.debug then begin
-		(*--php-prefix*)
-(*		print_endline (s_path_haxe c.cl_path); *)
-		spr ctx "$»spos = $GLOBALS['%s']->length";
+		spr ctx "$__hx__spos = $GLOBALS['%s']->length";
 		newline ctx;
 	end;
-(*
-	if ctx.com.debug then begin
-		(*--php-prefix*)
-		print_endline (s_path_haxe c.cl_path);
-		print ctx "\t$GLOBALS['%s']->push('%s:lambda_%d')" "%s" (s_path_haxe c.cl_path) m.iindex;
-		newline ctx;
-		spr ctx "\t$»spos = $GLOBALS['%s']->length";
-		newline ctx;
-	end;
-*)
+
 	gen_expr ctx m.iexpr;
 	block();
 	old();
@@ -2071,12 +2059,12 @@ let generate_class ctx c =
 	(match c.cl_dynamic with
 		| Some _ when not c.cl_interface && not (super_has_dynamic c) ->
 			newline ctx;
-			spr ctx "public $__dynamics = array();\n\tpublic function __get($n) {\n\t\tif(isset($this->__dynamics[$n]))\n\t\t\treturn $this->__dynamics[$n];\n\t}\n\tpublic function __set($n, $v) {\n\t\t$this->__dynamics[$n] = $v;\n\t}\n\tpublic function __call($n, $a) {\n\t\tif(isset($this->__dynamics[$n]) && is_callable($this->__dynamics[$n]))\n\t\t\treturn call_user_func_array($this->__dynamics[$n], $a);\n\t\tif('toString' == $n)\n\t\t\treturn $this->__toString();\n\t\tthrow new HException(\"Unable to call «\".$n.\"»\");\n\t}"
+			spr ctx "public $__dynamics = array();\n\tpublic function __get($n) {\n\t\tif(isset($this->__dynamics[$n]))\n\t\t\treturn $this->__dynamics[$n];\n\t}\n\tpublic function __set($n, $v) {\n\t\t$this->__dynamics[$n] = $v;\n\t}\n\tpublic function __call($n, $a) {\n\t\tif(isset($this->__dynamics[$n]) && is_callable($this->__dynamics[$n]))\n\t\t\treturn call_user_func_array($this->__dynamics[$n], $a);\n\t\tif('toString' == $n)\n\t\t\treturn $this->__toString();\n\t\tthrow new HException(\"Unable to call <\".$n.\">\");\n\t}"
 		| Some _
 		| _ ->
 			if List.length ctx.dynamic_methods > 0 then begin
 				newline ctx;
-				spr ctx "public function __call($m, $a) {\n\t\tif(isset($this->$m) && is_callable($this->$m))\n\t\t\treturn call_user_func_array($this->$m, $a);\n\t\telse if(isset($this->__dynamics[$m]) && is_callable($this->__dynamics[$m]))\n\t\t\treturn call_user_func_array($this->__dynamics[$m], $a);\n\t\telse if('toString' == $m)\n\t\t\treturn $this->__toString();\n\t\telse\n\t\t\tthrow new HException('Unable to call «'.$m.'»');\n\t}";
+				spr ctx "public function __call($m, $a) {\n\t\tif(isset($this->$m) && is_callable($this->$m))\n\t\t\treturn call_user_func_array($this->$m, $a);\n\t\telse if(isset($this->__dynamics[$m]) && is_callable($this->__dynamics[$m]))\n\t\t\treturn call_user_func_array($this->__dynamics[$m], $a);\n\t\telse if('toString' == $m)\n\t\t\treturn $this->__toString();\n\t\telse\n\t\t\tthrow new HException('Unable to call <'.$m.'>');\n\t}";
 			end;
 	);
 
@@ -2126,7 +2114,7 @@ let createmain com e =
 		com = com;
 		stack = stack_init com false;
 		tabs = "";
-		ch = open_out_bin (com.file ^ "/" ^ filename);
+		ch = open_out (com.file ^ "/" ^ filename);
 		path = ([], "");
 		buf = Buffer.create (1 lsl 14);
 		in_value = None;

+ 0 - 13
std/haxe/io/Bytes.hx

@@ -72,7 +72,6 @@ class Bytes {
 		#if neko
 		try untyped __dollar__sblit(b,pos,src.b,srcpos,len) catch( e : Dynamic ) throw Error.OutsideBounds;
 		#elseif php
-		// TODO: test me
 		b = untyped __php__("substr($this->b, 0, $pos) . substr($src->b, $srcpos, $len) . substr($this->b, $pos+$len)"); //__call__("substr", b, 0, pos)+__call__("substr", src.b, srcpos, len)+__call__("substr", b, pos+len);
 		#elseif flash9
 		b.position = pos;
@@ -109,7 +108,6 @@ class Bytes {
 		b.readBytes(b2,0,len);
 		return new Bytes(len,b2);
 		#elseif php
-		// TODO: test me
 		return new Bytes(len, untyped __call__("substr", b, pos, len));
 		#elseif java
 		var newarr = new java.NativeArray(len);
@@ -172,9 +170,7 @@ class Bytes {
 		b.position = pos;
 		return b.readUTFBytes(len);
 		#elseif php
-		// TODO: test me
 		return untyped __call__("substr", b, pos, len);
-//		return untyped __call__("call_user_func_array", "pack", __call__("array_merge", __call__("array", "C*"), __call__("array_slice", b.»a, pos, len)));
 		#elseif cpp
 		var result:String="";
 		untyped __global__.__hxcpp_string_of_bytes(b,result,pos,len);
@@ -219,9 +215,7 @@ class Bytes {
 		b.position = 0;
 		return b.readUTFBytes(length);
 		#elseif php
-		// TODO: test me
 		return cast b;
-//		return untyped __call__("call_user_func_array", "pack", __call__("array_merge", __call__("array", "C*"), b.»a));
 		#elseif cs
 		return cs.system.text.Encoding.UTF8.GetString(b, 0, length);
 		#elseif java
@@ -261,14 +255,7 @@ class Bytes {
 		b.length = length;
 		return new Bytes(length,b);
 		#elseif php
-		// TODO: test me
 		return new Bytes(length, untyped __call__("str_repeat", __call__("chr", 0), length));
-		/*
-		if(length > 0)
-			return new Bytes(length, untyped __call__("new _hx_array", __call__("array_fill", 0, length, 0)));
-		else
-			return new Bytes(0, untyped __call__("new _hx_array", __call__("array")));
-		*/
 		#elseif cpp
 		var a = new BytesData();
 		if (length>0) a[length-1] = untyped 0;

+ 60 - 62
std/php/Boot.hx

@@ -46,33 +46,33 @@ function _hx_anonymous($arr = array()) {
 }
 
 class _hx_array implements ArrayAccess, IteratorAggregate {
-	var $»a;
+	var $a;
 	var $length;
 	function __construct($a = array()) {
-		$this->»a = $a;
+		$this->a = $a;
 		$this->length = count($a);
 	}
 
 	function concat($a) {
-		return new _hx_array(array_merge($this->»a, $a->»a));
+		return new _hx_array(array_merge($this->a, $a->a));
 	}
 
 	function copy() {
-		return new _hx_array($this->»a);
+		return new _hx_array($this->a);
 	}
 
 	function &get($index) {
-		if(isset($this->»a[$index])) return $this->»a[$index];
+		if(isset($this->a[$index])) return $this->a[$index];
 		return null;
 	}
 
 	function insert($pos, $x) {
-		array_splice($this->»a, $pos, 0, array($x));
+		array_splice($this->a, $pos, 0, array($x));
 		$this->length++;
 	}
 
 	function iterator() {
-		return new _hx_array_iterator($this->»a);
+		return new _hx_array_iterator($this->a);
 	}
 
 	function getIterator() {
@@ -80,25 +80,25 @@ class _hx_array implements ArrayAccess, IteratorAggregate {
 	}
 
 	function join($sep) {
-		return implode($sep, array_map('_hx_string_rec',$this->»a,array()));
+		return implode($sep, array_map('_hx_string_rec',$this->a,array()));
 	}
 
 	function pop() {
-		$r = array_pop($this->»a);
-		$this->length = count($this->»a);
+		$r = array_pop($this->a);
+		$this->length = count($this->a);
 		return $r;
 	}
 
 	function push($x) {
-		$this->»a[] = $x;
+		$this->a[] = $x;
 		return ++$this->length;
 	}
 
 	function remove($x) {
-		for($i = 0; $i < count($this->»a); $i++)
-			if($this->»a[$i] === $x) {
-				unset($this->»a[$i]);
-				$this->»a = array_values($this->»a);
+		for($i = 0; $i < count($this->a); $i++)
+			if($this->a[$i] === $x) {
+				unset($this->a[$i]);
+				$this->a = array_values($this->a);
 				$this->length--;
 				return true;
 			}
@@ -106,8 +106,8 @@ class _hx_array implements ArrayAccess, IteratorAggregate {
 	}
 
 	function removeAt($pos) {
-		if(array_key_exists($pos, $this->»a)) {
-			unset($this->»a[$pos]);
+		if(array_key_exists($pos, $this->a)) {
+			unset($this->a[$pos]);
 			$this->length--;
 			return true;
 		} else
@@ -115,35 +115,35 @@ class _hx_array implements ArrayAccess, IteratorAggregate {
 	}
 
 	function reverse() {
-		$this->»a = array_reverse($this->»a, false);
+		$this->a = array_reverse($this->a, false);
 	}
 
 	function shift() {
-		$r = array_shift($this->»a);
-		$this->length = count($this->»a);
+		$r = array_shift($this->a);
+		$this->length = count($this->a);
 		return $r;
 	}
 
 	function slice($pos, $end) {
 		if($end === null)
-			return new _hx_array(array_slice($this->»a, $pos));
+			return new _hx_array(array_slice($this->a, $pos));
 		else
-			return new _hx_array(array_slice($this->»a, $pos, $end-$pos));
+			return new _hx_array(array_slice($this->a, $pos, $end-$pos));
 	}
 
 	function sort($f) {
-		usort($this->»a, $f);
+		usort($this->a, $f);
 	}
 
 	function splice($pos, $len) {
 		if($len < 0) $len = 0;
-		$nh = new _hx_array(array_splice($this->»a, $pos, $len));
-		$this->length = count($this->»a);
+		$nh = new _hx_array(array_splice($this->a, $pos, $len));
+		$this->length = count($this->a);
 		return $nh;
 	}
 
 	function toString() {
-		return '['.implode(',', array_map('_hx_string_rec',$this->»a,array())).']';
+		return '['.implode(',', array_map('_hx_string_rec',$this->a,array())).']';
 	}
 
 	function __toString() {
@@ -151,34 +151,34 @@ class _hx_array implements ArrayAccess, IteratorAggregate {
 	}
 
 	function unshift($x) {
-		array_unshift($this->»a, $x);
+		array_unshift($this->a, $x);
 		$this->length++;
 	}
 
 	function map($f) {
-		return new _hx_array(array_map($f, $this->»a));
+		return new _hx_array(array_map($f, $this->a));
 	}
 
 	function filter($f) {
-		return new _hx_array(array_filter($this->»a,$f));
+		return new _hx_array(array_filter($this->a,$f));
 	}
 
 	// ArrayAccess methods:
 	function offsetExists($offset) {
-		return isset($this->»a[$offset]);
+		return isset($this->a[$offset]);
 	}
 
 	function offsetGet($offset) {
-		if(isset($this->»a[$offset])) return $this->»a[$offset];
+		if(isset($this->a[$offset])) return $this->a[$offset];
 		return null;
 	}
 
 	function offsetSet($offset, $value) {
 		if($this->length <= $offset) {
-			$this->»a = array_merge($this->»a, array_fill(0, $offset+1-$this->length, null));
+			$this->a = array_merge($this->a, array_fill(0, $offset+1-$this->length, null));
 			$this->length = $offset+1;
 		}
-		return $this->»a[$offset] = $value;
+		return $this->a[$offset] = $value;
 	}
 
 	function offsetUnset($offset) {
@@ -187,29 +187,29 @@ class _hx_array implements ArrayAccess, IteratorAggregate {
 }
 
 class _hx_array_iterator implements Iterator {
-	private $»a;
-	private $»i;
+	private $a;
+	private $i;
 	public function __construct($a) {
-		$this->»a = $a;
-		$this->»i = 0;
+		$this->a = $a;
+		$this->i = 0;
 	}
 
 	public function next() {
 		if(!$this->hasNext()) return null;
-		return $this->»a[$this->»i++];
+		return $this->a[$this->i++];
 	}
 
 	public function hasNext() {
-		return $this->»i < count($this->»a);
+		return $this->i < count($this->a);
 	}
 
 	public function current() {
 		if (!$this->hasNext()) return false;
-		return $this->»a[$this->»i];
+		return $this->a[$this->i];
 	}
 
 	public function key() {
-		return $this->»i;
+		return $this->i;
 	}
 
 	public function valid() {
@@ -217,10 +217,10 @@ class _hx_array_iterator implements Iterator {
 	}
 
 	public function rewind() {
-		$this->»i = 0;
+		$this->i = 0;
 	}
 	public function size() {
-		return count($this->»a);
+		return count($this->a);
 	}
 }
 
@@ -382,9 +382,7 @@ function _hx_get_object_vars($o) {
 	$arr = array();
 	for($i=0;$i<count($a); $i++)
 	{
-		$k = '' . $a[$i];
-		if(substr($k, 0, 1) != '»')
-			$arr[] = $k;
+		$arr[] = '' . $a[$i];
 	}
 	return $arr;
 }
@@ -444,33 +442,33 @@ function _hx_len($o) {
 }
 
 class _hx_list_iterator implements Iterator {
-	private $»h;
-	private $»list;
-	private $»counter;
+	private $h;
+	private $list;
+	private $counter;
 	public function __construct($list) {
-		$this->»list = $list;
+		$this->list = $list;
 		$this->rewind();
 	}
 
 	public function next() {
-		if($this->»h == null) return null;
-		$this->»counter++;
-		$x = $this->»h[0];
-		$this->»h = $this->»h[1];
+		if($this->h == null) return null;
+		$this->counter++;
+		$x = $this->h[0];
+		$this->h = $this->h[1];
 		return $x;
 	}
 
 	public function hasNext() {
-		return $this->»h != null;
+		return $this->h != null;
 	}
 
 	public function current() {
 		if (!$this->hasNext()) return null;
-		return $this->»h[0];
+		return $this->h[0];
 	}
 
 	public function key() {
-		return $this->»counter;
+		return $this->counter;
 	}
 
 	public function valid() {
@@ -478,12 +476,12 @@ class _hx_list_iterator implements Iterator {
 	}
 
 	public function rewind() {
-		$this->»counter = -1;
-		$this->»h = $this->»list->h;
+		$this->counter = -1;
+		$this->h = $this->list->h;
 	}
 
 	public function size() {
-		return $this->»list->length;
+		return $this->list->length;
 	}
 }
 
@@ -609,12 +607,12 @@ function _hx_string_rec($o, $s) {
 		}
 	}
 	if(is_string($o)) {
-		if(_hx_is_lambda($o)) return '«function»';
+		if(_hx_is_lambda($o)) return '<function>';
 //		if(strlen($s) > 0)    return '\"' . str_replace('\"', '\\\"', $o) . '\"';
 		else                  return $o;
 	}
 	if(is_array($o)) {
-		if(is_callable($o)) return '«function»';
+		if(is_callable($o)) return '<function>';
 		$str = '[';
 		$s .= \"\t\";
 		$first = true;

+ 1 - 1
std/php/Lib.hx

@@ -69,7 +69,7 @@ class Lib {
 	}
 
 	public static function toPhpArray(a : Array<Dynamic>) : NativeArray {
-		return untyped __field__(a, '»a');
+		return untyped __field__(a, 'a');
 	}
 
 	public static inline function toHaxeArray(a : NativeArray) : Array<Dynamic> {

+ 2 - 2
std/php/_std/Reflect.hx

@@ -55,9 +55,9 @@
 
 	public static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : Dynamic untyped {
 		if (__call__("is_string", o) && !__call__("is_array", func)) {
-			return __call__("call_user_func_array", field(o, func), __field__(args, "»a"));
+			return __call__("call_user_func_array", field(o, func), __field__(args, "a"));
 		}
-		return __call__("call_user_func_array", __call__("is_callable", func) ? func : __call__("array", o, func), (null == args ? __call__("array") : __field__(args, "»a")));
+		return __call__("call_user_func_array", __call__("is_callable", func) ? func : __call__("array", o, func), (null == args ? __call__("array") : __field__(args, "a")));
 	}
 
 	public static function fields( o : Dynamic ) : Array<String> {

+ 1 - 1
std/php/_std/Type.hx

@@ -99,7 +99,7 @@ enum ValueType {
 		if(cl.__qname__ == 'String') return args[0];
 		var c = cl.__rfl__();
 		if(c == null) return null;
-		return __php__("$inst = $c->getConstructor() ? $c->newInstanceArgs($args->»a) : $c->newInstanceArgs()");
+		return __php__("$inst = $c->getConstructor() ? $c->newInstanceArgs($args->a) : $c->newInstanceArgs()");
 	}
 
 	public static function createEmptyInstance<T>( cl : Class<T> ) : T untyped {