X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler.lisp;h=78ab64c2517f1a9339df0fa2f1faa61214a14239;hb=a36e740ddc9ac3c56fe9fb990a624d1d611c3814;hp=96c4475552931e0a59dfb9658c475602585e862e;hpb=f33d4fe523a91d6075fc49f20eb1ecf46495f71d;p=jscl.git diff --git a/src/compiler.lisp b/src/compiler.lisp index 96c4475..78ab64c 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -759,12 +759,12 @@ (define-compilation catch (id &rest body) `(selfcall - (var (|id| ,(convert id))) + (var (id ,(convert id))) (try ,(convert-block body t)) (catch (|cf|) (if (and (== (get |cf| "type") "catch") - (== (get |cf| "id") |id|)) + (== (get |cf| "id") id)) ,(if *multiple-value-p* `(return (method-call |values| "apply" this (call |forcemv| (get |cf| "values")))) `(return (method-call |pv| "apply" this (call |forcemv| (get |cf| "values"))))) @@ -774,10 +774,10 @@ `(selfcall (var (|values| |mv|)) (throw (object - |type| "catch" - |id| ,(convert id) - |values| ,(convert value t) - |message| "Throw uncatched.")))) + "type" "catch" + "id" ,(convert id) + "values" ,(convert value t) + "message" "Throw uncatched.")))) (defun go-tag-p (x) (or (integerp x) (symbolp x))) @@ -848,12 +848,12 @@ (define-compilation unwind-protect (form &rest clean-up) `(selfcall - (var (|ret| ,(convert nil))) + (var (ret ,(convert nil))) (try - (= |ret| ,(convert form))) + (= ret ,(convert form))) (finally ,(convert-block clean-up)) - (return |ret|))) + (return ret))) (define-compilation multiple-value-call (func-form &rest forms) `(selfcall @@ -1344,7 +1344,13 @@ ((and (consp function) (eq (car function) 'lambda)) `(call ,(convert `#',function) ,@arglist)) ((and (consp function) (eq (car function) 'oget)) - `(call ,(convert function) ,@arglist)) + `(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)) + args)))) (t (error "Bad function descriptor"))))) @@ -1358,10 +1364,10 @@ (return ,(convert (car (last sexps)) *multiple-value-p*))) `(progn ,@(mapcar #'convert sexps))))) -(defun convert* (sexp &optional multiple-value-p) +(defun convert (sexp &optional multiple-value-p) (multiple-value-bind (sexp expandedp) (!macroexpand-1 sexp) (when expandedp - (return-from convert* (convert sexp multiple-value-p))) + (return-from convert (convert sexp multiple-value-p))) ;; The expression has been macroexpanded. Now compile it! (let ((*multiple-value-p* multiple-value-p)) (cond @@ -1395,9 +1401,6 @@ (t (error "How should I compile `~S'?" sexp)))))) -(defun convert (sexp &optional multiple-value-p) - (convert* sexp multiple-value-p)) - (defvar *compile-print-toplevels* nil)