add not-entirely-correct VECTOR-PUSH-EXTEND
authorNikodemus Siivola <nikodemus@random-state.net>
Sun, 28 Apr 2013 13:40:52 +0000 (16:40 +0300)
committerDavid Vázquez <davazp@gmail.com>
Mon, 6 May 2013 12:59:35 +0000 (13:59 +0100)
Conflicts:
src/toplevel.lisp

src/compiler.lisp
src/toplevel.lisp

index 28918e3..cfe7020 100644 (file)
     (indent "r.push(" (ls-compile nil) ");" *newline*)
     "return r;" *newline*))
 
+;;; FIXME: should take optional min-extension.
+;;; FIXME: should use fill-pointer instead of the absolute end of array
+(define-builtin vector-push-extend (new vector)
+  (js!selfcall
+    "var v = " vector ";" *newline*
+    "v.push(" new ");" *newline*
+    "return v;"))
+
 (define-builtin arrayp (x)
   (js!bool
    (js!selfcall
index 81315e1..33e4a82 100644 (file)
@@ -74,7 +74,7 @@
           setq sixth some string string-upcase string= stringp subseq subst
           symbol-function symbol-name symbol-package symbol-plist
           symbol-value symbolp t tagbody tailp tenth third throw tree-equal
-          truncate unless unwind-protect values values-list variable warn when
+          truncate unless unwind-protect values values-list variable vector-push-extend warn when
           write-line write-string zerop))
 
 (setq *package* *user-package*)