Skip to content

Commit

Permalink
Patch lisp_simple_error to print stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel committed Mar 19, 2012
1 parent 92c182c commit e3489da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 0 additions & 2 deletions browser.virtua
@@ -1,5 +1,3 @@
(set-setter! js-global (lambda (val name) (set-js-global! name val))) ;; doubleplusungood

(def alert (js-global "alert"))

(def *window* (js-global "window")) ;; eww
Expand Down
1 change: 0 additions & 1 deletion repl.virtua
Expand Up @@ -64,7 +64,6 @@
(lambda (exc) #t)
(lambda (exc)
(print (make-repl-error exc))
(print-stack-trace (stack-frame))
(return-from exit #f))
(lambda ()
(def input (get-slot (getElementById *document* "lisp_line") "value"))
Expand Down
8 changes: 8 additions & 0 deletions standard.virtua
Expand Up @@ -148,6 +148,7 @@

(defun setter (obj) (get-slot obj "setter"))
(defun set-setter! (obj setter) (set-slot! obj "setter" setter))
(set-setter! js-global (lambda (val name) (set-js-global! name val))) ; erm

(defun define-js-method (name)
(def js-method (lambda (rcv . args)
Expand Down Expand Up @@ -293,6 +294,8 @@
(strcat (to-string kar) " . " (to-string kdr)))))
(strcat "(" (pair-to-string p) ")"))

;;;; Debugging

(defmethod to-string ((frm Stack-Frame))
(strcat (to-string (get-slot frm "cmb")) " "
(to-string (get-slot frm "otree"))))
Expand Down Expand Up @@ -422,6 +425,11 @@

)

(set! (js-global "lisp_simple_error")
(js-function (lambda (msg)
(print-stack-trace (stack-frame))
(js-throw msg))))

;; Permission is hereby granted, free of charge, to any person
;; obtaining a copy of this software and associated documentation
;; files (the "Software"), to deal in the Software without
Expand Down

0 comments on commit e3489da

Please sign in to comment.