fix array bugs in ecmascript
authorAndy Wingo <wingo@pobox.com>
Wed, 31 Mar 2010 20:31:11 +0000 (22:31 +0200)
committerAndy Wingo <wingo@pobox.com>
Wed, 31 Mar 2010 20:31:11 +0000 (22:31 +0200)
* module/language/ecmascript/array.scm (pput, *array-prototype*): Fix
  bugs in ecmascript array runtime.

module/language/ecmascript/array.scm

index e9fc3c6f45cdd25545c81c16e9b76f2ffa9a31ed..99703458411876e4260869b30c7b166c701b8564 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ECMAScript for Guile
 
-;; Copyright (C) 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
   (cond ((and (integer? p) (exact? p) (>= 0 p))
          (let ((vect (js-array-vector o)))
            (if (< p (vector-length vect))
-               (vector-set! vect p)
+               (vector-set! vect p v)
                ;; Fixme: round up to powers of 2?
                (let ((new (make-vector (1+ p) 0)))
                  (vector-move-left! vect 0 (vector-length vect) new 0)
                  (set! (js-array-vector o) new)
-                 (vector-set! new p)))))
+                 (vector-set! new p v)))))
         ((or (and (symbol? p) (eq? p 'length))
              (and (string? p) (string=? p "length")))
          (let ((vect (js-array-vector o)))
@@ -93,7 +93,7 @@
             ((is-a? (car objs) <js-array-object>)
              (let ((v (js-array-vector (car objs))))
                (vector-move-left! v 0 (vector-length v)
-                                  rv i (+ i (vector-length v)))
+                                  rv i)
                (lp (cdr objs) (+ i (vector-length v)))))
             (else
              (error "generic array concats not yet implemented"))))))