Merge pull request #8289 from valtech-nyc/implement-smart-pipeline-in-parser
Implement Smart Pipeline proposal in @babel/parser
This commit is contained in:
commit
fdc869ce16
@ -297,18 +297,21 @@ export default class ExpressionParser extends LValParser {
|
||||
}
|
||||
|
||||
const op = this.state.type;
|
||||
if (op === tt.nullishCoalescing) {
|
||||
this.expectPlugin("nullishCoalescingOperator");
|
||||
} else if (op === tt.pipeline) {
|
||||
|
||||
if (op === tt.pipeline) {
|
||||
this.expectPlugin("pipelineOperator");
|
||||
this.state.inPipeline = true;
|
||||
this.checkPipelineAtInfixOperator(left, leftStartPos);
|
||||
} else if (op === tt.nullishCoalescing) {
|
||||
this.expectPlugin("nullishCoalescingOperator");
|
||||
}
|
||||
|
||||
this.next();
|
||||
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
|
||||
if (op === tt.pipeline) {
|
||||
if (
|
||||
op === tt.pipeline &&
|
||||
this.getPluginOption("pipelineOperator", "proposal") === "minimal"
|
||||
) {
|
||||
if (
|
||||
this.match(tt.name) &&
|
||||
this.state.value === "await" &&
|
||||
@ -321,13 +324,7 @@ export default class ExpressionParser extends LValParser {
|
||||
}
|
||||
}
|
||||
|
||||
node.right = this.parseExprOp(
|
||||
this.parseMaybeUnary(),
|
||||
startPos,
|
||||
startLoc,
|
||||
op.rightAssociative ? prec - 1 : prec,
|
||||
noIn,
|
||||
);
|
||||
node.right = this.parseExprOpRightExpr(op, prec, noIn);
|
||||
|
||||
this.finishNode(
|
||||
node,
|
||||
@ -337,6 +334,7 @@ export default class ExpressionParser extends LValParser {
|
||||
? "LogicalExpression"
|
||||
: "BinaryExpression",
|
||||
);
|
||||
|
||||
return this.parseExprOp(
|
||||
node,
|
||||
leftStartPos,
|
||||
@ -349,6 +347,54 @@ export default class ExpressionParser extends LValParser {
|
||||
return left;
|
||||
}
|
||||
|
||||
// Helper function for `parseExprOp`. Parse the right-hand side of binary-
|
||||
// operator expressions, then apply any operator-specific functions.
|
||||
|
||||
parseExprOpRightExpr(
|
||||
op: TokenType,
|
||||
prec: number,
|
||||
noIn: ?boolean,
|
||||
): N.Expression {
|
||||
switch (op) {
|
||||
case tt.pipeline:
|
||||
if (this.getPluginOption("pipelineOperator", "proposal") === "smart") {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
return this.withTopicPermittingContext(() => {
|
||||
return this.parseSmartPipelineBody(
|
||||
this.parseExprOpBaseRightExpr(op, prec, noIn),
|
||||
startPos,
|
||||
startLoc,
|
||||
);
|
||||
});
|
||||
}
|
||||
// falls through
|
||||
|
||||
default:
|
||||
return this.parseExprOpBaseRightExpr(op, prec, noIn);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function for `parseExprOpRightExpr`. Parse the right-hand side of
|
||||
// binary-operator expressions without applying any operator-specific functions.
|
||||
|
||||
parseExprOpBaseRightExpr(
|
||||
op: TokenType,
|
||||
prec: number,
|
||||
noIn: ?boolean,
|
||||
): N.Expression {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
|
||||
return this.parseExprOp(
|
||||
this.parseMaybeUnary(),
|
||||
startPos,
|
||||
startLoc,
|
||||
op.rightAssociative ? prec - 1 : prec,
|
||||
noIn,
|
||||
);
|
||||
}
|
||||
|
||||
// Parse unary operators, both prefix and postfix.
|
||||
|
||||
parseMaybeUnary(refShorthandDefaultPos: ?Pos): N.Expression {
|
||||
@ -936,6 +982,32 @@ export default class ExpressionParser extends LValParser {
|
||||
}
|
||||
}
|
||||
|
||||
case tt.hash: {
|
||||
if (this.state.inPipeline) {
|
||||
node = this.startNode();
|
||||
|
||||
if (
|
||||
this.getPluginOption("pipelineOperator", "proposal") !== "smart"
|
||||
) {
|
||||
this.raise(
|
||||
node.start,
|
||||
"Primary Topic Reference found but pipelineOperator not passed 'smart' for 'proposal' option.",
|
||||
);
|
||||
}
|
||||
|
||||
this.next();
|
||||
if (this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) {
|
||||
this.registerTopicReference();
|
||||
return this.finishNode(node, "PipelinePrimaryTopicReference");
|
||||
} else {
|
||||
throw this.raise(
|
||||
node.start,
|
||||
`Topic reference was used in a lexical context without topic binding`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
throw this.unexpected();
|
||||
}
|
||||
@ -2037,4 +2109,180 @@ export default class ExpressionParser extends LValParser {
|
||||
}
|
||||
return this.finishNode(node, "YieldExpression");
|
||||
}
|
||||
|
||||
// Validates a pipeline (for any of the pipeline Babylon plugins) at the point
|
||||
// of the infix operator `|>`.
|
||||
|
||||
checkPipelineAtInfixOperator(left: N.Expression, leftStartPos: number) {
|
||||
if (this.getPluginOption("pipelineOperator", "proposal") === "smart") {
|
||||
if (left.type === "SequenceExpression") {
|
||||
// Ensure that the pipeline head is not a comma-delimited
|
||||
// sequence expression.
|
||||
throw this.raise(
|
||||
leftStartPos,
|
||||
`Pipeline head should not be a comma-separated sequence expression`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parseSmartPipelineBody(
|
||||
childExpression: N.Expression,
|
||||
startPos: number,
|
||||
startLoc: Position,
|
||||
): N.PipelineBody {
|
||||
const pipelineStyle = this.checkSmartPipelineBodyStyle(childExpression);
|
||||
|
||||
this.checkSmartPipelineBodyEarlyErrors(
|
||||
childExpression,
|
||||
pipelineStyle,
|
||||
startPos,
|
||||
);
|
||||
|
||||
return this.parseSmartPipelineBodyInStyle(
|
||||
childExpression,
|
||||
pipelineStyle,
|
||||
startPos,
|
||||
startLoc,
|
||||
);
|
||||
}
|
||||
|
||||
checkSmartPipelineBodyEarlyErrors(
|
||||
childExpression: N.Expression,
|
||||
pipelineStyle: N.PipelineStyle,
|
||||
startPos: number,
|
||||
): void {
|
||||
if (this.match(tt.arrow)) {
|
||||
// If the following token is invalidly `=>`, then throw a human-friendly error
|
||||
// instead of something like 'Unexpected token, expected ";"'.
|
||||
throw this.raise(
|
||||
this.state.start,
|
||||
`Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized`,
|
||||
);
|
||||
} else if (
|
||||
pipelineStyle === "PipelineTopicExpression" &&
|
||||
childExpression.type === "SequenceExpression"
|
||||
) {
|
||||
throw this.raise(
|
||||
startPos,
|
||||
`Pipeline body may not be a comma-separated sequence expression`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
parseSmartPipelineBodyInStyle(
|
||||
childExpression: N.Expression,
|
||||
pipelineStyle: N.PipelineStyle,
|
||||
startPos: number,
|
||||
startLoc: Position,
|
||||
): N.PipelineBody {
|
||||
const bodyNode = this.startNodeAt(startPos, startLoc);
|
||||
switch (pipelineStyle) {
|
||||
case "PipelineBareFunction":
|
||||
bodyNode.callee = childExpression;
|
||||
break;
|
||||
case "PipelineBareConstructor":
|
||||
bodyNode.callee = childExpression.callee;
|
||||
break;
|
||||
case "PipelineBareAwaitedFunction":
|
||||
bodyNode.callee = childExpression.argument;
|
||||
break;
|
||||
case "PipelineTopicExpression":
|
||||
if (!this.topicReferenceWasUsedInCurrentTopicContext()) {
|
||||
throw this.raise(
|
||||
startPos,
|
||||
`Pipeline is in topic style but does not use topic reference`,
|
||||
);
|
||||
}
|
||||
bodyNode.expression = childExpression;
|
||||
break;
|
||||
default:
|
||||
throw this.raise(startPos, `Unknown pipeline style ${pipelineStyle}`);
|
||||
}
|
||||
return this.finishNode(bodyNode, pipelineStyle);
|
||||
}
|
||||
|
||||
checkSmartPipelineBodyStyle(expression: N.Expression): N.PipelineStyle {
|
||||
switch (expression.type) {
|
||||
default:
|
||||
return this.isSimpleReference(expression)
|
||||
? "PipelineBareFunction"
|
||||
: "PipelineTopicExpression";
|
||||
}
|
||||
}
|
||||
|
||||
isSimpleReference(expression: N.Expression): boolean {
|
||||
switch (expression.type) {
|
||||
case "MemberExpression":
|
||||
return (
|
||||
!expression.computed && this.isSimpleReference(expression.object)
|
||||
);
|
||||
case "Identifier":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Enable topic references from outer contexts within smart pipeline bodies.
|
||||
// The function modifies the parser's topic-context state to enable or disable
|
||||
// the use of topic references with the smartPipelines plugin. They then run a
|
||||
// callback, then they reset the parser to the old topic-context state that it
|
||||
// had before the function was called.
|
||||
|
||||
withTopicPermittingContext<T>(callback: () => T): T {
|
||||
const outerContextTopicState = this.state.topicContext;
|
||||
this.state.topicContext = {
|
||||
// Enable the use of the primary topic reference.
|
||||
maxNumOfResolvableTopics: 1,
|
||||
// Hide the use of any topic references from outer contexts.
|
||||
maxTopicIndex: null,
|
||||
};
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
this.state.topicContext = outerContextTopicState;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable topic references from outer contexts within syntax constructs
|
||||
// such as the bodies of iteration statements.
|
||||
// The function modifies the parser's topic-context state to enable or disable
|
||||
// the use of topic references with the smartPipelines plugin. They then run a
|
||||
// callback, then they reset the parser to the old topic-context state that it
|
||||
// had before the function was called.
|
||||
|
||||
withTopicForbiddingContext<T>(callback: () => T): T {
|
||||
const outerContextTopicState = this.state.topicContext;
|
||||
this.state.topicContext = {
|
||||
// Disable the use of the primary topic reference.
|
||||
maxNumOfResolvableTopics: 0,
|
||||
// Hide the use of any topic references from outer contexts.
|
||||
maxTopicIndex: null,
|
||||
};
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
this.state.topicContext = outerContextTopicState;
|
||||
}
|
||||
}
|
||||
|
||||
// Register the use of a primary topic reference (`#`) within the current
|
||||
// topic context.
|
||||
registerTopicReference(): void {
|
||||
this.state.topicContext.maxTopicIndex = 0;
|
||||
}
|
||||
|
||||
primaryTopicReferenceIsAllowedInCurrentTopicContext(): boolean {
|
||||
return this.state.topicContext.maxNumOfResolvableTopics >= 1;
|
||||
}
|
||||
|
||||
topicReferenceWasUsedInCurrentTopicContext(): boolean {
|
||||
return (
|
||||
this.state.topicContext.maxTopicIndex != null &&
|
||||
this.state.topicContext.maxTopicIndex >= 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,8 +369,18 @@ export default class StatementParser extends ExpressionParser {
|
||||
parseDoStatement(node: N.DoWhileStatement): N.DoWhileStatement {
|
||||
this.next();
|
||||
this.state.labels.push(loopLabel);
|
||||
node.body = this.parseStatement(false);
|
||||
|
||||
node.body =
|
||||
// For the smartPipelines plugin: Disable topic references from outer
|
||||
// contexts within the loop body. They are permitted in test expressions,
|
||||
// outside of the loop body.
|
||||
this.withTopicForbiddingContext(() =>
|
||||
// Parse the loop body's body.
|
||||
this.parseStatement(false),
|
||||
);
|
||||
|
||||
this.state.labels.pop();
|
||||
|
||||
this.expect(tt._while);
|
||||
node.test = this.parseParenExpression();
|
||||
this.eat(tt.semi);
|
||||
@ -557,7 +567,17 @@ export default class StatementParser extends ExpressionParser {
|
||||
} else {
|
||||
clause.param = null;
|
||||
}
|
||||
clause.body = this.parseBlock();
|
||||
|
||||
clause.body =
|
||||
// For the smartPipelines plugin: Disable topic references from outer
|
||||
// contexts within the function body. They are permitted in function
|
||||
// default-parameter expressions, which are part of the outer context,
|
||||
// outside of the function body.
|
||||
this.withTopicForbiddingContext(() =>
|
||||
// Parse the catch clause's body.
|
||||
this.parseBlock(false),
|
||||
);
|
||||
|
||||
node.handler = this.finishNode(clause, "CatchClause");
|
||||
}
|
||||
|
||||
@ -585,8 +605,18 @@ export default class StatementParser extends ExpressionParser {
|
||||
this.next();
|
||||
node.test = this.parseParenExpression();
|
||||
this.state.labels.push(loopLabel);
|
||||
node.body = this.parseStatement(false);
|
||||
|
||||
node.body =
|
||||
// For the smartPipelines plugin:
|
||||
// Disable topic references from outer contexts within the loop body.
|
||||
// They are permitted in test expressions, outside of the loop body.
|
||||
this.withTopicForbiddingContext(() =>
|
||||
// Parse loop body.
|
||||
this.parseStatement(false),
|
||||
);
|
||||
|
||||
this.state.labels.pop();
|
||||
|
||||
return this.finishNode(node, "WhileStatement");
|
||||
}
|
||||
|
||||
@ -596,7 +626,17 @@ export default class StatementParser extends ExpressionParser {
|
||||
}
|
||||
this.next();
|
||||
node.object = this.parseParenExpression();
|
||||
node.body = this.parseStatement(false);
|
||||
|
||||
node.body =
|
||||
// For the smartPipelines plugin:
|
||||
// Disable topic references from outer contexts within the function body.
|
||||
// They are permitted in function default-parameter expressions, which are
|
||||
// part of the outer context, outside of the function body.
|
||||
this.withTopicForbiddingContext(() =>
|
||||
// Parse the statement body.
|
||||
this.parseStatement(false),
|
||||
);
|
||||
|
||||
return this.finishNode(node, "WithStatement");
|
||||
}
|
||||
|
||||
@ -753,8 +793,18 @@ export default class StatementParser extends ExpressionParser {
|
||||
this.expect(tt.semi);
|
||||
node.update = this.match(tt.parenR) ? null : this.parseExpression();
|
||||
this.expect(tt.parenR);
|
||||
node.body = this.parseStatement(false);
|
||||
|
||||
node.body =
|
||||
// For the smartPipelines plugin: Disable topic references from outer
|
||||
// contexts within the loop body. They are permitted in test expressions,
|
||||
// outside of the loop body.
|
||||
this.withTopicForbiddingContext(() =>
|
||||
// Parse the loop body.
|
||||
this.parseStatement(false),
|
||||
);
|
||||
|
||||
this.state.labels.pop();
|
||||
|
||||
return this.finishNode(node, "ForStatement");
|
||||
}
|
||||
|
||||
@ -778,8 +828,18 @@ export default class StatementParser extends ExpressionParser {
|
||||
node.left = init;
|
||||
node.right = this.parseExpression();
|
||||
this.expect(tt.parenR);
|
||||
node.body = this.parseStatement(false);
|
||||
|
||||
node.body =
|
||||
// For the smartPipelines plugin:
|
||||
// Disable topic references from outer contexts within the loop body.
|
||||
// They are permitted in test expressions, outside of the loop body.
|
||||
this.withTopicForbiddingContext(() =>
|
||||
// Parse loop body.
|
||||
this.parseStatement(false),
|
||||
);
|
||||
|
||||
this.state.labels.pop();
|
||||
|
||||
return this.finishNode(node, type);
|
||||
}
|
||||
|
||||
@ -887,11 +947,18 @@ export default class StatementParser extends ExpressionParser {
|
||||
}
|
||||
|
||||
this.parseFunctionParams(node);
|
||||
this.parseFunctionBodyAndFinish(
|
||||
node,
|
||||
isStatement ? "FunctionDeclaration" : "FunctionExpression",
|
||||
allowExpressionBody,
|
||||
);
|
||||
|
||||
// For the smartPipelines plugin: Disable topic references from outer
|
||||
// contexts within the function body. They are permitted in test
|
||||
// expressions, outside of the function body.
|
||||
this.withTopicForbiddingContext(() => {
|
||||
// Parse the function body.
|
||||
this.parseFunctionBodyAndFinish(
|
||||
node,
|
||||
isStatement ? "FunctionDeclaration" : "FunctionExpression",
|
||||
allowExpressionBody,
|
||||
);
|
||||
});
|
||||
|
||||
this.state.inFunction = oldInFunc;
|
||||
this.state.inMethod = oldInMethod;
|
||||
@ -966,44 +1033,49 @@ export default class StatementParser extends ExpressionParser {
|
||||
|
||||
this.expect(tt.braceL);
|
||||
|
||||
while (!this.eat(tt.braceR)) {
|
||||
if (this.eat(tt.semi)) {
|
||||
if (decorators.length > 0) {
|
||||
// For the smartPipelines plugin: Disable topic references from outer
|
||||
// contexts within the class body. They are permitted in test expressions,
|
||||
// outside of the class body.
|
||||
this.withTopicForbiddingContext(() => {
|
||||
while (!this.eat(tt.braceR)) {
|
||||
if (this.eat(tt.semi)) {
|
||||
if (decorators.length > 0) {
|
||||
this.raise(
|
||||
this.state.lastTokEnd,
|
||||
"Decorators must not be followed by a semicolon",
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.match(tt.at)) {
|
||||
decorators.push(this.parseDecorator());
|
||||
continue;
|
||||
}
|
||||
|
||||
const member = this.startNode();
|
||||
|
||||
// steal the decorators if there are any
|
||||
if (decorators.length) {
|
||||
member.decorators = decorators;
|
||||
this.resetStartLocationFromNode(member, decorators[0]);
|
||||
decorators = [];
|
||||
}
|
||||
|
||||
this.parseClassMember(classBody, member, state);
|
||||
|
||||
if (
|
||||
member.kind === "constructor" &&
|
||||
member.decorators &&
|
||||
member.decorators.length > 0
|
||||
) {
|
||||
this.raise(
|
||||
this.state.lastTokEnd,
|
||||
"Decorators must not be followed by a semicolon",
|
||||
member.start,
|
||||
"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.match(tt.at)) {
|
||||
decorators.push(this.parseDecorator());
|
||||
continue;
|
||||
}
|
||||
|
||||
const member = this.startNode();
|
||||
|
||||
// steal the decorators if there are any
|
||||
if (decorators.length) {
|
||||
member.decorators = decorators;
|
||||
this.resetStartLocationFromNode(member, decorators[0]);
|
||||
decorators = [];
|
||||
}
|
||||
|
||||
this.parseClassMember(classBody, member, state);
|
||||
|
||||
if (
|
||||
member.kind === "constructor" &&
|
||||
member.decorators &&
|
||||
member.decorators.length > 0
|
||||
) {
|
||||
this.raise(
|
||||
member.start,
|
||||
"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (decorators.length) {
|
||||
this.raise(
|
||||
|
||||
@ -38,7 +38,7 @@ export function getPluginOption(
|
||||
return null;
|
||||
}
|
||||
|
||||
const PIPELINE_PROPOSALS = ["minimal"];
|
||||
const PIPELINE_PROPOSALS = ["minimal", "smart"];
|
||||
|
||||
export function validatePlugins(plugins: PluginList) {
|
||||
if (hasPlugin(plugins, "decorators")) {
|
||||
@ -77,7 +77,7 @@ export function validatePlugins(plugins: PluginList) {
|
||||
) {
|
||||
throw new Error(
|
||||
"'pipelineOperator' requires 'proposal' option whose value should be one of: " +
|
||||
PIPELINE_PROPOSALS.join(", "),
|
||||
PIPELINE_PROPOSALS.map(p => `'${p}'`).join(", "),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,7 +374,36 @@ export default class Tokenizer extends LocationParser {
|
||||
// into it.
|
||||
//
|
||||
// All in the name of speed.
|
||||
//
|
||||
|
||||
// number sign is "#"
|
||||
readToken_numberSign(): void {
|
||||
if (this.state.pos === 0 && this.readToken_interpreter()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nextPos = this.state.pos + 1;
|
||||
const next = this.input.charCodeAt(nextPos);
|
||||
if (next >= charCodes.digit0 && next <= charCodes.digit9) {
|
||||
this.raise(this.state.pos, "Unexpected digit after hash token");
|
||||
}
|
||||
|
||||
if (
|
||||
(this.hasPlugin("classPrivateProperties") ||
|
||||
this.hasPlugin("classPrivateMethods")) &&
|
||||
this.state.classLevel > 0
|
||||
) {
|
||||
++this.state.pos;
|
||||
this.finishToken(tt.hash);
|
||||
return;
|
||||
} else if (
|
||||
this.getPluginOption("pipelineOperator", "proposal") === "smart"
|
||||
) {
|
||||
this.finishOp(tt.hash, 1);
|
||||
} else {
|
||||
this.raise(this.state.pos, "Unexpected character '#'");
|
||||
}
|
||||
}
|
||||
|
||||
readToken_dot(): void {
|
||||
const next = this.input.charCodeAt(this.state.pos + 1);
|
||||
if (next >= charCodes.digit0 && next <= charCodes.digit9) {
|
||||
@ -623,24 +652,8 @@ export default class Tokenizer extends LocationParser {
|
||||
getTokenFromCode(code: number): void {
|
||||
switch (code) {
|
||||
case charCodes.numberSign:
|
||||
if (this.state.pos === 0 && this.readToken_interpreter()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
(this.hasPlugin("classPrivateProperties") ||
|
||||
this.hasPlugin("classPrivateMethods")) &&
|
||||
this.state.classLevel > 0
|
||||
) {
|
||||
++this.state.pos;
|
||||
this.finishToken(tt.hash);
|
||||
return;
|
||||
} else {
|
||||
this.raise(
|
||||
this.state.pos,
|
||||
`Unexpected character '${String.fromCodePoint(code)}'`,
|
||||
);
|
||||
}
|
||||
this.readToken_numberSign();
|
||||
return;
|
||||
|
||||
// The interpretation of a dot depends on whether it is followed
|
||||
// by a digit or another two dots.
|
||||
|
||||
@ -6,7 +6,7 @@ import { Position } from "../util/location";
|
||||
|
||||
import { types as ct, type TokContext } from "./context";
|
||||
import type { Token } from "./index";
|
||||
import { types as tt, type TokenType } from "./types";
|
||||
import { types as tt, type TokenType, type TopicContextState } from "./types";
|
||||
|
||||
export default class State {
|
||||
init(options: Options, input: string): void {
|
||||
@ -26,6 +26,7 @@ export default class State {
|
||||
this.maybeInArrowParameters = false;
|
||||
this.inGenerator = false;
|
||||
this.inAsync = false;
|
||||
this.inPipeline = false;
|
||||
this.inPropertyName = false;
|
||||
this.inType = false;
|
||||
this.inClassProperty = false;
|
||||
@ -33,6 +34,12 @@ export default class State {
|
||||
this.hasFlowComment = false;
|
||||
this.isIterator = false;
|
||||
|
||||
// Used by smartPipelines.
|
||||
this.topicContext = {
|
||||
maxNumOfResolvableTopics: 0,
|
||||
maxTopicIndex: null,
|
||||
};
|
||||
|
||||
this.classLevel = 0;
|
||||
|
||||
this.labels = [];
|
||||
@ -104,6 +111,7 @@ export default class State {
|
||||
inGenerator: boolean;
|
||||
inMethod: boolean | N.MethodKind;
|
||||
inAsync: boolean;
|
||||
inPipeline: boolean;
|
||||
inType: boolean;
|
||||
noAnonFunctionType: boolean;
|
||||
inPropertyName: boolean;
|
||||
@ -111,6 +119,9 @@ export default class State {
|
||||
hasFlowComment: boolean;
|
||||
isIterator: boolean;
|
||||
|
||||
// For the smartPipelines plugin:
|
||||
topicContext: TopicContextState;
|
||||
|
||||
// Check whether we are in a (nested) class or not.
|
||||
classLevel: number;
|
||||
|
||||
|
||||
@ -193,3 +193,17 @@ export const keywords = {
|
||||
Object.keys(keywords).forEach(name => {
|
||||
types["_" + name] = keywords[name];
|
||||
});
|
||||
|
||||
// A type for the smartPipelines plugin.
|
||||
export type TopicContextState = {
|
||||
// When a topic binding has been currently established,
|
||||
// then this is 1. Otherwise, it is 0. This is forwards compatible
|
||||
// with a future plugin for multiple lexical topics.
|
||||
maxNumOfResolvableTopics: number,
|
||||
|
||||
// When a topic binding has been currently established, and if that binding
|
||||
// has been used as a topic reference `#`, then this is 0. Otherwise, it is
|
||||
// `null`. This is forwards compatible with a future plugin for multiple
|
||||
// lexical topics.
|
||||
maxTopicIndex: null | 0,
|
||||
};
|
||||
|
||||
@ -566,6 +566,38 @@ export type SequenceExpression = NodeBase & {
|
||||
expressions: $ReadOnlyArray<Expression>,
|
||||
};
|
||||
|
||||
// Pipelines
|
||||
|
||||
export type PipelineBody = NodeBase & {
|
||||
type: "PipelineBody",
|
||||
};
|
||||
|
||||
export type PipelineBareFunctionBody = NodeBase & {
|
||||
type: "PipelineBareFunctionBody",
|
||||
callee: Expression,
|
||||
};
|
||||
|
||||
export type PipelineBareConstructorBody = NodeBase & {
|
||||
type: "PipelineBareConstructorBody",
|
||||
callee: Expression,
|
||||
};
|
||||
|
||||
export type PipelineBareAwaitedFunctionBody = NodeBase & {
|
||||
type: "PipelineBareAwaitedFunctionBody",
|
||||
callee: Expression,
|
||||
};
|
||||
|
||||
export type PipelineTopicBody = NodeBase & {
|
||||
type: "PipelineTopicBody",
|
||||
expression: Expression,
|
||||
};
|
||||
|
||||
export type PipelineStyle =
|
||||
| "PipelineBareFunction"
|
||||
| "PipelineBareConstructor"
|
||||
| "PipelineBareAwaitedFunction"
|
||||
| "PipelineTopicExpression";
|
||||
|
||||
// Template Literals
|
||||
|
||||
export type TemplateLiteral = NodeBase & {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"throws": "Unexpected token (2:3)",
|
||||
"plugins": ["classPrivateProperties"]
|
||||
"throws": "Unexpected digit after hash token (2:2)",
|
||||
"plugins": [ "classPrivateProperties" ]
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"throws": "Identifier directly after number (2:4)",
|
||||
"throws": "Unexpected digit after hash token (2:2)",
|
||||
"plugins": ["classPrivateProperties"]
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "invalid" }]],
|
||||
"throws": "'pipelineOperator' requires 'proposal' option whose value should be one of: minimal"
|
||||
"plugins": [
|
||||
["pipelineOperator", { "proposal": "invalid" }]
|
||||
],
|
||||
"throws": "'pipelineOperator' requires 'proposal' option whose value should be one of: 'minimal', 'smart'"
|
||||
}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
let result = "hello"
|
||||
|> doubleSay
|
||||
|> text.capitalize
|
||||
|> a.b.exclaim;
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,348 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 4,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 4,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 4
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"identifierName": "result"
|
||||
},
|
||||
"name": "result"
|
||||
},
|
||||
"init": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 13,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 13,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 13,
|
||||
"end": 33,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "StringLiteral",
|
||||
"start": 13,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "hello",
|
||||
"raw": "\"hello\""
|
||||
},
|
||||
"value": "hello"
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineBareFunction",
|
||||
"start": 24,
|
||||
"end": 33,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 24,
|
||||
"end": 33,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "doubleSay"
|
||||
},
|
||||
"name": "doubleSay"
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineBareFunction",
|
||||
"start": 37,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "MemberExpression",
|
||||
"start": 37,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start": 37,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 7
|
||||
},
|
||||
"identifierName": "text"
|
||||
},
|
||||
"name": "text"
|
||||
},
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start": 42,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 18
|
||||
},
|
||||
"identifierName": "capitalize"
|
||||
},
|
||||
"name": "capitalize"
|
||||
},
|
||||
"computed": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineBareFunction",
|
||||
"start": 56,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "MemberExpression",
|
||||
"start": 56,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"object": {
|
||||
"type": "MemberExpression",
|
||||
"start": 56,
|
||||
"end": 59,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 6
|
||||
}
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start": 56,
|
||||
"end": 57,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 4
|
||||
},
|
||||
"identifierName": "a"
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start": 58,
|
||||
"end": 59,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 6
|
||||
},
|
||||
"identifierName": "b"
|
||||
},
|
||||
"name": "b"
|
||||
},
|
||||
"computed": false
|
||||
},
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start": 60,
|
||||
"end": 67,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 14
|
||||
},
|
||||
"identifierName": "exclaim"
|
||||
},
|
||||
"name": "exclaim"
|
||||
},
|
||||
"computed": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "let"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x => x |> number.inc |> double
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,233 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start": 0,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 1,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 1
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 5,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 5,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "Identifier",
|
||||
"start": 5,
|
||||
"end": 6,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineBareFunction",
|
||||
"start": 10,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "MemberExpression",
|
||||
"start": 10,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
}
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start": 10,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"identifierName": "number"
|
||||
},
|
||||
"name": "number"
|
||||
},
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 20,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"identifierName": "inc"
|
||||
},
|
||||
"name": "inc"
|
||||
},
|
||||
"computed": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineBareFunction",
|
||||
"start": 24,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 24,
|
||||
"end": 30,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 30
|
||||
},
|
||||
"identifierName": "double"
|
||||
},
|
||||
"name": "double"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> f
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"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": "PipelineBareFunction",
|
||||
"start": 9,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"identifierName": "f"
|
||||
},
|
||||
"name": "f"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> a.b.c.f
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,214 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"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": "PipelineBareFunction",
|
||||
"start": 9,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "MemberExpression",
|
||||
"start": 9,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
}
|
||||
},
|
||||
"object": {
|
||||
"type": "MemberExpression",
|
||||
"start": 9,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"object": {
|
||||
"type": "MemberExpression",
|
||||
"start": 9,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"object": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"identifierName": "a"
|
||||
},
|
||||
"name": "a"
|
||||
},
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "b"
|
||||
},
|
||||
"name": "b"
|
||||
},
|
||||
"computed": false
|
||||
},
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"identifierName": "c"
|
||||
},
|
||||
"name": "c"
|
||||
},
|
||||
"computed": false
|
||||
},
|
||||
"property": {
|
||||
"type": "Identifier",
|
||||
"start": 15,
|
||||
"end": 16,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"identifierName": "f"
|
||||
},
|
||||
"name": "f"
|
||||
},
|
||||
"computed": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
(1, 2) |> f;
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline head should not be a comma-separated sequence expression (1:0)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> #42;
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Unexpected digit after hash token (1:5)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> ($ => $ |> f)
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:5)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> ($ => # |> $ + 1)
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:16)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> ($ => $ |> #)
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:5)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> (# |> f())
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:11)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> ($ |> f)
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:5)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
10 |> (#, #) |> h;
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline body may not be a comma-separated sequence expression (1:6)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
10 |> (#, #);
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline body may not be a comma-separated sequence expression (1:6)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> a[b]
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:9)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> a + b
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:9)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> class { }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:9)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> function (x) { return; }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Pipeline is in topic style but does not use topic reference (1:9)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> do { do x += # while (x < 50); }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:22)"
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
async function af () {
|
||||
value |> do { for await (const e of sequence) #; }
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions", "asyncGenerators"],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (2:48)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> do { for (let i = 0; i < n; i += 1) #; }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:45)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> do { for (e in object) #; }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:32)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> do { for (e of sequence) #; }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:34)"
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
value |> do {
|
||||
try { JSON.parse(#); }
|
||||
catch (error) { console.error(#); }
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (3:32)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> do { while (x < 50) x += #; }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:34)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> do { with ({}) #; }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:24)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
10 |> x => x + #;
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Unexpected arrow \"=>\" after pipeline body; arrow function in pipeline body must be parenthesized (1:8)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> class { constructor () { this.x = #; } }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:39)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> function () { # }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:19)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> function () { # |> # }
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Topic reference was used in a lexical context without topic binding (1:19)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
1 + #
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
|
||||
"throws": "Unexpected token (1:4)"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> (() => # |> f)
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,184 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"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": "PipelineTopicExpression",
|
||||
"start": 5,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start": 6,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 12,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "PipelinePrimaryTopicReference",
|
||||
"start": 12,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineBareFunction",
|
||||
"start": 17,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 17,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
},
|
||||
"identifierName": "f"
|
||||
},
|
||||
"name": "f"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> ($ => # |> f(#, $))
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,251 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"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": "PipelineTopicExpression",
|
||||
"start": 5,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "ArrowFunctionExpression",
|
||||
"start": 6,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"id": null,
|
||||
"generator": false,
|
||||
"async": false,
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"identifierName": "$"
|
||||
},
|
||||
"name": "$"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 11,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "PipelinePrimaryTopicReference",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineTopicExpression",
|
||||
"start": 16,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start": 16,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 16,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"identifierName": "f"
|
||||
},
|
||||
"name": "f"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "PipelinePrimaryTopicReference",
|
||||
"start": 18,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 21,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
},
|
||||
"identifierName": "$"
|
||||
},
|
||||
"name": "$"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> (# |> f)
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,165 @@
|
||||
{
|
||||
"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": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"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": "PipelineTopicExpression",
|
||||
"start": 5,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 6,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "PipelinePrimaryTopicReference",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineBareFunction",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "f"
|
||||
},
|
||||
"name": "f"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
x |> (# |> f(#, x))
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,214 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 0,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"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": "PipelineTopicExpression",
|
||||
"start": 5,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 19
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 6,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "PipelinePrimaryTopicReference",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
}
|
||||
}
|
||||
},
|
||||
"operator": "|>",
|
||||
"right": {
|
||||
"type": "PipelineTopicExpression",
|
||||
"start": 11,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "CallExpression",
|
||||
"start": 11,
|
||||
"end": 18,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"callee": {
|
||||
"type": "Identifier",
|
||||
"start": 11,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "f"
|
||||
},
|
||||
"name": "f"
|
||||
},
|
||||
"arguments": [
|
||||
{
|
||||
"type": "PipelinePrimaryTopicReference",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 16,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"parenthesized": true,
|
||||
"parenStart": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> # + 1
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
{
|
||||
"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": "PipelineTopicExpression",
|
||||
"start": 9,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "BinaryExpression",
|
||||
"start": 9,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"left": {
|
||||
"type": "PipelinePrimaryTopicReference",
|
||||
"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": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> 1 + #
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
{
|
||||
"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": "PipelineTopicExpression",
|
||||
"start": 9,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"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": "PipelinePrimaryTopicReference",
|
||||
"start": 13,
|
||||
"end": 14,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> do { do x += 1; while (x < #); }
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"]
|
||||
}
|
||||
@ -0,0 +1,262 @@
|
||||
{
|
||||
"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": "PipelineTopicExpression",
|
||||
"start": 9,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 41
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "DoExpression",
|
||||
"start": 9,
|
||||
"end": 41,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 41
|
||||
}
|
||||
},
|
||||
"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": "PipelinePrimaryTopicReference",
|
||||
"start": 36,
|
||||
"end": 37,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 36
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 37
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
async function af () {
|
||||
value |> do { for await (const e of #) e; }
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions", "asyncGenerators"]
|
||||
}
|
||||
@ -0,0 +1,298 @@
|
||||
{
|
||||
"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": "PipelineTopicExpression",
|
||||
"start": 34,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 45
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "DoExpression",
|
||||
"start": 34,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 45
|
||||
}
|
||||
},
|
||||
"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": "PipelinePrimaryTopicReference",
|
||||
"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": []
|
||||
}
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
value |> do { for (let i = #; predicate(i, #); i += #) i; }
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": [["pipelineOperator", { "proposal": "smart" }], "doExpressions"]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user