[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ee17084 13/45: js2-parse-plain-property: Disallow numbers
From: |
Dmitry Gutov |
Subject: |
[elpa] master ee17084 13/45: js2-parse-plain-property: Disallow numbers as abbreviated props |
Date: |
Mon, 02 Feb 2015 03:18:37 +0000 |
branch: master
commit ee17084c940b5d032355c832758696771aa81d7e
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
js2-parse-plain-property: Disallow numbers as abbreviated props
---
js2-mode.el | 3 ++-
tests/parser.el | 3 +++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index b150bb7..4ffb4d3 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -9788,7 +9788,8 @@ PROP is the node representing the property: a number,
name or string."
;; Abbreviated property, as in {foo, bar}
((and (>= js2-language-version 200)
(or (= tt js2-COMMA)
- (= tt js2-RC)))
+ (= tt js2-RC))
+ (not (js2-number-node-p prop)))
(js2-unget-token)
(setq result (make-js2-object-prop-node
:pos pos
diff --git a/tests/parser.el b/tests/parser.el
index d986ffc..ade10d8 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -184,6 +184,9 @@ the test."
(js2-deftest-parse object-literal-shorthand
"var x = {a: 1, b, c: 1, d};")
+(js2-deftest-parse object-literal-shorthard-with-number
+ "var a = {1};" :syntax-error ";" :errors-count 2)
+
(js2-deftest-parse object-literal-method
"var x = {f(y) { return y;\n}};")
- [elpa] master updated (d47c872 -> a1ac1e0), Dmitry Gutov, 2015/02/01
- [elpa] master 6037c0f 04/45: Add support for 'u' and 'y' RegExp flags in ES6 mode., Dmitry Gutov, 2015/02/01
- [elpa] master dad2f12 03/45: Support method definitions in object literals., Dmitry Gutov, 2015/02/01
- [elpa] master 926cb45 05/45: Support ES6 computed property names., Dmitry Gutov, 2015/02/01
- [elpa] master 30249fa 07/45: Support parsing the ES6 'static' keyword., Dmitry Gutov, 2015/02/01
- [elpa] master c79d426 06/45: Support ES6 class statements/expressions., Dmitry Gutov, 2015/02/01
- [elpa] master 2b0f5ba 08/45: Support parsing the ES6 'super' keyword., Dmitry Gutov, 2015/02/01
- [elpa] master dd344ff 01/45: Support short-hand object literals {foo, bar} everywhere., Dmitry Gutov, 2015/02/01
- [elpa] master b1f7e6c 11/45: Simplify parsing of destructuring literals, Dmitry Gutov, 2015/02/01
- [elpa] master 68b4abd 02/45: Add ES6 class externs, Dmitry Gutov, 2015/02/01
- [elpa] master ee17084 13/45: js2-parse-plain-property: Disallow numbers as abbreviated props,
Dmitry Gutov <=
- [elpa] master b19ea52 12/45: js2-parse-named-prop: Highlight externals in abbreviated props, Dmitry Gutov, 2015/02/01
- [elpa] master 31c49e0 14/45: js2-imenu-extension-styles: Turn into defvar, Dmitry Gutov, 2015/02/01
- [elpa] master 9b77d64 15/45: Implement template strings, ignoring substitutions, Dmitry Gutov, 2015/02/01
- [elpa] master 7b3d590 17/45: No need to explicitly apply face to string nodes, Dmitry Gutov, 2015/02/01
- [elpa] master 3f09ff3 09/45: Fix string literals in parser.el test harness., Dmitry Gutov, 2015/02/01
- [elpa] master d0c6bf3 18/45: Comment the new token types, Dmitry Gutov, 2015/02/01
- [elpa] master 9525eb3 10/45: Merge branch 'master' of github.com:shicks/js2-mode into shicks-master, Dmitry Gutov, 2015/02/01
- [elpa] master c910d1b 19/45: Parse tagged templates, Dmitry Gutov, 2015/02/01
- [elpa] master 8df508e 16/45: Handle template substitutions, Dmitry Gutov, 2015/02/01
- [elpa] master 92063fe 22/45: Fix js2-visit-tagged-template, Dmitry Gutov, 2015/02/01