Proper "this" scoping in react{}
This commit is contained in:
parent
71fed1eb48
commit
3dc6559d26
|
@ -162,5 +162,5 @@ export function DuringStatement(node) {
|
|||
export function SyndicateReactStatement(node) {
|
||||
this.word("react");
|
||||
this.space();
|
||||
this.print(node.body, node);
|
||||
this.printBlock(node.bodyProc);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ export default class SyndicateParser extends _original_Parser {
|
|||
if (this.isContextual("react")) {
|
||||
this.next();
|
||||
const node = this.startNode();
|
||||
node.body = this.parseStatement();
|
||||
node.bodyProc = this.parseSyntheticFunctionStatement();
|
||||
return this.finishNode(node, "SyndicateReactStatement");
|
||||
}
|
||||
|
||||
|
|
|
@ -540,10 +540,10 @@ export default declare((api, options) => {
|
|||
path.replaceWith(template(
|
||||
`DATASPACE._currentFacet.actor.addFacet(
|
||||
DATASPACE._currentFacet,
|
||||
function () { BODY },
|
||||
BODYPROC,
|
||||
true);`)({
|
||||
DATASPACE: state.DataspaceID,
|
||||
BODY: node.body,
|
||||
BODYPROC: node.bodyProc,
|
||||
}));
|
||||
},
|
||||
},
|
||||
|
|
|
@ -196,12 +196,12 @@ defineType("DuringStatement", {
|
|||
});
|
||||
|
||||
defineType("SyndicateReactStatement", {
|
||||
builder: ["body"],
|
||||
visitor: ["body"],
|
||||
builder: ["bodyProc"],
|
||||
visitor: ["bodyProc"],
|
||||
aliases: ["Statement"],
|
||||
fields: {
|
||||
body: {
|
||||
validate: assertNodeType("Statement"),
|
||||
bodyProc: {
|
||||
validate: assertNodeType("FunctionExpression"),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue