]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge pull request #332 from bolivier/master
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 4 May 2016 11:46:04 +0000 (14:46 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 4 May 2016 11:46:04 +0000 (14:46 +0300)
Allow space before global declaration

js2-mode.el
tests/externs.el

index 9515e2703ce33fd56a81f5d6a674ff52756a02f3..238440c8f7a7f3582e44019f0ff5f8d180523e9b 100644 (file)
@@ -7264,7 +7264,7 @@ are ignored."
            when (and (eq 'block (js2-comment-node-format node))
                      (save-excursion
                        (goto-char (js2-node-abs-pos node))
-                       (looking-at "/\\*global ")))
+                       (looking-at "/\\* *global ")))
            append (js2-get-jslint-globals-in
                    (match-end 0)
                    (js2-node-abs-end node))))
index 40957f600cf85fa3636fb23573562c0a36b9d274..09a60a9d3f9e89cc817696fecae9415316871c45 100644 (file)
     (should (equal (js2-get-jslint-globals)
                    '("quux" "tee" "$")))))
 
+(ert-deftest js2-finds-jslint-globals-with-space ()
+  (with-temp-buffer
+    (insert "/* global foo, bar:false, baz:true")
+    (js2-mode)
+    (should (equal (js2-get-jslint-globals)
+                   '("foo" "bar" "baz")))))
+
 ;;;TODO
 ;; ensure that any symbols bound with the import syntax are added to the extern list
 ;; ensure that any symbols bound with the export syntax exist in the file scope