add test for do expressions (#688)
This commit is contained in:
parent
d0c7d7a8c7
commit
d83064a82e
5
test/fixtures/experimental/do-expressions/conditional-statement/actual.js
vendored
Normal file
5
test/fixtures/experimental/do-expressions/conditional-statement/actual.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
let x = do {
|
||||
if (foo()) { f() }
|
||||
else if (bar()) { g() }
|
||||
else { h() }
|
||||
};
|
||||
411
test/fixtures/experimental/do-expressions/conditional-statement/expected.json
vendored
Normal file
411
test/fixtures/experimental/do-expressions/conditional-statement/expected.json
vendored
Normal file
@ -0,0 +1,411 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 77,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 77,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 77,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 76,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 5,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "DoExpression",
|
||||
"start": 8,
|
||||
"end": 76,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 11,
|
||||
"end": 76,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "IfStatement",
|
||||
"start": 15,
|
||||
"end": 74,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "CallExpression",
|
||||
"start": 19,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 19,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"arguments": []
|
||||
},
|
||||
"consequent": {
|
||||
"type": "BlockStatement",
|
||||
"start": 26,
|
||||
"end": 33,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 20
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 28,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start": 28,
|
||||
"end": 31,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 28,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
},
|
||||
"identifierName": "f"
|
||||
},
|
||||
"name": "f"
|
||||
},
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"alternate": {
|
||||
"type": "IfStatement",
|
||||
"start": 41,
|
||||
"end": 74,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "CallExpression",
|
||||
"start": 45,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 45,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 14
|
||||
},
|
||||
"identifierName": "bar"
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"arguments": []
|
||||
},
|
||||
"consequent": {
|
||||
"type": "BlockStatement",
|
||||
"start": 52,
|
||||
"end": 59,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 25
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 54,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start": 54,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 54,
|
||||
"end": 55,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 21
|
||||
},
|
||||
"identifierName": "g"
|
||||
},
|
||||
"name": "g"
|
||||
},
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"alternate": {
|
||||
"type": "BlockStatement",
|
||||
"start": 67,
|
||||
"end": 74,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 69,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start": 69,
|
||||
"end": 72,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 69,
|
||||
"end": 70,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 10
|
||||
},
|
||||
"identifierName": "h"
|
||||
},
|
||||
"name": "h"
|
||||
},
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "let"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
test/fixtures/experimental/do-expressions/options.json
vendored
Normal file
3
test/fixtures/experimental/do-expressions/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["doExpressions"]
|
||||
}
|
||||
4
test/fixtures/experimental/do-expressions/scoping-variable/actual.js
vendored
Normal file
4
test/fixtures/experimental/do-expressions/scoping-variable/actual.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
let x = do {
|
||||
let tmp = f();
|
||||
tmp * tmp + 1
|
||||
};
|
||||
301
test/fixtures/experimental/do-expressions/scoping-variable/expected.json
vendored
Normal file
301
test/fixtures/experimental/do-expressions/scoping-variable/expected.json
vendored
Normal file
@ -0,0 +1,301 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 48,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 2
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 5,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
},
|
||||
"init": {
|
||||
"type": "DoExpression",
|
||||
"start": 8,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 11,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 15,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 19,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 19,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"identifierName": "tmp"
|
||||
},
|
||||
"name": "tmp"
|
||||
},
|
||||
"init": {
|
||||
"type": "CallExpression",
|
||||
"start": 25,
|
||||
"end": 28,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 25,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 13
|
||||
},
|
||||
"identifierName": "f"
|
||||
},
|
||||
"name": "f"
|
||||
},
|
||||
"arguments": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "let"
|
||||
},
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 32,
|
||||
"end": 45,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 32,
|
||||
"end": 45,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 32,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start": 32,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 5
|
||||
},
|
||||
"identifierName": "tmp"
|
||||
},
|
||||
"name": "tmp"
|
||||
},
|
||||
"operator": "*",
|
||||
"right": {
|
||||
"type": "Identifier",
|
||||
"start": 38,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 11
|
||||
},
|
||||
"identifierName": "tmp"
|
||||
},
|
||||
"name": "tmp"
|
||||
}
|
||||
},
|
||||
"operator": "+",
|
||||
"right": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 44,
|
||||
"end": 45,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "let"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
16
test/fixtures/experimental/do-expressions/with-jsx/actual.js
vendored
Normal file
16
test/fixtures/experimental/do-expressions/with-jsx/actual.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
function foo() {
|
||||
return (
|
||||
<nav>
|
||||
<Home />
|
||||
{
|
||||
do {
|
||||
if (loggedIn) {
|
||||
<LogoutButton />
|
||||
} else {
|
||||
<LoginButton />
|
||||
}
|
||||
}
|
||||
}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
544
test/fixtures/experimental/do-expressions/with-jsx/expected.json
vendored
Normal file
544
test/fixtures/experimental/do-expressions/with-jsx/expected.json
vendored
Normal file
@ -0,0 +1,544 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 223,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 223,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "FunctionDeclaration",
|
||||
"start": 0,
|
||||
"end": 223,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
},
|
||||
"generator": false,
|
||||
"expression": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 15,
|
||||
"end": 223,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ReturnStatement",
|
||||
"start": 19,
|
||||
"end": 221,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 15,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "JSXElement",
|
||||
"start": 32,
|
||||
"end": 216,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"openingElement": {
|
||||
"type": "JSXOpeningElement",
|
||||
"start": 32,
|
||||
"end": 37,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"attributes": [],
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start": 33,
|
||||
"end": 36,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"name": "nav"
|
||||
},
|
||||
"selfClosing": false
|
||||
},
|
||||
"closingElement": {
|
||||
"type": "JSXClosingElement",
|
||||
"start": 210,
|
||||
"end": 216,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start": 212,
|
||||
"end": 215,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"name": "nav"
|
||||
}
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "JSXText",
|
||||
"start": 37,
|
||||
"end": 44,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "\n ",
|
||||
"raw": "\n "
|
||||
},
|
||||
"value": "\n "
|
||||
},
|
||||
{
|
||||
"type": "JSXElement",
|
||||
"start": 44,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"openingElement": {
|
||||
"type": "JSXOpeningElement",
|
||||
"start": 44,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"attributes": [],
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start": 45,
|
||||
"end": 49,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"name": "Home"
|
||||
},
|
||||
"selfClosing": true
|
||||
},
|
||||
"closingElement": null,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"type": "JSXText",
|
||||
"start": 52,
|
||||
"end": 59,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "\n ",
|
||||
"raw": "\n "
|
||||
},
|
||||
"value": "\n "
|
||||
},
|
||||
{
|
||||
"type": "JSXExpressionContainer",
|
||||
"start": 59,
|
||||
"end": 205,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 13,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "DoExpression",
|
||||
"start": 69,
|
||||
"end": 197,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 72,
|
||||
"end": 197,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "IfStatement",
|
||||
"start": 84,
|
||||
"end": 187,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"type": "Identifier",
|
||||
"start": 88,
|
||||
"end": 96,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 7,
|
||||
"column": 22
|
||||
},
|
||||
"identifierName": "loggedIn"
|
||||
},
|
||||
"name": "loggedIn"
|
||||
},
|
||||
"consequent": {
|
||||
"type": "BlockStatement",
|
||||
"start": 98,
|
||||
"end": 140,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 7,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 112,
|
||||
"end": 128,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 28
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "JSXElement",
|
||||
"start": 112,
|
||||
"end": 128,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 28
|
||||
}
|
||||
},
|
||||
"openingElement": {
|
||||
"type": "JSXOpeningElement",
|
||||
"start": 112,
|
||||
"end": 128,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 28
|
||||
}
|
||||
},
|
||||
"attributes": [],
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start": 113,
|
||||
"end": 125,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 25
|
||||
}
|
||||
},
|
||||
"name": "LogoutButton"
|
||||
},
|
||||
"selfClosing": true
|
||||
},
|
||||
"closingElement": null,
|
||||
"children": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"alternate": {
|
||||
"type": "BlockStatement",
|
||||
"start": 146,
|
||||
"end": 187,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 9,
|
||||
"column": 17
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 11
|
||||
}
|
||||
},
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 160,
|
||||
"end": 175,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "JSXElement",
|
||||
"start": 160,
|
||||
"end": 175,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"openingElement": {
|
||||
"type": "JSXOpeningElement",
|
||||
"start": 160,
|
||||
"end": 175,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"attributes": [],
|
||||
"name": {
|
||||
"type": "JSXIdentifier",
|
||||
"start": 161,
|
||||
"end": 172,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"name": "LoginButton"
|
||||
},
|
||||
"selfClosing": true
|
||||
},
|
||||
"closingElement": null,
|
||||
"children": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "JSXText",
|
||||
"start": 205,
|
||||
"end": 210,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 13,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 4
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "\n ",
|
||||
"raw": "\n "
|
||||
},
|
||||
"value": "\n "
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 26
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
3
test/fixtures/experimental/do-expressions/with-jsx/options.json
vendored
Normal file
3
test/fixtures/experimental/do-expressions/with-jsx/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["jsx", "doExpressions"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user