(push (cons sexp jsvar) *literal-table*)
(toplevel-compilation `(var (,jsvar ,dumped)))
(when (keywordp sexp)
- (toplevel-compilation `(= ,(get jsvar "value") ,jsvar)))
+ (toplevel-compilation `(= (get ,jsvar "value") ,jsvar)))
jsvar)))))))
(eval (cons 'progn body)))
;; `load-toplevel' is given, then just compile the subforms as usual.
(when (find :load-toplevel situations)
- (convert `(progn ,@body))))
+ (convert-toplevel `(progn ,@body) *multiple-value-p*)))
((find :execute situations)
(convert `(progn ,@body) *multiple-value-p*))
(t
(convert nil))))
-(define-compilation eval-when-compile (&rest body)
- (if *compiling-file*
- (progn
- (eval (cons 'progn body))
- (convert 0))
- (convert `(progn ,@body))))
-
(defmacro define-transformation (name args form)
`(define-compilation ,name ,args
(convert ,form)))
,@(mapcar (lambda (key)
`(progn
(= obj (property obj (call |xstring| ,(convert key))))
- (if (=== object undefined)
+ (if (=== obj undefined)
(throw "Impossible to set object property."))))
(butlast keys))
(var (tmp
(define-builtin in (key object)
`(bool (in (call |xstring| ,key) ,object)))
+(define-builtin delete-property (key object)
+ `(selfcall
+ (delete (property ,object (call |xstring| ,key)))))
+
(define-builtin map-for-in (function object)
`(selfcall
(var (f ,function)
#+jscl((symbolp function)
`(call ,(convert `#',function) ,@arglist))
((and (consp function) (eq (car function) 'lambda))
- `(call ,(convert `#',function) ,@arglist))
+ `(call ,(convert `(function ,function)) ,@arglist))
((and (consp function) (eq (car function) 'oget))
`(call |js_to_lisp|
(call ,(reduce (lambda (obj p)
`(property ,obj (call |xstring| ,p)))
(mapcar #'convert (cdr function)))
,@(mapcar (lambda (s)
- `(call |lisp_to_js| ,s))
+ `(call |lisp_to_js| ,(convert s)))
args))))
(t
(error "Bad function descriptor")))))
(when expandedp
(return-from convert-toplevel (convert-toplevel sexp multiple-value-p))))
;; Process as toplevel
- (let ((*toplevel-compilations* nil))
+ (let ((*convert-level* -1)
+ (*toplevel-compilations* nil))
(cond
;; Non-empty toplevel progn
((and (consp sexp)