[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 9a8aaa9 28/49: Fix length of name in namespace-import node
From: |
Dmitry Gutov |
Subject: |
[elpa] master 9a8aaa9 28/49: Fix length of name in namespace-import nodes |
Date: |
Mon, 16 Jan 2017 15:35:48 +0000 (UTC) |
branch: master
commit 9a8aaa9c5ddc8f1bdef40446c45db1e218327406
Author: Mihai Bazon <address@hidden>
Commit: Mihai Bazon <address@hidden>
Fix length of name in namespace-import nodes
Should be `(- (js2-current-token-end) (js2-current-token-beg))` rather
than just `(js2-current-token-end)`.
Also change `if` to `cond` (seems easier to read in this case).
---
js2-mode.el | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index dc86321..8fdfb0e 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -8654,19 +8654,22 @@ imports or a namespace import that follows it.
"Parse a namespace import expression such as '* as bar'.
The current token must be js2-MUL."
(let ((beg (js2-current-token-beg)))
- (if (js2-match-contextual-kwd "as")
- (when (js2-must-match-prop-name "msg.syntax")
- (let ((node (make-js2-namespace-import-node
- :pos beg
- :len (- (js2-current-token-end) beg)
- :name (make-js2-name-node
- :pos (js2-current-token-beg)
- :len (js2-current-token-end)
- :name (js2-current-token-string)))))
- (js2-node-add-children node (js2-namespace-import-node-name node))
- node))
- (js2-unget-token)
- (js2-report-error "msg.syntax"))))
+ (cond
+ ((and (js2-match-contextual-kwd "as")
+ (js2-must-match-prop-name "msg.syntax"))
+ (let ((node (make-js2-namespace-import-node
+ :pos beg
+ :len (- (js2-current-token-end) beg)
+ :name (make-js2-name-node
+ :pos (js2-current-token-beg)
+ :len (- (js2-current-token-end)
+ (js2-current-token-beg))
+ :name (js2-current-token-string)))))
+ (js2-node-add-children node (js2-namespace-import-node-name node))
+ node))
+ (t
+ (js2-unget-token)
+ (js2-report-error "msg.syntax")))))
(defun js2-parse-from-clause ()
- [elpa] master 8e7ed39 06/49: Merge pull request #348 from dunn/makequiet, (continued)
- [elpa] master 8e7ed39 06/49: Merge pull request #348 from dunn/makequiet, Dmitry Gutov, 2017/01/16
- [elpa] master 357547c 09/49: js2-jsx-mode docstring fix, Dmitry Gutov, 2017/01/16
- [elpa] master 2b32301 15/49: Propertize regexp starting with /= correctly, Dmitry Gutov, 2017/01/16
- [elpa] master 68db1f5 05/49: Makefile: use -Q to avoid site-lisp loading, Dmitry Gutov, 2017/01/16
- [elpa] master 4e5babf 03/49: Merge pull request #345 from jacott/master, Dmitry Gutov, 2017/01/16
- [elpa] master 980eb3d 04/49: Support ES7 exponentiation, Dmitry Gutov, 2017/01/16
- [elpa] master 49f9761 08/49: js2-jsdoc-arg-tag-regexp: Recognize @module, Dmitry Gutov, 2017/01/16
- [elpa] master e45206b 11/49: js2-parse-class: Convert positions to relative for NAME and EXTENDS, too, Dmitry Gutov, 2017/01/16
- [elpa] master bea6942 13/49: Unbind js2-mode-show-node, Dmitry Gutov, 2017/01/16
- [elpa] master c0801b2 12/49: Propertize regexp literals like js-mode does, Dmitry Gutov, 2017/01/16
- [elpa] master 9a8aaa9 28/49: Fix length of name in namespace-import nodes,
Dmitry Gutov <=
- [elpa] master 44c289f 24/49: Copy edits, Dmitry Gutov, 2017/01/16
- [elpa] master b6d9301 17/49: Merge pull request #377 from XeCycle/memfn-delete, Dmitry Gutov, 2017/01/16
- [elpa] master 64ec0a2 14/49: Allow newline in globals declaration, Dmitry Gutov, 2017/01/16
- [elpa] master 2801681 26/49: Fix "pos" argument in template node constructors, Dmitry Gutov, 2017/01/16
- [elpa] master 712dfb0 29/49: Merge pull request #384 from mishoo/master, Dmitry Gutov, 2017/01/16
- [elpa] master df06798 23/49: Merge pull request #378 from JulianKniephoff/include-externs-locally, Dmitry Gutov, 2017/01/16
- [elpa] master 2a79649 33/49: Fix indentation after regexp in js2-old-indent.el, Dmitry Gutov, 2017/01/16
- [elpa] master f450de0 34/49: Handle destructuring assignments when classifying variables, Dmitry Gutov, 2017/01/16
- [elpa] master 90e37cd 45/49: Merge pull request #397 from lelit/issue393, Dmitry Gutov, 2017/01/16
- [elpa] master 9b63a13 16/49: Special methods should allow keywords as names, Dmitry Gutov, 2017/01/16