Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Commit

Permalink
Allow use react elements after yield statement
Browse files Browse the repository at this point in the history
  • Loading branch information
eldereal committed May 12, 2016
1 parent 21c4b4d commit de56e12
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugins/jsx/index.js
Expand Up @@ -16,7 +16,7 @@ tc.j_expr = new TokContext("<tag>...</tag>", true, true);

tt.jsxName = new TokenType("jsxName");
tt.jsxText = new TokenType("jsxText", { beforeExpr: true });
tt.jsxTagStart = new TokenType("jsxTagStart");
tt.jsxTagStart = new TokenType("jsxTagStart", { startsExpr: true });
tt.jsxTagEnd = new TokenType("jsxTagEnd");

tt.jsxTagStart.updateContext = function() {
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/jsx/basic/yield-tag/actual.js
@@ -0,0 +1,3 @@
function*it(){
yield <a></a>;
}
198 changes: 198 additions & 0 deletions test/fixtures/jsx/basic/yield-tag/expected.json
@@ -0,0 +1,198 @@
{
"type": "File",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 11
}
},
"name": "it"
},
"generator": true,
"expression": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 13,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 3,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 19,
"end": 33,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 2,
"column": 18
}
},
"expression": {
"type": "YieldExpression",
"start": 19,
"end": 32,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 2,
"column": 17
}
},
"delegate": false,
"argument": {
"type": "JSXElement",
"start": 25,
"end": 32,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 17
}
},
"openingElement": {
"type": "JSXOpeningElement",
"start": 25,
"end": 28,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 13
}
},
"attributes": [],
"name": {
"type": "JSXIdentifier",
"start": 26,
"end": 27,
"loc": {
"start": {
"line": 2,
"column": 11
},
"end": {
"line": 2,
"column": 12
}
},
"name": "a"
},
"selfClosing": false
},
"closingElement": {
"type": "JSXClosingElement",
"start": 28,
"end": 32,
"loc": {
"start": {
"line": 2,
"column": 13
},
"end": {
"line": 2,
"column": 17
}
},
"name": {
"type": "JSXIdentifier",
"start": 30,
"end": 31,
"loc": {
"start": {
"line": 2,
"column": 15
},
"end": {
"line": 2,
"column": 16
}
},
"name": "a"
}
},
"children": []
}
}
}
],
"directives": []
}
}
],
"directives": []
},
"comments": []
}

0 comments on commit de56e12

Please sign in to comment.