Browse Source

[js] use `+key` instead of `key | 0` in IntMap (fixes #10316)

Aleksandr Kuzmenko 4 years ago
parent
commit
a7ef93d5b2
2 changed files with 7 additions and 1 deletions
  1. 6 0
      extra/CHANGES.txt
  2. 1 1
      std/js/_std/haxe/ds/IntMap.hx

+ 6 - 0
extra/CHANGES.txt

@@ -1,3 +1,9 @@
+2021-XX-XX 4.2.4:
+
+	Bugfixes:
+
+	js : fixed IntMap for keys greater than 2^31 (#10316)
+
 2021-07-01 4.2.3:
 
 	General improvements:

+ 1 - 1
std/js/_std/haxe/ds/IntMap.hx

@@ -50,7 +50,7 @@ package haxe.ds;
 
 	public function keys():Iterator<Int> {
 		var a = [];
-		js.Syntax.code("for( var key in {0} ) if({0}.hasOwnProperty(key)) {1}.push(key | 0)", h, a);
+		js.Syntax.code("for( var key in {0} ) if({0}.hasOwnProperty(key)) {1}.push(+key)", h, a);
 		return a.iterator();
 	}