]> code.delx.au - gnu-emacs-elpa/commitdiff
Declare exception symbol in the catch block
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 18 Feb 2011 21:05:37 +0000 (00:05 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 18 Feb 2011 21:05:37 +0000 (00:05 +0300)
js2-mode.el

index b66a9f0516ddc50bd5bfe9ee64ae7c8e9647843c..daea4ab46f4cc7bf7f55633e003c9fc442318e26 100644 (file)
@@ -7984,7 +7984,9 @@ Parses for, for-in, and for each-in statements."
         (if (js2-must-match js2-LP "msg.no.paren.catch")
             (setq lp (- js2-token-beg catch-pos)))
         (js2-must-match js2-NAME "msg.bad.catchcond")
+        (js2-push-scope (make-js2-scope))
         (setq var-name (js2-create-name-node))
+        (js2-define-symbol js2-LET (js2-name-node-name var-name) var-name t)
         (if (js2-match-token js2-IF)
             (setq guard-kwd (- js2-token-beg catch-pos)
                   catch-cond (js2-parse-expr))
@@ -8001,6 +8003,7 @@ Parses for, for-in, and for each-in statements."
                                               :block block
                                               :lp lp
                                               :rp rp))
+        (js2-pop-scope)
         (if (js2-must-match js2-RC "msg.no.brace.after.body")
             (setq try-end js2-token-beg))
         (setf (js2-node-len block) (- try-end (js2-node-pos block))