Hack-pipe proposal with % topic token (#13416)

Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
This commit is contained in:
J. S. Choi 2021-07-06 13:21:00 -04:00 committed by Nicolò Ribaudo
parent cd4b3fbffe
commit 35e4e1f067
342 changed files with 6406 additions and 62 deletions

View File

@ -140,6 +140,8 @@ export const ErrorMessages = makeErrorTemplates(
'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
PipeTopicUnbound:
"Topic reference is unbound; it must be inside a pipe body.",
PipeTopicUnconfiguredToken:
'Invalid topic token %0. In order to use %0 as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "%0" }.',
PipeTopicUnused:
"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",

View File

@ -1227,10 +1227,32 @@ export default class ExpressionParser extends LValParser {
return node;
}
case tt.modulo:
case tt.hash: {
node = this.maybeParseTopicReference();
if (node) {
return node;
const pipeProposal = this.getPluginOption(
"pipelineOperator",
"proposal",
);
if (pipeProposal) {
// A pipe-operator proposal is active,
// although its configuration might not match the current tokens type.
node = this.startNode();
const start = this.state.start;
const tokenType = this.state.type;
// Consume the current token.
this.next();
// If the pipe-operator plugins configuration matches the current tokens type,
// then this will return `node`, will have been finished as a topic reference.
// Otherwise, this will throw a `PipeTopicUnconfiguredToken` error.
return this.finishTopicReference(
node,
start,
pipeProposal,
tokenType,
);
}
}
@ -1253,64 +1275,64 @@ export default class ExpressionParser extends LValParser {
}
}
// https://github.com/js-choi/proposal-hack-pipes
maybeParseTopicReference(): ?N.Expression {
const pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
// This helper method attempts to finish the given `node`
// into a topic-reference node for the given `pipeProposal`.
// See <https://github.com/js-choi/proposal-hack-pipes>.
//
// The method assumes that any topic token was consumed before it was called.
//
// If the `pipelineOperator` plugin is active,
// and if the given `tokenType` matches the plugins configuration,
// then this method will return the finished `node`.
//
// If the `pipelineOperator` plugin is active,
// but if the given `tokenType` does not match the plugins configuration,
// then this method will throw a `PipeTopicUnconfiguredToken` error.
finishTopicReference(
node: N.Node,
start: number,
pipeProposal: string,
tokenType: TokenType,
): N.Expression {
if (this.testTopicReferenceConfiguration(pipeProposal, start, tokenType)) {
// The token matches the plugins configuration.
// The token is therefore a topic reference.
// `pipeProposal` is falsy when an input program
// contains a topic reference on its own,
// outside of a pipe expression,
// and without having turned on the pipelineOperator plugin.
if (pipeProposal) {
// A pipe-operator proposal is active.
const { type: tokenType, start } = this.state;
if (this.testTopicReferenceConfiguration(pipeProposal, tokenType)) {
// The token matches the plugins configuration.
// The token is therefore a topic reference.
const node = this.startNode();
// Determine the node type for the topic reference
// that is appropriate for the active pipe-operator proposal.
let nodeType;
if (pipeProposal === "smart") {
nodeType = "PipelinePrimaryTopicReference";
} else {
// The proposal must otherwise be "hack",
// as enforced by testTopicReferenceConfiguration.
nodeType = "TopicReference";
}
// Consume the token.
this.next();
// Register the topic reference so that its pipe body knows
// that its topic was used at least once.
this.registerTopicReference();
if (!this.topicReferenceIsAllowedInCurrentContext()) {
// The topic reference is not allowed in the current context:
// it is outside of a pipe body.
// Raise recoverable errors.
if (pipeProposal === "smart") {
this.raise(start, Errors.PrimaryTopicNotAllowed);
} else {
// In this case, `pipeProposal === "hack"` is true.
this.raise(start, Errors.PipeTopicUnbound);
}
}
return this.finishNode(node, nodeType);
// Determine the node type for the topic reference
// that is appropriate for the active pipe-operator proposal.
let nodeType;
if (pipeProposal === "smart") {
nodeType = "PipelinePrimaryTopicReference";
} else {
// The token does not match the plugins configuration.
throw this.raise(
start,
Errors.PipeTopicUnconfiguredToken,
tokenType.label,
);
// The proposal must otherwise be "hack",
// as enforced by testTopicReferenceConfiguration.
nodeType = "TopicReference";
}
if (!this.topicReferenceIsAllowedInCurrentContext()) {
// The topic reference is not allowed in the current context:
// it is outside of a pipe body.
// Raise recoverable errors.
if (pipeProposal === "smart") {
this.raise(start, Errors.PrimaryTopicNotAllowed);
} else {
// In this case, `pipeProposal === "hack"` is true.
this.raise(start, Errors.PipeTopicUnbound);
}
}
// Register the topic reference so that its pipe body knows
// that its topic was used at least once.
this.registerTopicReference();
return this.finishNode(node, nodeType);
} else {
// The token does not match the plugins configuration.
throw this.raise(
start,
Errors.PipeTopicUnconfiguredToken,
tokenType.label,
);
}
}
@ -1325,6 +1347,7 @@ export default class ExpressionParser extends LValParser {
// then an error is thrown.
testTopicReferenceConfiguration(
pipeProposal: string,
start: number,
tokenType: TokenType,
): boolean {
switch (pipeProposal) {
@ -1338,7 +1361,7 @@ export default class ExpressionParser extends LValParser {
case "smart":
return tokenType === tt.hash;
default:
throw this.raise(this.state.start, Errors.PipeTopicRequiresHackPipes);
throw this.raise(start, Errors.PipeTopicRequiresHackPipes);
}
}

View File

@ -90,6 +90,18 @@ export function validatePlugins(plugins: PluginList) {
getPluginOption(plugins, "recordAndTuple", "syntaxType") === "hash";
if (proposal === "hack") {
if (hasPlugin(plugins, "placeholders")) {
throw new Error(
"Cannot combine placeholders plugin and Hack-style pipes.",
);
}
if (hasPlugin(plugins, "v8intrinsic")) {
throw new Error(
"Cannot combine v8intrinsic plugin and Hack-style pipes.",
);
}
const topicToken = getPluginOption(
plugins,
"pipelineOperator",

View File

@ -155,7 +155,7 @@ export const types: { [name: string]: TokenType } = {
bitShift: createBinop("<</>>/>>>", 8),
plusMin: new TokenType("+/-", { beforeExpr, binop: 9, prefix, startsExpr }),
// startsExpr: required by v8intrinsic plugin
modulo: new TokenType("%", { beforeExpr, binop: 10, startsExpr }),
modulo: new TokenType("%", { binop: 10, startsExpr }),
// unset `beforeExpr` as it can be `function *`
star: new TokenType("*", { binop: 10 }),
slash: createBinop("/", 10),

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "#" }]]
}

View File

@ -0,0 +1,52 @@
{
"type": "File",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}},
"errors": [
"SyntaxError: Invalid left-hand side in assignment expression. (1:10)"
],
"program": {
"type": "Program",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "AssignmentExpression",
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}},
"extra": {
"parenthesized": true,
"parenStart": 9
},
"operator": "=",
"left": {
"type": "TopicReference",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}
},
"right": {
"type": "NumericLiteral",
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,4 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "#" }]],
"throws": "Invalid topic token %. In order to use % as a topic reference, the pipelineOperator plugin must be configured with { \"proposal\": \"hack\", \"topicToken\": \"%\" }. (1:9)"
}

View File

@ -0,0 +1 @@
%%FUNCTION%%(0, %%VALUE%%);

View File

@ -0,0 +1,7 @@
{
"plugins": [
["pipelineOperator", { "proposal": "hack", "topicToken": "#" }],
"placeholders"
],
"throws": "Cannot combine placeholders plugin and Hack-style pipes."
}

View File

@ -0,0 +1,12 @@
{
"plugins": [
[
"pipelineOperator",
{
"proposal": "hack",
"topicToken": "#"
}
]
],
"throws": "Unexpected digit after hash token. (1:5)"
}

View File

@ -0,0 +1 @@
%GetOptimizationStatus(f);

View File

@ -0,0 +1,7 @@
{
"plugins": [
["pipelineOperator", { "proposal": "hack", "topicToken": "#" }],
"v8intrinsic"
],
"throws": "Cannot combine v8intrinsic plugin and Hack-style pipes."
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,45 @@
{
"type": "File",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"program": {
"type": "Program",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "BinaryExpression",
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}},
"left": {
"type": "TopicReference",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}
},
"operator": "+",
"right": {
"type": "NumericLiteral",
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,45 @@
{
"type": "File",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"program": {
"type": "Program",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "BinaryExpression",
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}},
"left": {
"type": "NumericLiteral",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
},
"operator": "+",
"right": {
"type": "TopicReference",
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,45 @@
{
"type": "File",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"errors": [
"SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:9)"
],
"program": {
"type": "Program",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "BinaryExpression",
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}},
"left": {
"type": "Identifier",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"},
"name": "a"
},
"operator": "+",
"right": {
"type": "Identifier",
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"b"},
"name": "b"
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,57 @@
{
"type": "File",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},
"program": {
"type": "Program",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "ArrowFunctionExpression",
"start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}},
"extra": {
"parenthesized": true,
"parenStart": 9
},
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BinaryExpression",
"start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}},
"left": {
"type": "TopicReference",
"start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}}
},
"operator": "+",
"right": {
"type": "NumericLiteral",
"start":20,"end":21,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":21}},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,12 @@
{
"plugins": [
[
"pipelineOperator",
{
"proposal": "hack",
"topicToken": "%"
}
]
],
"throws": "Unexpected => after pipeline body; any => expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence. (1:8)"
}

View File

@ -0,0 +1,12 @@
{
"plugins": [
[
"pipelineOperator",
{
"proposal": "hack",
"topicToken": "%"
}
]
],
"throws": "Unexpected &&= after pipeline body; any &&= expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence. (1:11)"
}

View File

@ -0,0 +1,12 @@
{
"plugins": [
[
"pipelineOperator",
{
"proposal": "hack",
"topicToken": "%"
}
]
],
"throws": "Unexpected = after pipeline body; any = expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence. (1:16)"
}

View File

@ -0,0 +1,12 @@
{
"plugins": [
[
"pipelineOperator",
{
"proposal": "hack",
"topicToken": "%"
}
]
],
"throws": "Unexpected += after pipeline body; any += expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence. (1:11)"
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,52 @@
{
"type": "File",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}},
"errors": [
"SyntaxError: Invalid left-hand side in assignment expression. (1:10)"
],
"program": {
"type": "Program",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "AssignmentExpression",
"start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15}},
"extra": {
"parenthesized": true,
"parenStart": 9
},
"operator": "=",
"left": {
"type": "TopicReference",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}
},
"right": {
"type": "NumericLiteral",
"start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
async function f () {
return x |> await %;
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,54 @@
{
"type": "File",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16},"identifierName":"f"},
"name": "f"
},
"generator": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start":20,"end":46,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}},
"body": [
{
"type": "ReturnStatement",
"start":24,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":22}},
"argument": {
"type": "BinaryExpression",
"start":31,"end":43,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":21}},
"left": {
"type": "Identifier",
"start":31,"end":32,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"},
"name": "x"
},
"operator": "|>",
"right": {
"type": "AwaitExpression",
"start":36,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":21}},
"argument": {
"type": "TopicReference",
"start":42,"end":43,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}}
}
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,9 @@
value |> new (
@classDecorator
class Thing {
@methodDecorator
method () {
return % + this.property;
}
}
);

View File

@ -0,0 +1,6 @@
{
"plugins": [
["pipelineOperator", { "proposal": "hack", "topicToken": "%" }],
["decorators", {"decoratorsBeforeExport": true}]
]
}

View File

@ -0,0 +1,124 @@
{
"type": "File",
"start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":2}},
"program": {
"type": "Program",
"start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":2}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":130,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":2}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":129,"loc":{"start":{"line":1,"column":0},"end":{"line":9,"column":1}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "NewExpression",
"start":9,"end":129,"loc":{"start":{"line":1,"column":9},"end":{"line":9,"column":1}},
"callee": {
"type": "ClassExpression",
"start":17,"end":127,"loc":{"start":{"line":2,"column":2},"end":{"line":8,"column":3}},
"extra": {
"parenthesized": true,
"parenStart": 13
},
"decorators": [
{
"type": "Decorator",
"start":17,"end":32,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":17}},
"expression": {
"type": "Identifier",
"start":18,"end":32,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":17},"identifierName":"classDecorator"},
"name": "classDecorator"
}
}
],
"id": {
"type": "Identifier",
"start":41,"end":46,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":13},"identifierName":"Thing"},
"name": "Thing"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":47,"end":127,"loc":{"start":{"line":3,"column":14},"end":{"line":8,"column":3}},
"body": [
{
"type": "ClassMethod",
"start":53,"end":123,"loc":{"start":{"line":4,"column":4},"end":{"line":7,"column":5}},
"decorators": [
{
"type": "Decorator",
"start":53,"end":69,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":20}},
"expression": {
"type": "Identifier",
"start":54,"end":69,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":20},"identifierName":"methodDecorator"},
"name": "methodDecorator"
}
}
],
"static": false,
"key": {
"type": "Identifier",
"start":74,"end":80,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":10},"identifierName":"method"},
"name": "method"
},
"computed": false,
"kind": "method",
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":84,"end":123,"loc":{"start":{"line":5,"column":14},"end":{"line":7,"column":5}},
"body": [
{
"type": "ReturnStatement",
"start":92,"end":117,"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":31}},
"argument": {
"type": "BinaryExpression",
"start":99,"end":116,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":30}},
"left": {
"type": "TopicReference",
"start":99,"end":100,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":14}}
},
"operator": "+",
"right": {
"type": "MemberExpression",
"start":103,"end":116,"loc":{"start":{"line":6,"column":17},"end":{"line":6,"column":30}},
"object": {
"type": "ThisExpression",
"start":103,"end":107,"loc":{"start":{"line":6,"column":17},"end":{"line":6,"column":21}}
},
"computed": false,
"property": {
"type": "Identifier",
"start":108,"end":116,"loc":{"start":{"line":6,"column":22},"end":{"line":6,"column":30},"identifierName":"property"},
"name": "property"
}
}
}
}
],
"directives": []
}
}
]
}
},
"arguments": []
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,7 @@
value |> new (class Thing {
#property;
method () {
return % + this.#property;
}
});

View File

@ -0,0 +1,7 @@
{
"plugins": [
["pipelineOperator", { "proposal": "hack", "topicToken": "%" }],
"classPrivateProperties",
"classPrivateMethods"
]
}

View File

@ -0,0 +1,121 @@
{
"type": "File",
"start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}},
"program": {
"type": "Program",
"start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":94,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":93,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":2}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "NewExpression",
"start":9,"end":93,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":2}},
"callee": {
"type": "ClassExpression",
"start":14,"end":92,"loc":{"start":{"line":1,"column":14},"end":{"line":7,"column":1}},
"extra": {
"parenthesized": true,
"parenStart": 13
},
"id": {
"type": "Identifier",
"start":20,"end":25,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":25},"identifierName":"Thing"},
"name": "Thing"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start":26,"end":92,"loc":{"start":{"line":1,"column":26},"end":{"line":7,"column":1}},
"body": [
{
"type": "ClassPrivateProperty",
"start":30,"end":40,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}},
"static": false,
"key": {
"type": "PrivateName",
"start":30,"end":39,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}},
"id": {
"type": "Identifier",
"start":31,"end":39,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":11},"identifierName":"property"},
"name": "property"
}
},
"value": null
},
{
"type": "ClassMethod",
"start":44,"end":90,"loc":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}},
"static": false,
"key": {
"type": "Identifier",
"start":44,"end":50,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":8},"identifierName":"method"},
"name": "method"
},
"computed": false,
"kind": "method",
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":54,"end":90,"loc":{"start":{"line":4,"column":12},"end":{"line":6,"column":3}},
"body": [
{
"type": "ReturnStatement",
"start":60,"end":86,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":30}},
"argument": {
"type": "BinaryExpression",
"start":67,"end":85,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":29}},
"left": {
"type": "TopicReference",
"start":67,"end":68,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":12}}
},
"operator": "+",
"right": {
"type": "MemberExpression",
"start":71,"end":85,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":29}},
"object": {
"type": "ThisExpression",
"start":71,"end":75,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":19}}
},
"computed": false,
"property": {
"type": "PrivateName",
"start":76,"end":85,"loc":{"start":{"line":5,"column":20},"end":{"line":5,"column":29}},
"id": {
"type": "Identifier",
"start":77,"end":85,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":29},"identifierName":"property"},
"name": "property"
}
}
}
}
}
],
"directives": []
}
}
]
}
},
"arguments": []
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
x |> class { constructor () { this.x = %; } }

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,89 @@
{
"type": "File",
"start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}},
"program": {
"type": "Program",
"start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":45,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":45}},
"left": {
"type": "Identifier",
"start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"},
"name": "x"
},
"operator": "|>",
"right": {
"type": "ClassExpression",
"start":5,"end":45,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":45}},
"id": null,
"superClass": null,
"body": {
"type": "ClassBody",
"start":11,"end":45,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":45}},
"body": [
{
"type": "ClassMethod",
"start":13,"end":43,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":43}},
"static": false,
"key": {
"type": "Identifier",
"start":13,"end":24,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":24},"identifierName":"constructor"},
"name": "constructor"
},
"computed": false,
"kind": "constructor",
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start":28,"end":43,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":43}},
"body": [
{
"type": "ExpressionStatement",
"start":30,"end":41,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":41}},
"expression": {
"type": "AssignmentExpression",
"start":30,"end":40,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":40}},
"operator": "=",
"left": {
"type": "MemberExpression",
"start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}},
"object": {
"type": "ThisExpression",
"start":30,"end":34,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":34}}
},
"computed": false,
"property": {
"type": "Identifier",
"start":35,"end":36,"loc":{"start":{"line":1,"column":35},"end":{"line":1,"column":36},"identifierName":"x"},
"name": "x"
}
},
"right": {
"type": "TopicReference",
"start":39,"end":40,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":40}}
}
}
}
],
"directives": []
}
}
]
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,49 @@
{
"type": "File",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"program": {
"type": "Program",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
"left": {
"type": "NumericLiteral",
"start":0,"end":2,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":2}},
"extra": {
"rawValue": 10,
"raw": "10"
},
"value": 10
},
"operator": "|>",
"right": {
"type": "SequenceExpression",
"start":7,"end":11,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":11}},
"extra": {
"parenthesized": true,
"parenStart": 6
},
"expressions": [
{
"type": "TopicReference",
"start":7,"end":8,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":8}}
},
{
"type": "TopicReference",
"start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}
}
]
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,45 @@
{
"type": "File",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"errors": [
"SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:9)"
],
"program": {
"type": "Program",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "MemberExpression",
"start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}},
"object": {
"type": "Identifier",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"a"},
"name": "a"
},
"computed": true,
"property": {
"type": "Identifier",
"start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"b"},
"name": "b"
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]]
}

View File

@ -0,0 +1,45 @@
{
"type": "File",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"program": {
"type": "Program",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "BinaryExpression",
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}},
"left": {
"type": "TopicReference",
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}
},
"operator": "/",
"right": {
"type": "NumericLiteral",
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}},
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,80 @@
{
"type": "File",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},
"program": {
"type": "Program",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":42}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":42,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":42}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":42,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":42}},
"body": [
{
"type": "DoWhileStatement",
"start":14,"end":40,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":40}},
"body": {
"type": "ExpressionStatement",
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}},
"expression": {
"type": "AssignmentExpression",
"start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}},
"operator": "+=",
"left": {
"type": "Identifier",
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"},
"name": "x"
},
"right": {
"type": "TopicReference",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}
}
}
},
"test": {
"type": "BinaryExpression",
"start":32,"end":38,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":38}},
"left": {
"type": "Identifier",
"start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"x"},
"name": "x"
},
"operator": "<",
"right": {
"type": "NumericLiteral",
"start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}},
"extra": {
"rawValue": 50,
"raw": "50"
},
"value": 50
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,80 @@
{
"type": "File",
"start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}},
"program": {
"type": "Program",
"start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":41,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":41}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":41,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":41}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":41,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":41}},
"body": [
{
"type": "DoWhileStatement",
"start":14,"end":39,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":39}},
"body": {
"type": "ExpressionStatement",
"start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}},
"expression": {
"type": "AssignmentExpression",
"start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}},
"operator": "+=",
"left": {
"type": "Identifier",
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"x"},
"name": "x"
},
"right": {
"type": "NumericLiteral",
"start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
},
"test": {
"type": "BinaryExpression",
"start":32,"end":37,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":37}},
"left": {
"type": "Identifier",
"start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33},"identifierName":"x"},
"name": "x"
},
"operator": "<",
"right": {
"type": "TopicReference",
"start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37}}
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
async function af () {
value |> do { for await (const e of sequence) %; }
}

View File

@ -0,0 +1,6 @@
{
"plugins": [
["pipelineOperator", { "proposal": "hack", "topicToken": "%" }],
"doExpressions"
]
}

View File

@ -0,0 +1,93 @@
{
"type": "File",
"start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"af"},
"name": "af"
},
"generator": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start":21,"end":77,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}},
"body": [
{
"type": "ExpressionStatement",
"start":25,"end":75,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":52}},
"expression": {
"type": "BinaryExpression",
"start":25,"end":75,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":52}},
"left": {
"type": "Identifier",
"start":25,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":34,"end":75,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":52}},
"async": false,
"body": {
"type": "BlockStatement",
"start":37,"end":75,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":52}},
"body": [
{
"type": "ForOfStatement",
"start":39,"end":73,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":50}},
"await": true,
"left": {
"type": "VariableDeclaration",
"start":50,"end":57,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":34}},
"declarations": [
{
"type": "VariableDeclarator",
"start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34}},
"id": {
"type": "Identifier",
"start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34},"identifierName":"e"},
"name": "e"
},
"init": null
}
],
"kind": "const"
},
"right": {
"type": "Identifier",
"start":61,"end":69,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":46},"identifierName":"sequence"},
"name": "sequence"
},
"body": {
"type": "ExpressionStatement",
"start":71,"end":73,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":50}},
"expression": {
"type": "TopicReference",
"start":71,"end":72,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":49}}
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
async function af () {
value |> do { for await (const e of %) e; }
}

View File

@ -0,0 +1,6 @@
{
"plugins": [
["pipelineOperator", { "proposal": "hack", "topicToken": "%" }],
"doExpressions"
]
}

View File

@ -0,0 +1,93 @@
{
"type": "File",
"start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"af"},
"name": "af"
},
"generator": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start":21,"end":70,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}},
"body": [
{
"type": "ExpressionStatement",
"start":25,"end":68,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":45}},
"expression": {
"type": "BinaryExpression",
"start":25,"end":68,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":45}},
"left": {
"type": "Identifier",
"start":25,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":34,"end":68,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":45}},
"async": false,
"body": {
"type": "BlockStatement",
"start":37,"end":68,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":45}},
"body": [
{
"type": "ForOfStatement",
"start":39,"end":66,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":43}},
"await": true,
"left": {
"type": "VariableDeclaration",
"start":50,"end":57,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":34}},
"declarations": [
{
"type": "VariableDeclarator",
"start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34}},
"id": {
"type": "Identifier",
"start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34},"identifierName":"e"},
"name": "e"
},
"init": null
}
],
"kind": "const"
},
"right": {
"type": "TopicReference",
"start":61,"end":62,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":39}}
},
"body": {
"type": "ExpressionStatement",
"start":64,"end":66,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":43}},
"expression": {
"type": "Identifier",
"start":64,"end":65,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":42},"identifierName":"e"},
"name": "e"
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
async function af () {
value |> do { for await (const e of sequence) %; }
}

View File

@ -0,0 +1,7 @@
{
"plugins": [
["pipelineOperator", { "proposal": "hack", "topicToken": "%" }],
"doExpressions",
"asyncGenerators"
]
}

View File

@ -0,0 +1,93 @@
{
"type": "File",
"start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start":0,"end":77,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"af"},
"name": "af"
},
"generator": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start":21,"end":77,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}},
"body": [
{
"type": "ExpressionStatement",
"start":25,"end":75,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":52}},
"expression": {
"type": "BinaryExpression",
"start":25,"end":75,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":52}},
"left": {
"type": "Identifier",
"start":25,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":34,"end":75,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":52}},
"async": false,
"body": {
"type": "BlockStatement",
"start":37,"end":75,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":52}},
"body": [
{
"type": "ForOfStatement",
"start":39,"end":73,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":50}},
"await": true,
"left": {
"type": "VariableDeclaration",
"start":50,"end":57,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":34}},
"declarations": [
{
"type": "VariableDeclarator",
"start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34}},
"id": {
"type": "Identifier",
"start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34},"identifierName":"e"},
"name": "e"
},
"init": null
}
],
"kind": "const"
},
"right": {
"type": "Identifier",
"start":61,"end":69,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":46},"identifierName":"sequence"},
"name": "sequence"
},
"body": {
"type": "ExpressionStatement",
"start":71,"end":73,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":50}},
"expression": {
"type": "TopicReference",
"start":71,"end":72,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":49}}
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
async function af () {
value |> do { for await (const e of %) e; }
}

View File

@ -0,0 +1,7 @@
{
"plugins": [
["pipelineOperator", { "proposal": "hack", "topicToken": "%" }],
"doExpressions",
"asyncGenerators"
]
}

View File

@ -0,0 +1,93 @@
{
"type": "File",
"start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"program": {
"type": "Program",
"start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start":0,"end":70,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
"id": {
"type": "Identifier",
"start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17},"identifierName":"af"},
"name": "af"
},
"generator": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start":21,"end":70,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}},
"body": [
{
"type": "ExpressionStatement",
"start":25,"end":68,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":45}},
"expression": {
"type": "BinaryExpression",
"start":25,"end":68,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":45}},
"left": {
"type": "Identifier",
"start":25,"end":30,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":7},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":34,"end":68,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":45}},
"async": false,
"body": {
"type": "BlockStatement",
"start":37,"end":68,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":45}},
"body": [
{
"type": "ForOfStatement",
"start":39,"end":66,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":43}},
"await": true,
"left": {
"type": "VariableDeclaration",
"start":50,"end":57,"loc":{"start":{"line":2,"column":27},"end":{"line":2,"column":34}},
"declarations": [
{
"type": "VariableDeclarator",
"start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34}},
"id": {
"type": "Identifier",
"start":56,"end":57,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":34},"identifierName":"e"},
"name": "e"
},
"init": null
}
],
"kind": "const"
},
"right": {
"type": "TopicReference",
"start":61,"end":62,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":39}}
},
"body": {
"type": "ExpressionStatement",
"start":64,"end":66,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":43}},
"expression": {
"type": "Identifier",
"start":64,"end":65,"loc":{"start":{"line":2,"column":41},"end":{"line":2,"column":42},"identifierName":"e"},
"name": "e"
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,110 @@
{
"type": "File",
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}},
"program": {
"type": "Program",
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":49}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":49,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":49}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":49,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":49}},
"body": [
{
"type": "ForStatement",
"start":14,"end":47,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":47}},
"init": {
"type": "VariableDeclaration",
"start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28}},
"declarations": [
{
"type": "VariableDeclarator",
"start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}},
"id": {
"type": "Identifier",
"start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"i"},
"name": "i"
},
"init": {
"type": "NumericLiteral",
"start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
],
"kind": "let"
},
"test": {
"type": "BinaryExpression",
"start":30,"end":35,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":35}},
"left": {
"type": "Identifier",
"start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31},"identifierName":"i"},
"name": "i"
},
"operator": "<",
"right": {
"type": "Identifier",
"start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35},"identifierName":"n"},
"name": "n"
}
},
"update": {
"type": "AssignmentExpression",
"start":37,"end":43,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":43}},
"operator": "+=",
"left": {
"type": "Identifier",
"start":37,"end":38,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":38},"identifierName":"i"},
"name": "i"
},
"right": {
"type": "NumericLiteral",
"start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43}},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
},
"body": {
"type": "ExpressionStatement",
"start":45,"end":47,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":47}},
"expression": {
"type": "TopicReference",
"start":45,"end":46,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":46}}
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1 @@
value |> do { for (let i = %; predicate(i, %); i += %) i; }

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,106 @@
{
"type": "File",
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}},
"program": {
"type": "Program",
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":59}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":59,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":59}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":59,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":59}},
"body": [
{
"type": "ForStatement",
"start":14,"end":57,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":57}},
"init": {
"type": "VariableDeclaration",
"start":19,"end":28,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":28}},
"declarations": [
{
"type": "VariableDeclarator",
"start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}},
"id": {
"type": "Identifier",
"start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"i"},
"name": "i"
},
"init": {
"type": "TopicReference",
"start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}}
}
}
],
"kind": "let"
},
"test": {
"type": "CallExpression",
"start":30,"end":45,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":45}},
"callee": {
"type": "Identifier",
"start":30,"end":39,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":39},"identifierName":"predicate"},
"name": "predicate"
},
"arguments": [
{
"type": "Identifier",
"start":40,"end":41,"loc":{"start":{"line":1,"column":40},"end":{"line":1,"column":41},"identifierName":"i"},
"name": "i"
},
{
"type": "TopicReference",
"start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44}}
}
]
},
"update": {
"type": "AssignmentExpression",
"start":47,"end":53,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":53}},
"operator": "+=",
"left": {
"type": "Identifier",
"start":47,"end":48,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":48},"identifierName":"i"},
"name": "i"
},
"right": {
"type": "TopicReference",
"start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53}}
}
},
"body": {
"type": "ExpressionStatement",
"start":55,"end":57,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":57}},
"expression": {
"type": "Identifier",
"start":55,"end":56,"loc":{"start":{"line":1,"column":55},"end":{"line":1,"column":56},"identifierName":"i"},
"name": "i"
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,61 @@
{
"type": "File",
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
"program": {
"type": "Program",
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":36,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":36}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":36,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":36}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":36,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":36}},
"body": [
{
"type": "ForInStatement",
"start":14,"end":34,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":34}},
"left": {
"type": "Identifier",
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"e"},
"name": "e"
},
"right": {
"type": "Identifier",
"start":24,"end":30,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":30},"identifierName":"object"},
"name": "object"
},
"body": {
"type": "ExpressionStatement",
"start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}},
"expression": {
"type": "TopicReference",
"start":32,"end":33,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":33}}
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,61 @@
{
"type": "File",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
"program": {
"type": "Program",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":31,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":31}},
"body": [
{
"type": "ForInStatement",
"start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}},
"left": {
"type": "Identifier",
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"e"},
"name": "e"
},
"right": {
"type": "TopicReference",
"start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}
},
"body": {
"type": "ExpressionStatement",
"start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}},
"expression": {
"type": "Identifier",
"start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"e"},
"name": "e"
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,62 @@
{
"type": "File",
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}},
"program": {
"type": "Program",
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":38,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":38}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":38,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":38}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":38,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":38}},
"body": [
{
"type": "ForOfStatement",
"start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}},
"await": false,
"left": {
"type": "Identifier",
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"e"},
"name": "e"
},
"right": {
"type": "Identifier",
"start":24,"end":32,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":32},"identifierName":"sequence"},
"name": "sequence"
},
"body": {
"type": "ExpressionStatement",
"start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}},
"expression": {
"type": "TopicReference",
"start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}}
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,62 @@
{
"type": "File",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
"program": {
"type": "Program",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":31,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":31}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":31,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":31}},
"body": [
{
"type": "ForOfStatement",
"start":14,"end":29,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":29}},
"await": false,
"left": {
"type": "Identifier",
"start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"e"},
"name": "e"
},
"right": {
"type": "TopicReference",
"start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}}
},
"body": {
"type": "ExpressionStatement",
"start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}},
"expression": {
"type": "Identifier",
"start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28},"identifierName":"e"},
"name": "e"
}
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

View File

@ -0,0 +1,74 @@
{
"type": "File",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}},
"program": {
"type": "Program",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}},
"expression": {
"type": "BinaryExpression",
"start":0,"end":46,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":46}},
"left": {
"type": "Identifier",
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"},
"name": "value"
},
"operator": "|>",
"right": {
"type": "DoExpression",
"start":9,"end":46,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":46}},
"async": false,
"body": {
"type": "BlockStatement",
"start":12,"end":46,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":46}},
"body": [
{
"type": "IfStatement",
"start":14,"end":44,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":44}},
"test": {
"type": "Identifier",
"start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"yes"},
"name": "yes"
},
"consequent": {
"type": "ExpressionStatement",
"start":23,"end":28,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":28}},
"expression": {
"type": "NullLiteral",
"start":23,"end":27,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":27}}
}
},
"alternate": {
"type": "IfStatement",
"start":34,"end":44,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":44}},
"test": {
"type": "Identifier",
"start":38,"end":40,"loc":{"start":{"line":1,"column":38},"end":{"line":1,"column":40},"identifierName":"no"},
"name": "no"
},
"consequent": {
"type": "ExpressionStatement",
"start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}},
"expression": {
"type": "TopicReference",
"start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43}}
}
},
"alternate": null
}
}
],
"directives": []
}
}
}
}
],
"directives": []
}
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }], "doExpressions"]
}

Some files were not shown because too many files have changed in this diff Show More