From 962ce16e8496788cda546214a62600f17b9a6623 Mon Sep 17 00:00:00 2001 From: Alex Kuzmenko Date: Fri, 3 Mar 2017 22:38:04 +0200 Subject: [PATCH 1/2] Add DoExpression to spec (#364) --- ast/spec.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ast/spec.md b/ast/spec.md index 9e2e094b9f..e3c5ec07b0 100644 --- a/ast/spec.md +++ b/ast/spec.md @@ -78,6 +78,7 @@ These are the core Babylon AST node types. - [CallExpression](#callexpression) - [NewExpression](#newexpression) - [SequenceExpression](#sequenceexpression) + - [DoExpression](#doexpression) - [Template Literals](#template-literals) - [TemplateLiteral](#templateliteral) - [TaggedTemplateExpression](#taggedtemplateexpression) @@ -920,6 +921,15 @@ interface SequenceExpression <: Expression { A sequence expression, i.e., a comma-separated sequence of expressions. +## DoExpression + +```js +interface DoExpression <: Expression { + type: "DoExpression"; + body: BlockStatement +} +``` + # Template Literals ## TemplateLiteral From 0b7da509d97ca6bb8c97a4012417581d05854d1d Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 4 Mar 2017 21:00:10 +0100 Subject: [PATCH 2/2] Add estree test for correct order of directives --- .../estree/directives/program-order/actual.js | 3 + .../directives/program-order/expected.json | 150 ++++++++++++++++++ 2 files changed, 153 insertions(+) create mode 100644 test/fixtures/estree/directives/program-order/actual.js create mode 100644 test/fixtures/estree/directives/program-order/expected.json diff --git a/test/fixtures/estree/directives/program-order/actual.js b/test/fixtures/estree/directives/program-order/actual.js new file mode 100644 index 0000000000..43e689ef2a --- /dev/null +++ b/test/fixtures/estree/directives/program-order/actual.js @@ -0,0 +1,3 @@ +"use strict"; +"use loose"; +var a; diff --git a/test/fixtures/estree/directives/program-order/expected.json b/test/fixtures/estree/directives/program-order/expected.json new file mode 100644 index 0000000000..2f58e0a7a4 --- /dev/null +++ b/test/fixtures/estree/directives/program-order/expected.json @@ -0,0 +1,150 @@ +{ + "type": "File", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 33, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "expression": { + "type": "Literal", + "start": 0, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "use strict", + "raw": "\"use strict\"" + }, + "directive": "use strict" + }, + { + "type": "ExpressionStatement", + "start": 14, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "expression": { + "type": "Literal", + "start": 14, + "end": 25, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "value": "use loose", + "raw": "\"use loose\"" + }, + "directive": "use loose" + }, + { + "type": "VariableDeclaration", + "start": 27, + "end": 33, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": null + } + ], + "kind": "var" + } + ] + } +} \ No newline at end of file