Skip to content

Commit

Permalink
Merge pull request #381 from mgiles/template-pos
Browse files Browse the repository at this point in the history
Fix "pos" argument in template node constructors
  • Loading branch information
dgutov committed Oct 16, 2016
2 parents 82bbd97 + 2801681 commit 91e722a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js2-mode.el
Expand Up @@ -3773,7 +3773,7 @@ You can tell the quote type by looking at the first character."
(:include js2-node)
(:constructor nil)
(:constructor make-js2-template-node (&key (type js2-TEMPLATE_HEAD)
beg len kids)))
pos len kids)))
"Template literal."
kids) ; `js2-string-node' is used for string segments, other nodes
; for substitutions inside.
Expand All @@ -3796,7 +3796,7 @@ You can tell the quote type by looking at the first character."
(:include js2-node)
(:constructor nil)
(:constructor make-js2-tagged-template-node (&key (type js2-TAGGED_TEMPLATE)
beg len tag template)))
pos len tag template)))
"Tagged template literal."
tag ; `js2-node' with the tag expression.
template) ; `js2-template-node' with the template.
Expand Down Expand Up @@ -10157,9 +10157,9 @@ Returns an expression tree that includes PN, the parent node."

(defun js2-parse-tagged-template (tag-node tpl-node)
"Parse tagged template expression."
(let* ((beg (js2-node-pos tag-node))
(pn (make-js2-tagged-template-node :beg beg
:len (- (js2-current-token-end) beg)
(let* ((pos (js2-node-pos tag-node))
(pn (make-js2-tagged-template-node :pos pos
:len (- (js2-current-token-end) pos)
:tag tag-node
:template tpl-node)))
(js2-node-add-children pn tag-node tpl-node)
Expand Down Expand Up @@ -10466,7 +10466,7 @@ array-literals, array comprehensions and regular expressions."
(setq tt (js2-get-token 'TEMPLATE_TAIL))
(push (make-js2-string-node :type tt) kids))
(setq kids (nreverse kids))
(let ((tpl (make-js2-template-node :beg beg
(let ((tpl (make-js2-template-node :pos beg
:len (- (js2-current-token-end) beg)
:kids kids)))
(apply #'js2-node-add-children tpl kids)
Expand Down

0 comments on commit 91e722a

Please sign in to comment.