소스 검색

Merge pull request #2683 from nadako/flash8_array_splice

[flash8] fix Array.splice not returning empty array on negative len
Simon Krajewski 11 년 전
부모
커밋
51e35809f6
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      std/flash8/Boot.hx

+ 6 - 1
std/flash8/Boot.hx

@@ -224,8 +224,13 @@ class Boot {
 		if( !g.haxeInitDone ) {
 			g.haxeInitDone = true;
 			Array.prototype["copy"] = Array.prototype["slice"];
+			var splice:Dynamic = Array.prototype["splice"];
+			Array.prototype["splice"] = function(p, l) {
+				if (l <= 0) return [];
+				return splice.call(__this__, p, l);
+			}
 			Array.prototype["insert"] = function(i,x) {
-				__this__["splice"](i,0,x);
+				splice.call(__this__, i, 0, x);
 			};
 			Array.prototype["remove"] = function(obj) {
 				var i = 0;