Преглед на файлове

Int64 fromString => parseString
See https://github.com/HaxeFoundation/haxe/pull/4179#issuecomment-125653862

Andy Li преди 10 години
родител
ревизия
cc13b2be0c
променени са 6 файла, в които са добавени 17 реда и са изтрити 17 реда
  1. 2 2
      std/cpp/_std/haxe/Int64.hx
  2. 2 2
      std/cs/_std/haxe/Int64.hx
  3. 2 2
      std/haxe/Int64.hx
  4. 1 1
      std/haxe/Int64Helper.hx
  5. 2 2
      std/java/_std/haxe/Int64.hx
  6. 8 8
      tests/unit/src/unit/TestInt64.hx

+ 2 - 2
std/cpp/_std/haxe/Int64.hx

@@ -120,8 +120,8 @@ abstract Int64( __Int64 ) from __Int64 to __Int64
 		return untyped __cpp__("String( ({0}).get() )", this);
 		return untyped __cpp__("String( ({0}).get() )", this);
 	}
 	}
 
 
-	public static function fromString( sParam : String ) : Int64 {
-		return Int64Helper.fromString( sParam );
+	public static function parseString( sParam : String ) : Int64 {
+		return Int64Helper.parseString( sParam );
 	}
 	}
 
 
 	public static function fromFloat( f : Float ) : Int64 {
 	public static function fromFloat( f : Float ) : Int64 {

+ 2 - 2
std/cs/_std/haxe/Int64.hx

@@ -95,8 +95,8 @@ abstract Int64(__Int64) from __Int64 to __Int64
 	private inline function toString() : String
 	private inline function toString() : String
 		return '$this';
 		return '$this';
 
 
-	public static function fromString( sParam : String ) : Int64 {
-		return Int64Helper.fromString( sParam );
+	public static function parseString( sParam : String ) : Int64 {
+		return Int64Helper.parseString( sParam );
 	}
 	}
 
 
 	public static function fromFloat( f : Float ) : Int64 {
 	public static function fromFloat( f : Float ) : Int64 {

+ 2 - 2
std/haxe/Int64.hx

@@ -150,8 +150,8 @@ abstract Int64(__Int64) from __Int64 to __Int64
 		return str;
 		return str;
 	}
 	}
 
 
-	public static inline function fromString( sParam : String ) : Int64 {
-		return Int64Helper.fromString( sParam );
+	public static inline function parseString( sParam : String ) : Int64 {
+		return Int64Helper.parseString( sParam );
 	}
 	}
 
 
 	public static inline function fromFloat( f : Float ) : Int64 {
 	public static inline function fromFloat( f : Float ) : Int64 {

+ 1 - 1
std/haxe/Int64Helper.hx

@@ -27,7 +27,7 @@ import StringTools;
 
 
 class Int64Helper {
 class Int64Helper {
 
 
-	public static function fromString( sParam : String ) : Int64 {
+	public static function parseString( sParam : String ) : Int64 {
 		var base = Int64.ofInt(10);
 		var base = Int64.ofInt(10);
 		var current = Int64.ofInt(0);
 		var current = Int64.ofInt(0);
 		var multiplier = Int64.ofInt(1);
 		var multiplier = Int64.ofInt(1);

+ 2 - 2
std/java/_std/haxe/Int64.hx

@@ -95,9 +95,9 @@ abstract Int64(__Int64) from __Int64 to __Int64
 	private inline function toString() : String
 	private inline function toString() : String
 		return '$this';
 		return '$this';
 
 
-	public static function fromString( sParam : String ) : Int64 {
+	public static function parseString( sParam : String ) : Int64 {
 		// can this be done?: return new Int64( java.lang.Long.LongClass.parseLong( sParam ) );
 		// can this be done?: return new Int64( java.lang.Long.LongClass.parseLong( sParam ) );
-		return Int64Helper.fromString( sParam );
+		return Int64Helper.parseString( sParam );
 	}
 	}
 
 
 	public static function fromFloat( f : Float ) : Int64 {
 	public static function fromFloat( f : Float ) : Int64 {

+ 8 - 8
tests/unit/src/unit/TestInt64.hx

@@ -452,20 +452,20 @@ class TestInt64 extends Test {
 		}
 		}
 	}
 	}
 
 
-	public function testFromString()
+	public function testParseString()
 	{
 	{
 		for (v in ["0", "1", "-1", "9223372036854775807", "-9223372036854775807"]) {
 		for (v in ["0", "1", "-1", "9223372036854775807", "-9223372036854775807"]) {
-			eq(Std.string(fromString(v)), v);
+			eq(Std.string(parseString(v)), v);
 		}
 		}
 
 
 		// trims the string:
 		// trims the string:
-		eq("-23", Std.string(fromString("  -23 ")));
+		eq("-23", Std.string(parseString("  -23 ")));
 
 
 
 
 		// overflow and underflow raise exceptions:
 		// overflow and underflow raise exceptions:
 		try
 		try
 		{
 		{
-			fromString("9223372036854775808");
+			parseString("9223372036854775808");
 			f(true);
 			f(true);
 		}
 		}
 		catch (e:Dynamic)
 		catch (e:Dynamic)
@@ -475,7 +475,7 @@ class TestInt64 extends Test {
 
 
 		try
 		try
 		{
 		{
-			fromString("-9223372036854775809");
+			parseString("-9223372036854775809");
 			f(true);
 			f(true);
 		}
 		}
 		catch (e:Dynamic)
 		catch (e:Dynamic)
@@ -485,7 +485,7 @@ class TestInt64 extends Test {
 
 
 		try
 		try
 		{
 		{
-			fromString("--1");
+			parseString("--1");
 			f(true);
 			f(true);
 		}
 		}
 		catch (e:Dynamic)
 		catch (e:Dynamic)
@@ -495,7 +495,7 @@ class TestInt64 extends Test {
 
 
 		try
 		try
 		{
 		{
-			fromString("asd1");
+			parseString("asd1");
 			f(true);
 			f(true);
 		}
 		}
 		catch (e:Dynamic)
 		catch (e:Dynamic)
@@ -505,7 +505,7 @@ class TestInt64 extends Test {
 
 
 		try
 		try
 		{
 		{
-			fromString("1asdf");
+			parseString("1asdf");
 			f(true);
 			f(true);
 		}
 		}
 		catch (e:Dynamic)
 		catch (e:Dynamic)