Browse Source

- php : aligned use of StringTools.fastCodeAt/isEOF

Franco Ponticelli 14 years ago
parent
commit
c96dea7c75
2 changed files with 5 additions and 5 deletions
  1. 3 3
      genphp.ml
  2. 2 2
      std/php/_std/StringTools.hx

+ 3 - 3
genphp.ml

@@ -604,11 +604,11 @@ and gen_string_call ctx s e el =
 		concat ctx ", " (gen_value ctx) el;
 		concat ctx ", " (gen_value ctx) el;
 		spr ctx ")"
 		spr ctx ")"
 	| "cca" ->
 	| "cca" ->
-		spr ctx "ord(";
+		spr ctx "ord(substr(";
 		gen_value ctx e;
 		gen_value ctx e;
-		spr ctx "{";
+		spr ctx ",";
 		concat ctx ", " (gen_value ctx) el;
 		concat ctx ", " (gen_value ctx) el;
-		spr ctx "})"
+		spr ctx ",1))"
 	| "charCodeAt" ->
 	| "charCodeAt" ->
 		spr ctx "_hx_char_code_at(";
 		spr ctx "_hx_char_code_at(";
 		gen_value ctx e;
 		gen_value ctx e;

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

@@ -88,11 +88,11 @@
 	}
 	}
 
 
 	public static inline function fastCodeAt( s : String, index : Int ) : Int {
 	public static inline function fastCodeAt( s : String, index : Int ) : Int {
-		return s.charCodeAt(index);
+		return untyped s.cca(index);
 	}
 	}
 
 
 	public static inline function isEOF( c : Int ) : Bool {
 	public static inline function isEOF( c : Int ) : Bool {
-		return c == null;
+		return untyped __physeq__(c, 0);
 	}
 	}
 
 
 }
 }