[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 "(")
- [elpa] branch master updated (46fb875 -> 4e4c53b), Dmitry Gutov, 2014/11/15
- [elpa] 01/46: Add support for React classes in js2-imenu-extras, Dmitry Gutov, 2014/11/15
- [elpa] 02/46: Merge pull request #133 from johnmastro/imenu-react, Dmitry Gutov, 2014/11/15
- [elpa] 06/46: Merge pull request #138 from martinp/fix-electric-indent, Dmitry Gutov, 2014/11/15
- [elpa] 03/46: Reference #72 in the README, Dmitry Gutov, 2014/11/15
- [elpa] 05/46: Fix electric-indent-mode, Dmitry Gutov, 2014/11/15
- [elpa] 08/46: Fix parsing of function statements in blocks,
Dmitry Gutov <=
- [elpa] 04/46: Try to improve formatting, Dmitry Gutov, 2014/11/15
- [elpa] 09/46: Rename mention of espresso-mode to js-mode, Dmitry Gutov, 2014/11/15
- [elpa] 10/46: js2-parse-array-literal: improve trailing comma warning, Dmitry Gutov, 2014/11/15
- [elpa] 07/46: Cut down on reserved words; improve error reporting, Dmitry Gutov, 2014/11/15
- [elpa] 11/46: Support yield*, Dmitry Gutov, 2014/11/15
- [elpa] 16/46: Support Unicode Identifiers, Dmitry Gutov, 2014/11/15
- [elpa] 17/46: Check if buffer is alive before reparsing., Dmitry Gutov, 2014/11/15
- [elpa] 19/46: Better docstrings, Dmitry Gutov, 2014/11/15
- [elpa] 14/46: Support ES6 generator comprehensions, Dmitry Gutov, 2014/11/15
- [elpa] 13/46: Support ES6 array comprehensions, Dmitry Gutov, 2014/11/15