Aurel 3 år sedan
förälder
incheckning
a41280ea62
2 ändrade filer med 10 tillägg och 1 borttagningar
  1. 1 1
      src/generators/genjs.ml
  2. 9 0
      tests/unit/src/unit/issues/Issue10754.hx

+ 1 - 1
src/generators/genjs.ml

@@ -2082,7 +2082,7 @@ let generate com =
 		newline ctx;
 	end;
 	if has_feature ctx "use.$arrayPush" then begin
-		print ctx "function $arrayPush(x) { this.push(x); }";
+		print ctx "function $arrayPush(x) { return this.push(x); }";
 		newline ctx
 	end;
 	if has_feature ctx "$global.$haxeUID" then begin

+ 9 - 0
tests/unit/src/unit/issues/Issue10754.hx

@@ -0,0 +1,9 @@
+package unit.issues;
+
+class Issue10754 extends Test {
+	function test() {
+		var a = [0, 1, 2];
+		var boundPush = a.push.bind();
+		eq(boundPush(3), 4);
+	}
+}