(should (null js2-mode-buffer-dirty-p))\r
js2-mode-ast))\r
\r
-(defun js2-test-ast-string (code-string &key syntax-error)\r
+(defun js2-test-parse-string (code-string &key syntax-error)\r
(let ((ast (js2-test-string-to-ast code-string)))\r
(if syntax-error\r
(let ((errors (js2-ast-root-errors ast)))\r
(should (string= code-string (buffer-substring-no-properties\r
(point-min) (point))))))))\r
\r
-(defmacro* js2-deftest-ast (name code-string &key bind syntax-error)\r
+(defmacro* js2-deftest-parse (name code-string &key bind syntax-error)\r
"Parse CODE-STRING. If SYNTAX-ERROR is nil, print syntax tree\r
with `js2-print-tree' and assert the result to be equal to the\r
original string. If SYNTAX-ERROR is passed, expect syntax error\r
BIND defines bindings to apply them around the test."\r
`(ert-deftest ,name ()\r
(let ,(append bind '((js2-basic-offset 2)))\r
- (js2-test-ast-string ,code-string :syntax-error ,syntax-error))))\r
+ (js2-test-parse-string ,code-string :syntax-error ,syntax-error))))\r
\r
-(put 'js2-deftest-ast 'lisp-indent-function 'defun)\r
+(put 'js2-deftest-parse 'lisp-indent-function 'defun)\r
\r
;;; Callers of `js2-valid-prop-name-token'.\r
\r
-(js2-deftest-ast parse-property-access-when-not-keyword\r
+(js2-deftest-parse parse-property-access-when-not-keyword\r
"A.foo = 3;")\r
\r
-(js2-deftest-ast parse-property-access-when-keyword\r
+(js2-deftest-parse parse-property-access-when-keyword\r
"A.in = 3;"\r
:bind ((js2-allow-keywords-as-property-names t)))\r
\r
-(js2-deftest-ast parse-property-access-when-keyword-no-xml\r
+(js2-deftest-parse parse-property-access-when-keyword-no-xml\r
"A.in = 3;"\r
:bind ((js2-allow-keywords-as-property-names t)\r
(js2-compiler-xml-available nil)))\r
\r
-(js2-deftest-ast parse-array-literal-when-not-keyword\r
+(js2-deftest-parse parse-array-literal-when-not-keyword\r
"a = {b: 1};")\r
\r
-(js2-deftest-ast parse-array-literal-when-keyword\r
+(js2-deftest-parse parse-array-literal-when-keyword\r
"a = {in: 1};"\r
:bind ((js2-allow-keywords-as-property-names t)))\r
\r
;;; 'of' contextual keyword.\r
\r
-(js2-deftest-ast parse-array-comp-loop-with-of\r
+(js2-deftest-parse parse-array-comp-loop-with-of\r
"[a for (a of [])];")\r
\r
-(js2-deftest-ast parse-for-of\r
+(js2-deftest-parse parse-for-of\r
"for (var a of []) {\n}")\r
\r
-(js2-deftest-ast of-can-be-var-name\r
+(js2-deftest-parse of-can-be-var-name\r
"var of = 3;")\r
\r
-(js2-deftest-ast of-can-be-function-name\r
+(js2-deftest-parse of-can-be-function-name\r
"function of() {\n}")\r
\r
;;; Destructuring binding.\r
\r
-(js2-deftest-ast destruct-in-declaration\r
+(js2-deftest-parse destruct-in-declaration\r
"var {a, b} = {a: 1, b: 2};")\r
\r
-(js2-deftest-ast destruct-in-arguments\r
+(js2-deftest-parse destruct-in-arguments\r
"function f({a: aa, b: bb}) {\n}")\r
\r
-(js2-deftest-ast destruct-in-array-comp-loop\r
+(js2-deftest-parse destruct-in-array-comp-loop\r
"[a + b for ([a, b] in [[0, 1], [1, 2]])];")\r
\r
-(js2-deftest-ast destruct-in-catch-clause\r
+(js2-deftest-parse destruct-in-catch-clause\r
"try {\n} catch ({a, b}) {\n a + b;\n}")\r
\r
;;; Function parameters.\r
\r
-(js2-deftest-ast function-with-default-parameters\r
+(js2-deftest-parse function-with-default-parameters\r
"function foo(a = 1, b = a + 1) {\n}")\r
\r
-(js2-deftest-ast function-with-no-default-after-default\r
+(js2-deftest-parse function-with-no-default-after-default\r
"function foo(a = 1, b) {\n}"\r
:syntax-error "b")\r
\r
-(js2-deftest-ast function-with-destruct-after-default\r
+(js2-deftest-parse function-with-destruct-after-default\r
"function foo(a = 1, {b, c}) {\n}"\r
:syntax-error "{")\r
\r
-(js2-deftest-ast function-with-rest-parameter\r
+(js2-deftest-parse function-with-rest-parameter\r
"function foo(a, b, ...rest) {\n}")\r
\r
-(js2-deftest-ast function-with-param-after-rest-parameter\r
+(js2-deftest-parse function-with-param-after-rest-parameter\r
"function foo(a, ...b, rest) {\n}"\r
:syntax-error "rest")\r
\r
-(js2-deftest-ast function-with-destruct-after-rest-parameter\r
+(js2-deftest-parse function-with-destruct-after-rest-parameter\r
"function foo(a, ...b, {}) {\n}"\r
:syntax-error "{}")\r
\r
-(js2-deftest-ast function-with-rest-after-default-parameter\r
+(js2-deftest-parse function-with-rest-after-default-parameter\r
"function foo(a = 1, ...rest) {\n}")\r