Ver Fonte

- fixed issue 193

Franco Ponticelli há 14 anos atrás
pai
commit
16f095b851
4 ficheiros alterados com 20 adições e 15 exclusões
  1. 13 8
      genphp.ml
  2. 4 4
      std/php/_std/EReg.hx
  3. 2 2
      std/php/_std/Std.hx
  4. 1 1
      std/php/_std/Type.hx

+ 13 - 8
genphp.ml

@@ -518,16 +518,19 @@ and gen_call ctx e el =
 		gen_value ctx e1;
 		spr ctx " === ";
 		gen_value ctx e2
-	| TLocal _, el
-	| TFunction _, el ->
+	| TLocal _, []
+	| TFunction _, []
+	| TCall _, []
+	| TBlock _, [] ->
 		ctx.is_call <- true;
-		spr ctx "call_user_func_array(";
+		spr ctx "call_user_func(";
 		gen_value ctx e;
 		ctx.is_call <- false;
-		spr ctx ", array(";
-		concat ctx ", " (gen_value ctx) el;
-		spr ctx "))"
-	| TCall (x,_), el when (match x.eexpr with | TLocal _ -> false | _ -> true) ->
+		spr ctx ")";
+	| TLocal _, el
+	| TFunction _, el
+	| TCall _, el
+	| TBlock _, el ->
 		ctx.is_call <- true;
 		spr ctx "call_user_func_array(";
 		gen_value ctx e;
@@ -535,7 +538,8 @@ and gen_call ctx e el =
 		spr ctx ", array(";
 		concat ctx ", " (gen_value ctx) el;
 		spr ctx "))"
-	| TBlock _, el ->
+(*
+	| TCall (x,_), el when (match x.eexpr with | TLocal _ -> false | _ -> true) ->
 		ctx.is_call <- true;
 		spr ctx "call_user_func_array(";
 		gen_value ctx e;
@@ -543,6 +547,7 @@ and gen_call ctx e el =
 		spr ctx ", array(";
 		concat ctx ", " (gen_value ctx) el;
 		spr ctx "))"
+*)
 	| _ ->
 		ctx.is_call <- true;
 		gen_value ctx e;

+ 4 - 4
std/php/_std/EReg.hx

@@ -40,11 +40,11 @@
 		if( global )
 			opt = a.join("");
 		this.options = opt;
-		this.re = "/" + untyped __php__("str_replace")("/", "\\/", r) + "/" + opt;
+		this.re = "/" + untyped __call__("str_replace", "/", "\\/", r) + "/" + opt;
 	}
 
 	public function match( s : String ) : Bool {
-		var p : Int = untyped __php__("preg_match")(re, s, matches, __php__("PREG_OFFSET_CAPTURE"));
+		var p : Int = untyped __call__("preg_match", re, s, matches, __php__("PREG_OFFSET_CAPTURE"));
 		if(p > 0)
 			last = s;
 		else
@@ -68,12 +68,12 @@
 
 	public function matchedRight() : String {
 		if( untyped __call__("count", matches) == 0 ) throw "No string matched";
-		var x : Int = untyped __php__("$this->matches[0][1]") + __php__("strlen")(__php__("$this->matches[0][0]"));
+		var x : Int = untyped __php__("$this->matches[0][1]") + __call__("strlen",__php__("$this->matches[0][0]"));
 		return last.substr(x);
 	}
 
 	public function matchedPos() : { pos : Int, len : Int } {
-		return untyped { pos : __php__("$this->matches[0][1]"), len : __php__("strlen")(__php__("$this->matches[0][0]")) };
+		return untyped { pos : __php__("$this->matches[0][1]"), len : __call__("strlen",__php__("$this->matches[0][0]")) };
 	}
 
 	public function split( s : String ) : Array<String> {

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

@@ -34,11 +34,11 @@
 	}
 
 	public inline static function int( x : Float ) : Int {
-		return untyped __php__("intval")(x);
+		return untyped __call__("intval", x);
 	}
 
 	public static function parseInt( x : String ) : Null<Int> {
-		untyped if (!__php__("is_numeric")(x)) {
+		untyped if (!__call__("is_numeric", x)) {
 			var matches = null;
 			__call__('preg_match', '/\\d+/', x, matches);
 			return __call__("count", matches) == 0 ? null : __call__('intval', matches[0]);

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

@@ -40,7 +40,7 @@ enum ValueType {
 	}
 
 	public static function getSuperClass( c : Class<Dynamic> ) : Class<Dynamic> {
-		var s = untyped __php__("get_parent_class")(c.__tname__);
+		var s = untyped __call__("get_parent_class", c.__tname__);
 		if(s == false)
 			return null;
 		else