Author: Andrews Medina <[email protected]>
Branch:
Changeset: r396:e2275b282ab9
Date: 2013-05-29 00:04 -0300
http://bitbucket.org/pypy/lang-js/changeset/e2275b282ab9/
Log: fixed translation.
diff --git a/js/builtins/array.py b/js/builtins/array.py
--- a/js/builtins/array.py
+++ b/js/builtins/array.py
@@ -56,10 +56,14 @@
o = this.ToObject()
from_index = get_arg(args, 0).ToUInt32()
to_index = get_arg(args, 1).ToUInt32()
- n = []
- for k in xrange(from_index, to_index):
- n.append(o.get(unicode(str(k))))
- return _w(n)
+ from js.object_space import object_space
+ n = object_space.new_array(length=_w(to_index-from_index))
+ from js.jsobj import put_property
+ index = 0
+ for item in xrange(from_index, to_index):
+ put_property(n, unicode(str(index)), o.get(unicode(str(item))))
+ index += 1
+ return n
# 15.4.4.7
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit