emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 08/46: Fix parsing of function statements in blocks


From: Dmitry Gutov
Subject: [elpa] 08/46: Fix parsing of function statements in blocks
Date: Sat, 15 Nov 2014 20:57:57 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit 153b67574a8ca0a5835e045aef8714a3deee34d1
Author: Dmitry Gutov <address@hidden>
Date:   Sun Apr 6 06:55:21 2014 +0300

    Fix parsing of function statements in blocks
---
 js2-mode.el     |    6 +-----
 tests/parser.el |    3 +++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index 2b3af58..3a4a9be 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7240,10 +7240,6 @@ Scanner should be initialized."
       (js2-highlight-undeclared-vars))
     root))
 
-(defun js2-function-parser ()
-  (js2-get-token)
-  (js2-parse-function-stmt))
-
 (defun js2-parse-function-closure-body (fn-node)
   "Parse a JavaScript 1.8 function closure body."
   (let ((js2-nesting-of-function (1+ js2-nesting-of-function)))
@@ -7540,7 +7536,7 @@ node are given relative start positions and correct 
lengths."
     (aset parsers js2-DEFAULT   #'js2-parse-default-xml-namespace)
     (aset parsers js2-DO        #'js2-parse-do)
     (aset parsers js2-FOR       #'js2-parse-for)
-    (aset parsers js2-FUNCTION  #'js2-function-parser)
+    (aset parsers js2-FUNCTION  #'js2-parse-function-stmt)
     (aset parsers js2-IF        #'js2-parse-if)
     (aset parsers js2-LC        #'js2-parse-block)
     (aset parsers js2-LET       #'js2-parse-let-stmt)
diff --git a/tests/parser.el b/tests/parser.el
index 1da9108..ee56087 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -96,6 +96,9 @@ the test."
 (js2-deftest-parse function-statement
   "function foo() {\n}")
 
+(js2-deftest-parse function-statement-inside-block
+  "if (true) {\n  function foo() {\n  }\n}")
+
 (js2-deftest-parse function-expression-statements-are-verboten
   "function() {}" :syntax-error "(")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]