浏览代码

fixed __set.

Nicolas Cannasse 19 年之前
父节点
当前提交
635186852e
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      std/neko/NekoArray__.hx

+ 8 - 1
std/neko/NekoArray__.hx

@@ -265,7 +265,14 @@ class NekoArray__<T> implements Array<T> {
 	}
 
 	private function __set( pos, v ) {
-		untyped this.__a[pos] = v;
+		untyped {
+			var a = this.__a;
+			if( __dollar__asize(a) <= pos ) {
+				this.__resize(pos+1);
+				a = this.__a;
+			}
+			a[pos] = v;
+		}
 	}
 
 	private function __resize(l) {