From c9584de5a5d97f1c0d94f2a2d1c304bc0b24cefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=C2=A0S=2E=20Choi?= Date: Tue, 16 Nov 2021 11:49:48 -0500 Subject: [PATCH] proposal-pipe: Add support for @@ and ^^ topics --- .../babel-generator/src/generators/types.ts | 2 +- packages/babel-generator/src/index.ts | 2 +- .../input.js | 1 + .../options.json | 4 + .../output.js | 1 + .../input.js | 1 + .../options.json | 4 + .../output.js | 1 + .../options.json | 2 +- .../options.json | 2 +- .../babel-parser/src/parser/expression.js | 36 ++++- packages/babel-parser/src/plugin-utils.js | 2 +- packages/babel-parser/src/tokenizer/index.js | 38 ++++- packages/babel-parser/src/tokenizer/types.js | 11 +- .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 57 +++++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 62 +++++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 44 +++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 55 +++++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 44 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 52 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 66 ++++++++ .../input.js | 3 + .../options.json | 3 + .../output.json | 54 +++++++ .../input.js | 1 + .../options.json | 6 + .../output.json | 81 ++++++++++ .../input.js | 1 + .../options.json | 6 + .../output.json | 81 ++++++++++ .../input.js | 1 + .../options.json | 6 + .../output.json | 48 ++++++ .../input.js | 7 + .../options.json | 7 + .../output.json | 121 ++++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 89 ++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 49 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../hack-double-at-proposal-division/input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 80 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 80 +++++++++ .../input.js | 3 + .../options.json | 6 + .../output.json | 93 +++++++++++ .../input.js | 3 + .../options.json | 6 + .../output.json | 93 +++++++++++ .../input.js | 3 + .../options.json | 7 + .../output.json | 93 +++++++++++ .../input.js | 3 + .../options.json | 7 + .../output.json | 93 +++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 110 +++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 106 ++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 61 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 61 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 62 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 62 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 74 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 64 ++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 57 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 73 +++++++++ .../input.js | 7 + .../options.json | 3 + .../output.json | 139 ++++++++++++++++ .../input.js | 7 + .../options.json | 3 + .../output.json | 125 ++++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 47 ++++++ .../input.js | 4 + .../options.json | 3 + .../output.json | 125 ++++++++++++++ .../input.js | 5 + .../options.json | 3 + .../output.json | 152 ++++++++++++++++++ .../input.js | 5 + .../options.json | 3 + .../output.json | 146 +++++++++++++++++ .../input.js | 4 + .../options.json | 3 + .../output.json | 126 +++++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 80 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 80 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 56 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 42 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 35 ++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 59 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 65 ++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 50 ++++++ .../input.js | 1 + .../options.json | 4 + .../input.js | 2 + .../options.json | 6 + .../output.json | 69 ++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 31 ++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 40 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 97 +++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 76 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 62 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 60 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 53 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 50 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 56 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 7 + .../input.js | 7 + .../options.json | 7 + .../output.json | 111 +++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 35 ++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 31 ++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 47 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 48 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 38 +++++ .../input.js | 1 + .../options.json | 7 + .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 2 + .../options.json | 3 + .../output.json | 110 +++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 47 ++++++ .../input.js | 3 + .../options.json | 3 + .../output.json | 65 ++++++++ .../input.js | 3 + .../options.json | 11 ++ .../output.json | 64 ++++++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 57 +++++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 62 +++++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 44 +++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 55 +++++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 44 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 52 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 66 ++++++++ .../input.js | 3 + .../options.json | 3 + .../output.json | 54 +++++++ .../input.js | 1 + .../options.json | 6 + .../output.json | 81 ++++++++++ .../input.js | 1 + .../options.json | 6 + .../output.json | 81 ++++++++++ .../input.js | 1 + .../options.json | 6 + .../output.json | 48 ++++++ .../input.js | 7 + .../options.json | 7 + .../output.json | 121 ++++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 89 ++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 49 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 80 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 80 +++++++++ .../input.js | 3 + .../options.json | 6 + .../output.json | 93 +++++++++++ .../input.js | 3 + .../options.json | 6 + .../output.json | 93 +++++++++++ .../input.js | 3 + .../options.json | 7 + .../output.json | 93 +++++++++++ .../input.js | 3 + .../options.json | 7 + .../output.json | 93 +++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 110 +++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 106 ++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 61 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 61 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 62 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 62 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 74 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 64 ++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 57 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 73 +++++++++ .../input.js | 7 + .../options.json | 3 + .../output.json | 139 ++++++++++++++++ .../input.js | 7 + .../options.json | 3 + .../output.json | 125 ++++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 47 ++++++ .../input.js | 4 + .../options.json | 3 + .../output.json | 125 ++++++++++++++ .../input.js | 5 + .../options.json | 3 + .../output.json | 152 ++++++++++++++++++ .../input.js | 5 + .../options.json | 3 + .../output.json | 146 +++++++++++++++++ .../input.js | 4 + .../options.json | 3 + .../output.json | 126 +++++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 80 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 80 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 56 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 42 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 35 ++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 59 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 65 ++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 50 ++++++ .../input.js | 1 + .../options.json | 4 + .../input.js | 2 + .../options.json | 6 + .../output.json | 69 ++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 31 ++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 97 +++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 76 +++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 62 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 60 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 53 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 50 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 56 +++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 7 + .../input.js | 7 + .../options.json | 7 + .../output.json | 111 +++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 35 ++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 31 ++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 47 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 48 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 38 +++++ .../input.js | 1 + .../options.json | 7 + .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 2 + .../options.json | 3 + .../output.json | 110 +++++++++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 47 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 41 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 40 +++++ .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 4 + .../input.js | 1 + .../options.json | 3 + .../output.json | 45 ++++++ .../input.js | 1 + .../options.json | 4 + .../input.js | 3 + .../options.json | 3 + .../output.json | 65 ++++++++ .../input.js | 3 + .../options.json | 11 ++ .../output.json | 64 ++++++++ .../input.js | 1 + .../options.json | 11 ++ .../output.json | 41 +++++ .../hack-double-at/class-decorator/exec.js | 8 + .../hack-double-at/class-decorator/input.js | 11 ++ .../class-decorator/options.json | 6 + .../hack-double-at/class-decorator/output.js | 27 ++++ .../hack-double-at/hash-tuple/input.js | 2 + .../hack-double-at/hash-tuple/options.json | 6 + .../hack-double-at/hash-tuple/output.js | 4 + .../test/fixtures/hack-double-at/options.json | 3 + .../hack-double-at/pipe-body-identity/exec.js | 3 + .../pipe-body-identity/input.js | 3 + .../pipe-body-identity/output.js | 4 + .../pipe-body-with-addition/exec.js | 3 + .../pipe-body-with-addition/input.js | 3 + .../pipe-body-with-addition/output.js | 4 + .../exec.js | 9 ++ .../input.js | 9 ++ .../output.js | 8 + .../pipe-body-with-arrow-function/exec.js | 6 + .../pipe-body-with-arrow-function/input.js | 6 + .../pipe-body-with-arrow-function/output.js | 8 + .../pipe-body-with-await/exec.js | 14 ++ .../pipe-body-with-await/input.js | 14 ++ .../pipe-body-with-await/options.json | 6 + .../pipe-body-with-await/output.js | 13 ++ .../exec.js | 20 +++ .../input.js | 20 +++ .../options.json | 6 + .../output.js | 19 +++ .../pipe-body-with-eval/exec.js | 4 + .../pipe-body-with-eval/input.js | 4 + .../pipe-body-with-eval/output.js | 5 + .../pipe-body-with-nested-pipe/exec.js | 7 + .../pipe-body-with-nested-pipe/input.js | 7 + .../pipe-body-with-nested-pipe/output.js | 4 + .../pipe-body-with-object-literal/exec.js | 10 ++ .../pipe-body-with-object-literal/input.js | 10 ++ .../pipe-body-with-object-literal/output.js | 11 ++ .../pipe-body-with-topic-method-call/exec.js | 3 + .../pipe-body-with-topic-method-call/input.js | 3 + .../output.js | 4 + .../pipe-body-with-yield/exec.js | 13 ++ .../pipe-body-with-yield/input.js | 13 ++ .../pipe-body-with-yield/output.js | 11 ++ .../pipe-head-with-nested-pipe/exec.js | 3 + .../pipe-head-with-nested-pipe/input.js | 3 + .../pipe-head-with-nested-pipe/output.js | 4 + .../pipe-in-arrow-function/exec.js | 6 + .../pipe-in-arrow-function/input.js | 6 + .../pipe-in-arrow-function/output.js | 11 ++ .../transform-arrow-functions/exec.js | 5 + .../transform-arrow-functions/input.js | 5 + .../transform-arrow-functions/options.json | 9 ++ .../transform-arrow-functions/output.js | 8 + .../exec.js | 13 ++ .../input.js | 13 ++ .../options.json | 10 ++ .../output.js | 13 ++ .../exec.js | 7 + .../input.js | 7 + .../output.js | 10 ++ .../hack-double-at/within-assignment/exec.js | 3 + .../hack-double-at/within-assignment/input.js | 3 + .../within-assignment/output.js | 4 + .../within-for-classic-statement-init/exec.js | 5 + .../input.js | 5 + .../output.js | 9 ++ .../within-for-classic-statement-test/exec.js | 5 + .../input.js | 5 + .../output.js | 9 ++ .../exec.js | 6 + .../input.js | 6 + .../output.js | 9 ++ .../within-generator-with-yield/input.js | 5 + .../within-generator-with-yield/output.js | 5 + .../within-if-else-block/input.js | 4 + .../within-if-else-block/output.js | 3 + .../within-var-statement/exec.js | 3 + .../within-var-statement/input.js | 3 + .../within-var-statement/output.js | 2 + .../hack-double-caret/class-decorator/exec.js | 8 + .../class-decorator/input.js | 11 ++ .../class-decorator/options.json | 6 + .../class-decorator/output.js | 27 ++++ .../hack-double-caret/hash-tuple/input.js | 2 + .../hack-double-caret/hash-tuple/options.json | 6 + .../hack-double-caret/hash-tuple/output.js | 4 + .../fixtures/hack-double-caret/options.json | 3 + .../pipe-body-identity/exec.js | 3 + .../pipe-body-identity/input.js | 3 + .../pipe-body-identity/output.js | 4 + .../pipe-body-with-addition/exec.js | 3 + .../pipe-body-with-addition/input.js | 3 + .../pipe-body-with-addition/output.js | 4 + .../exec.js | 9 ++ .../input.js | 9 ++ .../output.js | 8 + .../pipe-body-with-arrow-function/exec.js | 6 + .../pipe-body-with-arrow-function/input.js | 6 + .../pipe-body-with-arrow-function/output.js | 8 + .../pipe-body-with-await/exec.js | 14 ++ .../pipe-body-with-await/input.js | 14 ++ .../pipe-body-with-await/options.json | 6 + .../pipe-body-with-await/output.js | 13 ++ .../exec.js | 20 +++ .../input.js | 20 +++ .../options.json | 6 + .../output.js | 19 +++ .../pipe-body-with-eval/exec.js | 4 + .../pipe-body-with-eval/input.js | 4 + .../pipe-body-with-eval/output.js | 5 + .../pipe-body-with-nested-pipe/exec.js | 7 + .../pipe-body-with-nested-pipe/input.js | 7 + .../pipe-body-with-nested-pipe/output.js | 4 + .../pipe-body-with-object-literal/exec.js | 10 ++ .../pipe-body-with-object-literal/input.js | 10 ++ .../pipe-body-with-object-literal/output.js | 11 ++ .../pipe-body-with-topic-method-call/exec.js | 3 + .../pipe-body-with-topic-method-call/input.js | 3 + .../output.js | 4 + .../pipe-body-with-yield/exec.js | 13 ++ .../pipe-body-with-yield/input.js | 13 ++ .../pipe-body-with-yield/output.js | 11 ++ .../pipe-head-with-nested-pipe/exec.js | 3 + .../pipe-head-with-nested-pipe/input.js | 3 + .../pipe-head-with-nested-pipe/output.js | 4 + .../pipe-in-arrow-function/exec.js | 6 + .../pipe-in-arrow-function/input.js | 6 + .../pipe-in-arrow-function/output.js | 11 ++ .../transform-arrow-functions/exec.js | 5 + .../transform-arrow-functions/input.js | 5 + .../transform-arrow-functions/options.json | 9 ++ .../transform-arrow-functions/output.js | 8 + .../exec.js | 13 ++ .../input.js | 13 ++ .../options.json | 10 ++ .../output.js | 13 ++ .../exec.js | 7 + .../input.js | 7 + .../output.js | 10 ++ .../within-assignment/exec.js | 3 + .../within-assignment/input.js | 3 + .../within-assignment/output.js | 4 + .../within-for-classic-statement-init/exec.js | 5 + .../input.js | 5 + .../output.js | 9 ++ .../within-for-classic-statement-test/exec.js | 5 + .../input.js | 5 + .../output.js | 9 ++ .../exec.js | 6 + .../input.js | 6 + .../output.js | 9 ++ .../within-generator-with-yield/input.js | 5 + .../within-generator-with-yield/output.js | 5 + .../within-if-else-block/input.js | 4 + .../within-if-else-block/output.js | 3 + .../within-var-statement/exec.js | 3 + .../within-var-statement/input.js | 3 + .../within-var-statement/output.js | 2 + .../src/index.ts | 2 +- 687 files changed, 13203 insertions(+), 16 deletions(-) create mode 100644 packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/input.js create mode 100644 packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/options.json create mode 100644 packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/output.js create mode 100644 packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/input.js create mode 100644 packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/options.json create mode 100644 packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/output.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-placeholder-template/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-placeholder-template/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-v8intrinsic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-v8intrinsic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-placeholder-template/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-placeholder-template/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-v8intrinsic/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-v8intrinsic/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-without-spaces/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-without-spaces/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/output.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/input.js create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/options.json create mode 100644 packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/output.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-generator-with-yield/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-generator-with-yield/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-if-else-block/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-if-else-block/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/options.json create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-generator-with-yield/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-generator-with-yield/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-if-else-block/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-if-else-block/output.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/exec.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/input.js create mode 100644 packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/output.js diff --git a/packages/babel-generator/src/generators/types.ts b/packages/babel-generator/src/generators/types.ts index b75f5cba5916..779df2d69f8c 100644 --- a/packages/babel-generator/src/generators/types.ts +++ b/packages/babel-generator/src/generators/types.ts @@ -238,7 +238,7 @@ export function DecimalLiteral(this: Printer, node: t.DecimalLiteral) { } // Hack pipe operator -const validTopicTokenSet = new Set(["^", "%", "#"]); +const validTopicTokenSet = new Set(["^^", "@@", "^", "%", "#"]); export function TopicReference(this: Printer) { const { topicToken } = this.format; diff --git a/packages/babel-generator/src/index.ts b/packages/babel-generator/src/index.ts index 104f8325bcc4..6c449e0413bc 100644 --- a/packages/babel-generator/src/index.ts +++ b/packages/babel-generator/src/index.ts @@ -203,7 +203,7 @@ export interface GeneratorOptions { * For use with the Hack-style pipe operator. * Changes what token is used for pipe bodies’ topic references. */ - topicToken?: "^" | "%" | "#"; + topicToken?: "^^" | "@@" | "^" | "%" | "#"; } export interface GeneratorResult { diff --git a/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/input.js b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/input.js new file mode 100644 index 000000000000..e10477e14090 --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/input.js @@ -0,0 +1 @@ +2 + 3 |> @@.toString(16); diff --git a/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/options.json b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/options.json new file mode 100644 index 000000000000..1267861eb749 --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]], + "topicToken": "@@" +} diff --git a/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/output.js b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/output.js new file mode 100644 index 000000000000..e10477e14090 --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-at-topicToken/output.js @@ -0,0 +1 @@ +2 + 3 |> @@.toString(16); diff --git a/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/input.js b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/input.js new file mode 100644 index 000000000000..b9c814b7922e --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/input.js @@ -0,0 +1 @@ +2 + 3 |> ^^.toString(16); diff --git a/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/options.json b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/options.json new file mode 100644 index 000000000000..9d6c1a0bd39b --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]], + "topicToken": "^^" +} diff --git a/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/output.js b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/output.js new file mode 100644 index 000000000000..b9c814b7922e --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/TopicReference-with-double-caret-topicToken/output.js @@ -0,0 +1 @@ +2 + 3 |> ^^.toString(16); diff --git a/packages/babel-generator/test/fixtures/types/TopicReference-with-invalid-topicToken/options.json b/packages/babel-generator/test/fixtures/types/TopicReference-with-invalid-topicToken/options.json index 3ef07c59571f..069fa9add67e 100644 --- a/packages/babel-generator/test/fixtures/types/TopicReference-with-invalid-topicToken/options.json +++ b/packages/babel-generator/test/fixtures/types/TopicReference-with-invalid-topicToken/options.json @@ -1,5 +1,5 @@ { "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "#" }]], "topicToken": "invalid", - "throws": "The \"topicToken\" generator option must be one of \"^\", \"%\", \"#\" (\"invalid\" received instead)." + "throws": "The \"topicToken\" generator option must be one of \"^^\", \"@@\", \"^\", \"%\", \"#\" (\"invalid\" received instead)." } diff --git a/packages/babel-generator/test/fixtures/types/TopicReference-with-missing-topicToken/options.json b/packages/babel-generator/test/fixtures/types/TopicReference-with-missing-topicToken/options.json index 1911353dc052..abf0f725f667 100644 --- a/packages/babel-generator/test/fixtures/types/TopicReference-with-missing-topicToken/options.json +++ b/packages/babel-generator/test/fixtures/types/TopicReference-with-missing-topicToken/options.json @@ -1,4 +1,4 @@ { "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "#" }]], - "throws": "The \"topicToken\" generator option must be one of \"^\", \"%\", \"#\" (undefined received instead)." + "throws": "The \"topicToken\" generator option must be one of \"^^\", \"@@\", \"^\", \"%\", \"#\" (undefined received instead)." } diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 544388abc781..4a2cec82e646 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -1197,6 +1197,30 @@ export default class ExpressionParser extends LValParser { return this.parseTopicReferenceThenEqualsSign(tt.bitwiseXOR, "^"); } + case tt.doubleCaret: { + const pipeProposal = this.getPluginOption( + "pipelineOperator", + "proposal", + ); + const pluginTopicToken = this.getPluginOption( + "pipelineOperator", + "topicToken", + ); + + // The `^^` token is valid only when: + // the pipe-operator proposal is active, + // its "pipeProposal" is configured as "hack", + // and "topicToken" is configured as "^^". + // If the pipe-operator proposal settles on a token that is not ^^, + // then this token type may be removed. + if (pipeProposal === "hack" && pluginTopicToken === "^^") { + return this.parseTopicReference(pipeProposal); + } else { + throw this.unexpected(); + } + } + + case tt.doubleAt: case tt.bitwiseXOR: case tt.modulo: case tt.hash: { @@ -1299,10 +1323,10 @@ export default class ExpressionParser extends LValParser { // that is followed by an equals sign. // See . // If we find ^= or %= in an expression position - // (i.e., the tt.moduloAssign or tt.xorAssign token types), - // and if the Hack-pipes proposal is active with ^ or % as its topicToken, - // then the ^ or % could be the topic token (e.g., in x |> ^==y or x |> ^===y), - // and so we reparse the current token as ^ or %. + // (i.e., the tt.moduloAssign or tt.xorAssign token types), and if the + // Hack-pipes proposal is active with ^ or % as its topicToken, then the ^ or + // % could be the topic token (e.g., in x |> ^==y or x |> ^===y), and so we + // reparse the current token as ^ or %. // Otherwise, this throws an unexpected-token error. parseTopicReferenceThenEqualsSign( topicTokenType: TokenType, @@ -1317,8 +1341,8 @@ export default class ExpressionParser extends LValParser { // will consume that “topic token”. this.state.type = topicTokenType; this.state.value = topicTokenValue; - // Rewind the tokenizer to the end of the “topic token”, - // so that the following token starts at the equals sign after that topic token. + // Rewind the tokenizer to the end of the “topic token”, so that the + // following token starts at the equals sign after that topic token. this.state.pos--; this.state.end--; this.state.endLoc.column--; diff --git a/packages/babel-parser/src/plugin-utils.js b/packages/babel-parser/src/plugin-utils.js index cb750f16e0ab..d0ed132b7b5e 100644 --- a/packages/babel-parser/src/plugin-utils.js +++ b/packages/babel-parser/src/plugin-utils.js @@ -67,7 +67,7 @@ export function getPluginOption( } const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"]; -const TOPIC_TOKENS = ["^", "%", "#"]; +const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"]; const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"]; export function validatePlugins(plugins: PluginList) { diff --git a/packages/babel-parser/src/tokenizer/index.js b/packages/babel-parser/src/tokenizer/index.js index 9c70fe7ab5ea..9b88e8b3d6b9 100644 --- a/packages/babel-parser/src/tokenizer/index.js +++ b/packages/babel-parser/src/tokenizer/index.js @@ -700,6 +700,10 @@ export default class Tokenizer extends ParserErrors { readToken_caret(): void { const next = this.input.charCodeAt(this.state.pos + 1); + const pipeProposal = this.getPluginOption("pipelineOperator", "proposal"); + const topicToken = this.getPluginOption("pipelineOperator", "topicToken"); + const hackPipeWithDoubleCaretIsActive = + pipeProposal === "hack" && topicToken === "^^"; // '^=' if (next === charCodes.equalsTo && !this.state.inType) { @@ -708,12 +712,43 @@ export default class Tokenizer extends ParserErrors { // it can be merged with tt.assign. this.finishOp(tt.xorAssign, 2); } + // '^^' + else if (hackPipeWithDoubleCaretIsActive && next === charCodes.caret) { + // `tt.doubleCaret` is only needed to support ^^ + // as a Hack-pipe topic token. + // If the proposal ends up choosing a different token, + // it may be removed. + this.finishOp(tt.doubleCaret, 2); + + // `^^^` is forbidden and must be separated by a space. + const lookaheadCh = this.input.codePointAt(this.state.pos); + if (lookaheadCh === charCodes.caret) { + throw this.unexpected(); + } + } // '^' else { this.finishOp(tt.bitwiseXOR, 1); } } + readToken_atSign(): void { + const next = this.input.charCodeAt(this.state.pos + 1); + + // '@@' + if (next === charCodes.atSign) { + // `tt.doubleAt` is only needed to support @@ + // as a Hack-pipe topic token. + // If the proposal ends up choosing a different token, + // it may be removed. + this.finishOp(tt.doubleAt, 2); + } + // '@' + else { + this.finishOp(tt.at, 1); + } + } + readToken_plus_min(code: number): void { // '+-' const next = this.input.charCodeAt(this.state.pos + 1); @@ -1003,8 +1038,7 @@ export default class Tokenizer extends ParserErrors { return; case charCodes.atSign: - ++this.state.pos; - this.finishToken(tt.at); + this.readToken_atSign(); return; case charCodes.numberSign: diff --git a/packages/babel-parser/src/tokenizer/types.js b/packages/babel-parser/src/tokenizer/types.js index 7e3744f0da87..a3eef5e8ff0c 100644 --- a/packages/babel-parser/src/tokenizer/types.js +++ b/packages/babel-parser/src/tokenizer/types.js @@ -186,8 +186,9 @@ export const tt: { [name: string]: TokenType } = { eq: createToken("=", { beforeExpr, isAssign }), assign: createToken("_=", { beforeExpr, isAssign }), slashAssign: createToken("_=", { beforeExpr, isAssign }), - // These are only needed to support % and ^ as a Hack-pipe topic token. When the - // proposal settles on a token, the others can be merged with tt.assign. + // These are only needed to support % and ^ as a Hack-pipe topic token. + // When the proposal settles on a token, the others can be merged with + // tt.assign. xorAssign: createToken("_=", { beforeExpr, isAssign }), moduloAssign: createToken("_=", { beforeExpr, isAssign }), // end: isAssign @@ -195,6 +196,12 @@ export const tt: { [name: string]: TokenType } = { incDec: createToken("++/--", { prefix, postfix, startsExpr }), bang: createToken("!", { beforeExpr, prefix, startsExpr }), tilde: createToken("~", { beforeExpr, prefix, startsExpr }), + + // More possible topic tokens. + // When the proposal settles on a token, at least one of these may be removed. + doubleCaret: createToken("^^", { startsExpr }), + doubleAt: createToken("@@", { startsExpr }), + // start: isBinop pipeline: createBinop("|>", 0), nullishCoalescing: createBinop("??", 1), diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/input.js new file mode 100644 index 000000000000..143f5bf23ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/input.js @@ -0,0 +1 @@ +value |> @@ + 1 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/output.json new file mode 100644 index 000000000000..14a12f4fc9ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-first/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "+", + "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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/input.js new file mode 100644 index 000000000000..255733f7dae0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/input.js @@ -0,0 +1 @@ +value |> 1 + @@ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/output.json new file mode 100644 index 000000000000..64f362be927d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-with-topic-last/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/input.js new file mode 100644 index 000000000000..e952adac15fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/input.js @@ -0,0 +1 @@ +value |> a + b diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/output.json new file mode 100644 index 000000000000..6565ae6d9aa2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-addition-without-topic/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/input.js new file mode 100644 index 000000000000..bf1d61a76354 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/input.js @@ -0,0 +1 @@ +value |> (() => @@ + 1) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/output.json new file mode 100644 index 000000000000..5e034e6dee57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-parenthesized/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BinaryExpression", + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "left": { + "type": "TopicReference", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}} + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/input.js new file mode 100644 index 000000000000..8f18e5449393 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/input.js @@ -0,0 +1 @@ +10 |> x => x + @@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/options.json new file mode 100644 index 000000000000..0dfb1fc3aa49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "@@" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/output.json new file mode 100644 index 000000000000..8266a4927101 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-arrow-function-unparenthesized/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized arrow function expression; please wrap it in parentheses. (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "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": "ArrowFunctionExpression", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "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":"x"}, + "name": "x" + } + ], + "body": { + "type": "BinaryExpression", + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "left": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, + "name": "x" + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}} + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/input.js new file mode 100644 index 000000000000..0c03eacb50de --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/input.js @@ -0,0 +1 @@ +value |> x &&= @@ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/options.json new file mode 100644 index 000000000000..0dfb1fc3aa49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "@@" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/output.json new file mode 100644 index 000000000000..e3d61d042cdb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-logical-and/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized assignment expression; please wrap it in parentheses. (1:9)" + ], + "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":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "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":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "operator": "&&=", + "left": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "TopicReference", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/input.js new file mode 100644 index 000000000000..5efad39dbdb4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/input.js @@ -0,0 +1 @@ +value |> [x, y] = @@ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/options.json new file mode 100644 index 000000000000..0dfb1fc3aa49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "@@" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/output.json new file mode 100644 index 000000000000..4e13d17f8b5e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-normal/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized assignment expression; please wrap it in parentheses. (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "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":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "elements": [ + { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, + "name": "x" + }, + { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, + "name": "y" + } + ] + }, + "right": { + "type": "TopicReference", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/input.js new file mode 100644 index 000000000000..ec0dae0a8b87 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/input.js @@ -0,0 +1 @@ +value |> x += @@ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/options.json new file mode 100644 index 000000000000..0dfb1fc3aa49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "@@" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/output.json new file mode 100644 index 000000000000..8f65e60606a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-plus/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized assignment expression; please wrap it in parentheses. (1:9)" + ], + "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": "AssignmentExpression", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "TopicReference", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/input.js new file mode 100644 index 000000000000..7e85477fac1b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/input.js @@ -0,0 +1 @@ +value |> (@@ = 1); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/output.json new file mode 100644 index 000000000000..1c0352cc28cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-assignment-to-topic/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression. (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "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":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "operator": "=", + "left": { + "type": "TopicReference", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}} + }, + "right": { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/input.js new file mode 100644 index 000000000000..c9d398284676 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/input.js @@ -0,0 +1 @@ +1 |> f(@@) |> g(@@); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/output.json new file mode 100644 index 000000000000..db7ebf40c8f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-associativity/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "left": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, + "left": { + "type": "CallExpression", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "callee": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"f"}, + "name": "f" + }, + "arguments": [ + { + "type": "TopicReference", + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}} + } + ] + }, + "operator": "|>", + "right": { + "type": "CallExpression", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "callee": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"g"}, + "name": "g" + }, + "arguments": [ + { + "type": "TopicReference", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}} + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/input.js new file mode 100644 index 000000000000..f1cfcb23ca41 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/input.js @@ -0,0 +1,3 @@ +async function f () { + return x |> await @@; +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/output.json new file mode 100644 index 000000000000..9c6d1e74bd5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-async-await/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":47,"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":47,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":24,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "argument": { + "type": "BinaryExpression", + "start":31,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":22}}, + "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":44,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, + "argument": { + "type": "TopicReference", + "start":42,"end":44,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}} + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/input.js new file mode 100644 index 000000000000..ee911e0ac476 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/input.js @@ -0,0 +1 @@ +value |> @foo class { constructor () { @@; } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/options.json new file mode 100644 index 000000000000..d892ab069acf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/output.json new file mode 100644 index 000000000000..65e2053d6f2a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-bare-identifier/output.json @@ -0,0 +1,81 @@ +{ + "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": "ClassExpression", + "start":9,"end":46,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":46}}, + "decorators": [ + { + "type": "Decorator", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "expression": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":20,"end":46,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ClassMethod", + "start":22,"end":44,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":44}}, + "static": false, + "key": { + "type": "Identifier", + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "expression": { + "type": "TopicReference", + "start":39,"end":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}} + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/input.js new file mode 100644 index 000000000000..e6f627af7cab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/input.js @@ -0,0 +1 @@ +value |> @(foo) class { constructor () { @@; } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/options.json new file mode 100644 index 000000000000..d892ab069acf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/output.json new file mode 100644 index 000000000000..06455b0c8955 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-identifier/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "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": "ClassExpression", + "start":9,"end":48,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":48}}, + "decorators": [ + { + "type": "Decorator", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "expression": { + "type": "Identifier", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":22,"end":48,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":48}}, + "body": [ + { + "type": "ClassMethod", + "start":24,"end":46,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":46}}, + "static": false, + "key": { + "type": "Identifier", + "start":24,"end":35,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":35},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":41,"end":44,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":44}}, + "expression": { + "type": "TopicReference", + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}} + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/input.js new file mode 100644 index 000000000000..36fed21b87fa --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/input.js @@ -0,0 +1 @@ +value |> @(@@) class {} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/options.json new file mode 100644 index 000000000000..d892ab069acf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/output.json new file mode 100644 index 000000000000..66492e7e5519 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-decorator-with-parenthesized-topic/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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": "ClassExpression", + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "decorators": [ + { + "type": "Decorator", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "expression": { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "body": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/input.js new file mode 100644 index 000000000000..8e532f6ad703 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/input.js @@ -0,0 +1,7 @@ +value |> new (class Thing { + #property; + + method () { + return @@ + this.#property; + } +}); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/options.json new file mode 100644 index 000000000000..fcd51fb78f2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + "classPrivateProperties", + "classPrivateMethods" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/output.json new file mode 100644 index 000000000000..5e32fe170d3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-with-private-property/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "program": { + "type": "Program", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":94,"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":94,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":2}}, + "callee": { + "type": "ClassExpression", + "start":14,"end":93,"loc":{"start":{"line":1,"column":14},"end":{"line":7,"column":1}}, + "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":93,"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":91,"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":91,"loc":{"start":{"line":4,"column":12},"end":{"line":6,"column":3}}, + "body": [ + { + "type": "ReturnStatement", + "start":60,"end":87,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":31}}, + "argument": { + "type": "BinaryExpression", + "start":67,"end":86,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":30}}, + "left": { + "type": "TopicReference", + "start":67,"end":69,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":13}} + }, + "operator": "+", + "right": { + "type": "MemberExpression", + "start":72,"end":86,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":30}}, + "object": { + "type": "ThisExpression", + "start":72,"end":76,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":20}} + }, + "computed": false, + "property": { + "type": "PrivateName", + "start":77,"end":86,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":30}}, + "id": { + "type": "Identifier", + "start":78,"end":86,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":30},"identifierName":"property"}, + "name": "property" + } + } + } + } + } + ], + "directives": [] + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 13 + } + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/input.js new file mode 100644 index 000000000000..6ced0ac19af9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/input.js @@ -0,0 +1 @@ +x |> class { constructor () { this.x = @@; } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/output.json new file mode 100644 index 000000000000..6673187ad7a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-class-expression-without-private-property/output.json @@ -0,0 +1,89 @@ +{ + "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":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "ClassExpression", + "start":5,"end":46,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":46}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":11,"end":46,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ClassMethod", + "start":13,"end":44,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":44}}, + "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":44,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":30,"end":42,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":42}}, + "expression": { + "type": "AssignmentExpression", + "start":30,"end":41,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":41}}, + "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":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}} + } + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/input.js new file mode 100644 index 000000000000..f61fb6eaa1ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/input.js @@ -0,0 +1 @@ +10 |> (@@, @@); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/output.json new file mode 100644 index 000000000000..07c3718a305e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-comma-topic-pair/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "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":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "expressions": [ + { + "type": "TopicReference", + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}} + }, + { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/input.js new file mode 100644 index 000000000000..5a02dee8ec60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/input.js @@ -0,0 +1 @@ +value |> a[b] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/output.json new file mode 100644 index 000000000000..3959a09863b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-computed-no-topic/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/input.js new file mode 100644 index 000000000000..0eebef652fe8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/input.js @@ -0,0 +1 @@ +value |> @@ / 2 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/output.json new file mode 100644 index 000000000000..b270f10daff6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-division/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "/", + "right": { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..58a6489b2dea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { do x += @@; while (x < 50); } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..941f2f506218 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "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":43,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":43}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":43,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":43}}, + "body": [ + { + "type": "DoWhileStatement", + "start":14,"end":41,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":41}}, + "body": { + "type": "ExpressionStatement", + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, + "expression": { + "type": "AssignmentExpression", + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, + "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":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}} + } + } + }, + "test": { + "type": "BinaryExpression", + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "left": { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..b4d49738bd03 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { do x += 1; while (x < @@); } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..19a23bc8d0a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-do-while-loop-and-topic-in-loop-head/output.json @@ -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": "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":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": "TopicReference", + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..cb61fa5f2fda --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/input.js @@ -0,0 +1,3 @@ +async function af () { + value |> do { for await (const e of sequence) @@; } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..e1698d7235fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + "doExpressions" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..fddba25fc5fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":78,"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":78,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "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":76,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":53}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":37,"end":76,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":53}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":74,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":51}}, + "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":74,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":51}}, + "expression": { + "type": "TopicReference", + "start":71,"end":73,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":50}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..ae2800e64668 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/input.js @@ -0,0 +1,3 @@ +async function af () { + value |> do { for await (const e of @@) e; } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..e1698d7235fb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + "doExpressions" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..4f5624112439 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":71,"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":71,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":46}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":46}}, + "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":69,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":46}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":37,"end":69,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":46}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":67,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":44}}, + "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":63,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":40}} + }, + "body": { + "type": "ExpressionStatement", + "start":65,"end":67,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":44}}, + "expression": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":43},"identifierName":"e"}, + "name": "e" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..cb61fa5f2fda --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/input.js @@ -0,0 +1,3 @@ +async function af () { + value |> do { for await (const e of sequence) @@; } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..273ca998a1cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + "doExpressions", + "asyncGenerators" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..fddba25fc5fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":78,"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":78,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "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":76,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":53}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":37,"end":76,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":53}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":74,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":51}}, + "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":74,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":51}}, + "expression": { + "type": "TopicReference", + "start":71,"end":73,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":50}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..ae2800e64668 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/input.js @@ -0,0 +1,3 @@ +async function af () { + value |> do { for await (const e of @@) e; } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..273ca998a1cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + "doExpressions", + "asyncGenerators" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..4f5624112439 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":71,"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":71,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":46}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":46}}, + "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":69,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":46}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":37,"end":69,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":46}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":67,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":44}}, + "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":63,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":40}} + }, + "body": { + "type": "ExpressionStatement", + "start":65,"end":67,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":44}}, + "expression": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":43},"identifierName":"e"}, + "name": "e" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..c7d1ade86394 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { for (let i = 0; i < n; i += 1) @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..de572e961fe4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "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":50,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":50}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":50,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "ForStatement", + "start":14,"end":48,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":48}}, + "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":48,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":48}}, + "expression": { + "type": "TopicReference", + "start":45,"end":47,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":47}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..88ec2db5becb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { for (let i = @@; predicate(i, @@); i += @@) i; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..3afffc17b927 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "program": { + "type": "Program", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "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":62,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":62}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":62,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":62}}, + "body": [ + { + "type": "ForStatement", + "start":14,"end":60,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":60}}, + "init": { + "type": "VariableDeclaration", + "start":19,"end":29,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "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":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}} + } + } + ], + "kind": "let" + }, + "test": { + "type": "CallExpression", + "start":31,"end":47,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":47}}, + "callee": { + "type": "Identifier", + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40},"identifierName":"predicate"}, + "name": "predicate" + }, + "arguments": [ + { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"i"}, + "name": "i" + }, + { + "type": "TopicReference", + "start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}} + } + ] + }, + "update": { + "type": "AssignmentExpression", + "start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50},"identifierName":"i"}, + "name": "i" + }, + "right": { + "type": "TopicReference", + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}} + } + }, + "body": { + "type": "ExpressionStatement", + "start":58,"end":60,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":60}}, + "expression": { + "type": "Identifier", + "start":58,"end":59,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":59},"identifierName":"i"}, + "name": "i" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..57496ab45d9a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { for (e in object) @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..daa667eaaed9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "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":37,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":37,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, + "body": [ + { + "type": "ForInStatement", + "start":14,"end":35,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "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":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "expression": { + "type": "TopicReference", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..7055705d3c45 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { for (e in @@) e; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..f230de3579f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-in-loop-and-topic-in-loop-head/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "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":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, + "body": [ + { + "type": "ForInStatement", + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, + "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":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}} + }, + "body": { + "type": "ExpressionStatement", + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "expression": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"e"}, + "name": "e" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..38f774b373d0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { for (e of sequence) @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..45b65d93e930 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "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":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "ForOfStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "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":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, + "expression": { + "type": "TopicReference", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..3dc83d2f6a96 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { for (e of @@) e; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..0a487cc24354 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-for-of-loop-and-topic-in-loop-head/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "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":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, + "body": [ + { + "type": "ForOfStatement", + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, + "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":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}} + }, + "body": { + "type": "ExpressionStatement", + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "expression": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"e"}, + "name": "e" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/input.js new file mode 100644 index 000000000000..b0860614c647 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/input.js @@ -0,0 +1 @@ +value |> do { if (yes) null; else if (no) @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/output.json new file mode 100644 index 000000000000..be79908de4c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-body/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "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":47,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":47}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":47,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "IfStatement", + "start":14,"end":45,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":45}}, + "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":45,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":45}}, + "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":45,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":45}}, + "expression": { + "type": "TopicReference", + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}} + } + }, + "alternate": null + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/input.js new file mode 100644 index 000000000000..42b501cfbf76 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/input.js @@ -0,0 +1 @@ +value |> do { if (yes) null; else @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/output.json new file mode 100644 index 000000000000..dc4340eba991 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-else-if-body/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "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":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "IfStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "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": "ExpressionStatement", + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, + "expression": { + "type": "TopicReference", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/input.js new file mode 100644 index 000000000000..9c74bc58330a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/input.js @@ -0,0 +1 @@ +value |> do { if (yes) @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/output.json new file mode 100644 index 000000000000..e16a87fba31f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-body/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "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":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "body": [ + { + "type": "IfStatement", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "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":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "expression": { + "type": "TopicReference", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}} + } + }, + "alternate": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/input.js new file mode 100644 index 000000000000..892ead81cb88 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/input.js @@ -0,0 +1 @@ +value |> do { if (@@) 1; else 0; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/output.json new file mode 100644 index 000000000000..727a3813b9f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-if-statement-and-topic-in-if-head/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "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":34,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":34,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":34}}, + "body": [ + { + "type": "IfStatement", + "start":14,"end":32,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":32}}, + "test": { + "type": "TopicReference", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}} + }, + "consequent": { + "type": "ExpressionStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "expression": { + "type": "NumericLiteral", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "alternate": { + "type": "ExpressionStatement", + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "expression": { + "type": "NumericLiteral", + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/input.js new file mode 100644 index 000000000000..09fdf2209773 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/input.js @@ -0,0 +1,7 @@ +value |> do { + switch (number) { + case 0: @@; + case 1: @@ + 1; + default: @@ + 10; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/output.json new file mode 100644 index 000000000000..3fa9c9962c8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-body/output.json @@ -0,0 +1,139 @@ +{ + "type": "File", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"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": "DoExpression", + "start":9,"end":97,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":97,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "SwitchStatement", + "start":16,"end":95,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "discriminant": { + "type": "Identifier", + "start":24,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16},"identifierName":"number"}, + "name": "number" + }, + "cases": [ + { + "type": "SwitchCase", + "start":38,"end":49,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":46,"end":49,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":15}}, + "expression": { + "type": "TopicReference", + "start":46,"end":48,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}} + } + } + ], + "test": { + "type": "NumericLiteral", + "start":43,"end":44,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "SwitchCase", + "start":54,"end":69,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":19}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":62,"end":69,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":19}}, + "expression": { + "type": "BinaryExpression", + "start":62,"end":68,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":18}}, + "left": { + "type": "TopicReference", + "start":62,"end":64,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":14}} + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":67,"end":68,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":18}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "test": { + "type": "NumericLiteral", + "start":59,"end":60,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "SwitchCase", + "start":74,"end":91,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":21}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":83,"end":91,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":21}}, + "expression": { + "type": "BinaryExpression", + "start":83,"end":90,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":20}}, + "left": { + "type": "TopicReference", + "start":83,"end":85,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":15}} + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":88,"end":90,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":20}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "test": null + } + ] + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/input.js new file mode 100644 index 000000000000..26325cc8adea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/input.js @@ -0,0 +1,7 @@ +value |> do { + switch (@@) { + case 0: 50; + case 1: 60; + default: 70; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/output.json new file mode 100644 index 000000000000..93929e99ee58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-switch-statement-and-topic-in-switch-head/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"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": "DoExpression", + "start":9,"end":84,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":84,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "SwitchStatement", + "start":16,"end":82,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "discriminant": { + "type": "TopicReference", + "start":24,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}} + }, + "cases": [ + { + "type": "SwitchCase", + "start":34,"end":45,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":42,"end":45,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":15}}, + "expression": { + "type": "NumericLiteral", + "start":42,"end":44,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + } + ], + "test": { + "type": "NumericLiteral", + "start":39,"end":40,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "SwitchCase", + "start":50,"end":61,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":58,"end":61,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":15}}, + "expression": { + "type": "NumericLiteral", + "start":58,"end":60,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":14}}, + "extra": { + "rawValue": 60, + "raw": "60" + }, + "value": 60 + } + } + ], + "test": { + "type": "NumericLiteral", + "start":55,"end":56,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "SwitchCase", + "start":66,"end":78,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":16}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":75,"end":78,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":16}}, + "expression": { + "type": "NumericLiteral", + "start":75,"end":77,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":15}}, + "extra": { + "rawValue": 70, + "raw": "70" + }, + "value": 70 + } + } + ], + "test": null + } + ] + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/input.js new file mode 100644 index 000000000000..542c2f139d46 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/input.js @@ -0,0 +1 @@ +value |> do { @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/output.json new file mode 100644 index 000000000000..2c53651ce7fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-topic-identity/output.json @@ -0,0 +1,47 @@ +{ + "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":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "DoExpression", + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "expression": { + "type": "TopicReference", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}} + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/input.js new file mode 100644 index 000000000000..670c3a5242a4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/input.js @@ -0,0 +1,4 @@ +value |> do { + try { JSON.parse(@@); } + catch (error) { console.error(@@); } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/output.json new file mode 100644 index 000000000000..eae50a367908 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"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": "DoExpression", + "start":9,"end":80,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":80,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":78,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":38}}, + "block": { + "type": "BlockStatement", + "start":20,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":25}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":37,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":23}}, + "expression": { + "type": "CallExpression", + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + } + }, + "arguments": [ + { + "type": "TopicReference", + "start":33,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}} + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":42,"end":78,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":38}}, + "param": { + "type": "Identifier", + "start":49,"end":54,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":56,"end":78,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":38}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":76,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":36}}, + "expression": { + "type": "CallExpression", + "start":58,"end":75,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":35}}, + "callee": { + "type": "MemberExpression", + "start":58,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":58,"end":65,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":66,"end":71,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + } + }, + "arguments": [ + { + "type": "TopicReference", + "start":72,"end":74,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":34}} + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/input.js new file mode 100644 index 000000000000..fd1f56af9719 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/input.js @@ -0,0 +1,5 @@ +value |> do { + try { JSON.parse(whatever); } + catch (error) { console.error(error); } + finally { something(@@); } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/output.json new file mode 100644 index 000000000000..798e55fdc030 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/output.json @@ -0,0 +1,152 @@ +{ + "type": "File", + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"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": "DoExpression", + "start":9,"end":118,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":118,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":116,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":28}}, + "block": { + "type": "BlockStatement", + "start":20,"end":45,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":31}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":43,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":29}}, + "expression": { + "type": "CallExpression", + "start":22,"end":42,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":28}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + } + }, + "arguments": [ + { + "type": "Identifier", + "start":33,"end":41,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27},"identifierName":"whatever"}, + "name": "whatever" + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":48,"end":87,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, + "param": { + "type": "Identifier", + "start":55,"end":60,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":62,"end":87,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":64,"end":85,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, + "expression": { + "type": "CallExpression", + "start":64,"end":84,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, + "callee": { + "type": "MemberExpression", + "start":64,"end":77,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":64,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":72,"end":77,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + } + }, + "arguments": [ + { + "type": "Identifier", + "start":78,"end":83,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, + "name": "error" + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": { + "type": "BlockStatement", + "start":98,"end":116,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":28}}, + "body": [ + { + "type": "ExpressionStatement", + "start":100,"end":114,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":26}}, + "expression": { + "type": "CallExpression", + "start":100,"end":113,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":25}}, + "callee": { + "type": "Identifier", + "start":100,"end":109,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":21},"identifierName":"something"}, + "name": "something" + }, + "arguments": [ + { + "type": "TopicReference", + "start":110,"end":112,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":24}} + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/input.js new file mode 100644 index 000000000000..cfc55357ab3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/input.js @@ -0,0 +1,5 @@ +value |> do { + try { JSON.parse(@@); } + catch (error) { console.error(error); } + finally { something(); } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/output.json new file mode 100644 index 000000000000..963ec3e5f04b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"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": "DoExpression", + "start":9,"end":110,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":110,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":108,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":26}}, + "block": { + "type": "BlockStatement", + "start":20,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":25}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":37,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":23}}, + "expression": { + "type": "CallExpression", + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + } + }, + "arguments": [ + { + "type": "TopicReference", + "start":33,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}} + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":42,"end":81,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, + "param": { + "type": "Identifier", + "start":49,"end":54,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":56,"end":81,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":79,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, + "expression": { + "type": "CallExpression", + "start":58,"end":78,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, + "callee": { + "type": "MemberExpression", + "start":58,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":58,"end":65,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":66,"end":71,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + } + }, + "arguments": [ + { + "type": "Identifier", + "start":72,"end":77,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, + "name": "error" + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": { + "type": "BlockStatement", + "start":92,"end":108,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":26}}, + "body": [ + { + "type": "ExpressionStatement", + "start":94,"end":106,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":24}}, + "expression": { + "type": "CallExpression", + "start":94,"end":105,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":23}}, + "callee": { + "type": "Identifier", + "start":94,"end":103,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":21},"identifierName":"something"}, + "name": "something" + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/input.js new file mode 100644 index 000000000000..f8b245e1dc45 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/input.js @@ -0,0 +1,4 @@ +value |> do { + try { JSON.parse(@@); } + catch (error) { console.error(error); } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/output.json new file mode 100644 index 000000000000..11241eb3ca0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-try-catch-statements-topic-in-try-clause/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"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": "DoExpression", + "start":9,"end":83,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":83,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":81,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":41}}, + "block": { + "type": "BlockStatement", + "start":20,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":25}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":37,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":23}}, + "expression": { + "type": "CallExpression", + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + } + }, + "arguments": [ + { + "type": "TopicReference", + "start":33,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}} + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":42,"end":81,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, + "param": { + "type": "Identifier", + "start":49,"end":54,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":56,"end":81,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":79,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, + "expression": { + "type": "CallExpression", + "start":58,"end":78,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, + "callee": { + "type": "MemberExpression", + "start":58,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":58,"end":65,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":66,"end":71,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + } + }, + "arguments": [ + { + "type": "Identifier", + "start":72,"end":77,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, + "name": "error" + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/input.js new file mode 100644 index 000000000000..1b08677c6fed --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { while (x < 50) x += @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/output.json new file mode 100644 index 000000000000..ac3f99102fec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-body/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "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":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "WhileStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "test": { + "type": "BinaryExpression", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "left": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + }, + "body": { + "type": "ExpressionStatement", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, + "expression": { + "type": "AssignmentExpression", + "start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "TopicReference", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}} + } + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/input.js new file mode 100644 index 000000000000..a7a6b9db832a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { while (x < @@) x += 1; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/output.json new file mode 100644 index 000000000000..0f197cbea8b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-while-loop-topic-in-loop-head/output.json @@ -0,0 +1,80 @@ +{ + "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": "WhileStatement", + "start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}}, + "test": { + "type": "BinaryExpression", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "left": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "TopicReference", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}} + } + }, + "body": { + "type": "ExpressionStatement", + "start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}, + "expression": { + "type": "AssignmentExpression", + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/input.js new file mode 100644 index 000000000000..4ecdc349dfaf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/input.js @@ -0,0 +1 @@ +value |> do { with ({}) @@; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/options.json new file mode 100644 index 000000000000..5b97f22a11e3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/output.json new file mode 100644 index 000000000000..4b7b5543bb3b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-do-transform-with-block-topic-in-body/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "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":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":29,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":29}}, + "body": [ + { + "type": "WithStatement", + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "object": { + "type": "ObjectExpression", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "properties": [] + }, + "body": { + "type": "ExpressionStatement", + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "expression": { + "type": "TopicReference", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/input.js new file mode 100644 index 000000000000..5d24fc328c4e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/input.js @@ -0,0 +1 @@ +value |> @@==1 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/output.json new file mode 100644 index 000000000000..98ecc4bca832 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-loose-with-topic-first-without-spaces/output.json @@ -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":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/input.js new file mode 100644 index 000000000000..fa8a329e21be --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/input.js @@ -0,0 +1 @@ +value |> @@===1 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/output.json new file mode 100644 index 000000000000..0d9b61f0bf65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-equality-strict-with-topic-first-without-spaces/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "===", + "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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/input.js new file mode 100644 index 000000000000..46c81e85df5c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/input.js @@ -0,0 +1 @@ +value |> f(@@) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/output.json new file mode 100644 index 000000000000..a2fa21c6ceb7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-with-topic-in-argument/output.json @@ -0,0 +1,42 @@ +{ + "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": "CallExpression", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "callee": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + }, + "arguments": [ + { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/input.js new file mode 100644 index 000000000000..15a3d7657b9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/input.js @@ -0,0 +1 @@ +value |> f diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/output.json new file mode 100644 index 000000000000..3917568d724f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-call-without-topic/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "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":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": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/input.js new file mode 100644 index 000000000000..f3f876da0719 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/input.js @@ -0,0 +1 @@ +x |> function () { @@ |> @@ } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/output.json new file mode 100644 index 000000000000..f81c748e7378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-another-pipe-in-function-body/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "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": "FunctionExpression", + "start":5,"end":29,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":29}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "expression": { + "type": "BinaryExpression", + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "left": { + "type": "TopicReference", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/input.js new file mode 100644 index 000000000000..712d044b0e68 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/input.js @@ -0,0 +1 @@ +value |> function (x = @@) { return x; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/output.json new file mode 100644 index 000000000000..640dfd370737 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-default-parameter/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "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": "FunctionExpression", + "start":9,"end":40,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":40}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "left": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "TopicReference", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}} + } + } + ], + "body": { + "type": "BlockStatement", + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, + "body": [ + { + "type": "ReturnStatement", + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, + "argument": { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/input.js new file mode 100644 index 000000000000..6681fe9d56df --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/input.js @@ -0,0 +1 @@ +x |> function () { @@ } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/output.json new file mode 100644 index 000000000000..ab81762b5445 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-function-definition-with-topic-in-function-body/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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": "FunctionExpression", + "start":5,"end":23,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "expression": { + "type": "TopicReference", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-topic/input.js new file mode 100644 index 000000000000..a18cbd0f1bb2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-topic/input.js @@ -0,0 +1 @@ +value |> # diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-topic/options.json new file mode 100644 index 000000000000..929cd7fdcd6c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-topic/options.json @@ -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)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/input.js new file mode 100644 index 000000000000..81a3b28d74df --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/input.js @@ -0,0 +1,2 @@ +#[0]; +1 |> #[0, @@]; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/options.json new file mode 100644 index 000000000000..116be78612f4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + ["recordAndTuple", { "syntaxType": "hash" }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/output.json new file mode 100644 index 000000000000..4056d03b8c29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-hash-tuple/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TupleExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "elements": [ + { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":6,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "expression": { + "type": "BinaryExpression", + "start":6,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "left": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "|>", + "right": { + "type": "TupleExpression", + "start":11,"end":19,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":13}}, + "elements": [ + { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "TopicReference", + "start":16,"end":18,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}} + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/input.js new file mode 100644 index 000000000000..8a575976cf92 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/input.js @@ -0,0 +1 @@ +value |> @@ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/options.json new file mode 100644 index 000000000000..ee86eb98581c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], "pipelineOperator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/output.json new file mode 100644 index 000000000000..8b15798610ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-mixed-pipeline-plugins/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "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": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/input.js new file mode 100644 index 000000000000..344b3a3d0f65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/input.js @@ -0,0 +1 @@ +value |> (variable %= @@); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/output.json new file mode 100644 index 000000000000..672939df45c5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-with-spaces/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "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":24,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, + "operator": "%=", + "left": { + "type": "Identifier", + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18},"identifierName":"variable"}, + "name": "variable" + }, + "right": { + "type": "TopicReference", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}} + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/input.js new file mode 100644 index 000000000000..0e15a2fb11f0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/input.js @@ -0,0 +1 @@ +value |> (variable%=@@); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/output.json new file mode 100644 index 000000000000..81571e75d3be --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-assignment-without-spaces/output.json @@ -0,0 +1,45 @@ +{ + "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":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, + "operator": "%=", + "left": { + "type": "Identifier", + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18},"identifierName":"variable"}, + "name": "variable" + }, + "right": { + "type": "TopicReference", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}} + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/input.js new file mode 100644 index 000000000000..d2fa335cea9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/input.js @@ -0,0 +1 @@ +5 % /3/g; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/output.json new file mode 100644 index 000000000000..b6fb84b72f7c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-regex-outside-pipe/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "left": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + }, + "operator": "%", + "right": { + "type": "RegExpLiteral", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "extra": { + "raw": "/3/g" + }, + "pattern": "3", + "flags": "g" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/input.js new file mode 100644 index 000000000000..baef4410dc4f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/input.js @@ -0,0 +1 @@ +value |> @@ % 2; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/output.json new file mode 100644 index 000000000000..092ce0944eb4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-with-spaces/output.json @@ -0,0 +1,45 @@ +{ + "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":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "%", + "right": { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/input.js new file mode 100644 index 000000000000..3067b26c79ab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/input.js @@ -0,0 +1 @@ +value |> @@%2; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/output.json new file mode 100644 index 000000000000..2834c23a7607 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-first-without-spaces/output.json @@ -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":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": "BinaryExpression", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "%", + "right": { + "type": "NumericLiteral", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/input.js new file mode 100644 index 000000000000..6c54c280cffc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/input.js @@ -0,0 +1 @@ +value |> 2 % @@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/output.json new file mode 100644 index 000000000000..42ca84fed0d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-with-spaces/output.json @@ -0,0 +1,45 @@ +{ + "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":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + "operator": "%", + "right": { + "type": "TopicReference", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/input.js new file mode 100644 index 000000000000..c3fda482f396 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/input.js @@ -0,0 +1 @@ +value |> 2%@@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/output.json new file mode 100644 index 000000000000..c56431997313 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-modulo-topic-last-without-spaces/output.json @@ -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":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": "BinaryExpression", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "left": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + "operator": "%", + "right": { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/input.js new file mode 100644 index 000000000000..47daf4d9fa70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/input.js @@ -0,0 +1 @@ +x |> ($ => @@ |> f(@@, $) |> @@ > 1) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/output.json new file mode 100644 index 000000000000..c715bce7e7ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-with-required-topics/output.json @@ -0,0 +1,97 @@ +{ + "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":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "ArrowFunctionExpression", + "start":6,"end":35,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":35}}, + "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":35,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":35}}, + "left": { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":17,"end":35,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":35}}, + "left": { + "type": "CallExpression", + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, + "callee": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"f"}, + "name": "f" + }, + "arguments": [ + { + "type": "TopicReference", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + }, + { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"$"}, + "name": "$" + } + ] + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "left": { + "type": "TopicReference", + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}} + }, + "operator": ">", + "right": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/input.js new file mode 100644 index 000000000000..9cd2227016ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/input.js @@ -0,0 +1 @@ +x |> ($ => @@ |> $ + 1) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json new file mode 100644 index 000000000000..d0b6b79bd97e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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": "ArrowFunctionExpression", + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, + "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":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, + "left": { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "left": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"$"}, + "name": "$" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/input.js new file mode 100644 index 000000000000..fe547668995a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/input.js @@ -0,0 +1 @@ +x |> ($ => $ |> @@) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json new file mode 100644 index 000000000000..e51b8230caeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:5)" + ], + "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": "ArrowFunctionExpression", + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "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":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "left": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"$"}, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}} + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/input.js new file mode 100644 index 000000000000..57ea178fd817 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/input.js @@ -0,0 +1 @@ +x |> (@@ |> f(@@, x)) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/output.json new file mode 100644 index 000000000000..9e38a74f8f60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-with-function-call/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "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": "BinaryExpression", + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, + "left": { + "type": "TopicReference", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}} + }, + "operator": "|>", + "right": { + "type": "CallExpression", + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, + "callee": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"f"}, + "name": "f" + }, + "arguments": [ + { + "type": "TopicReference", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}} + }, + { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, + "name": "x" + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/input.js new file mode 100644 index 000000000000..7e8fde902300 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/input.js @@ -0,0 +1 @@ +x |> (@@ |> f()) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/output.json new file mode 100644 index 000000000000..8390963fe8c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-inner-topic/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:12)" + ], + "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":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}} + }, + "operator": "|>", + "right": { + "type": "CallExpression", + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "callee": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"f"}, + "name": "f" + }, + "arguments": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/input.js new file mode 100644 index 000000000000..9d00837048ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/input.js @@ -0,0 +1 @@ +x |> ($ |> f) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/output.json new file mode 100644 index 000000000000..cfab816d1276 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-nested-pipelines-without-outer-topic/output.json @@ -0,0 +1,50 @@ +{ + "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:11)", + "SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:5)" + ], + "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": "BinaryExpression", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "left": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"$"}, + "name": "$" + }, + "operator": "|>", + "right": { + "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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/input.js new file mode 100644 index 000000000000..6ccb6ca13351 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/input.js @@ -0,0 +1 @@ +value |> class { } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/output.json new file mode 100644 index 000000000000..1e904fe3ddea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-class-expression/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "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":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "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": "ClassExpression", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "body": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/input.js new file mode 100644 index 000000000000..faf09879d637 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/input.js @@ -0,0 +1 @@ +value |> function (x) { return; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/output.json new file mode 100644 index 000000000000..4a5325355978 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-no-topic-function-expression/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "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":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "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": "FunctionExpression", + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, + "body": [ + { + "type": "ReturnStatement", + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, + "argument": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/input.js new file mode 100644 index 000000000000..010e5bd09a6d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/input.js @@ -0,0 +1 @@ +x |> yield + @@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/output.json new file mode 100644 index 000000000000..fd8b41311ceb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-non-generator-yield-identifier/output.json @@ -0,0 +1,41 @@ +{ + "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":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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": "BinaryExpression", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "left": { + "type": "Identifier", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"yield"}, + "name": "yield" + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-placeholder-template/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-placeholder-template/input.js new file mode 100644 index 000000000000..15ba69d87479 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-placeholder-template/input.js @@ -0,0 +1 @@ +@@@@FUNCTION@@@@(0, @@@@VALUE@@@@); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-placeholder-template/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-placeholder-template/options.json new file mode 100644 index 000000000000..59af753e4300 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-placeholder-template/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + "placeholders" + ], + "throws": "Cannot combine placeholders plugin and Hack-style pipes." +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/input.js new file mode 100644 index 000000000000..dbb7bffaca8a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/input.js @@ -0,0 +1,7 @@ +class Thing { + #property; + + #method () { + value |> this.#property + @@; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/options.json new file mode 100644 index 000000000000..fcd51fb78f2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + "classPrivateProperties", + "classPrivateMethods" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/output.json new file mode 100644 index 000000000000..9be0015cd858 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-private-property-in-private-method/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Thing"}, + "name": "Thing" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":12,"end":82,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":16,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":17,"end":25,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":11},"identifierName":"property"}, + "name": "property" + } + }, + "value": null + }, + { + "type": "ClassPrivateMethod", + "start":30,"end":80,"loc":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}}, + "static": false, + "key": { + "type": "PrivateName", + "start":30,"end":37,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":9}}, + "id": { + "type": "Identifier", + "start":31,"end":37,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":9},"identifierName":"method"}, + "name": "method" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":41,"end":80,"loc":{"start":{"line":4,"column":13},"end":{"line":6,"column":3}}, + "body": [ + { + "type": "ExpressionStatement", + "start":47,"end":76,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":33}}, + "expression": { + "type": "BinaryExpression", + "start":47,"end":75,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":32}}, + "left": { + "type": "Identifier", + "start":47,"end":52,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":9},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":56,"end":75,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":32}}, + "left": { + "type": "MemberExpression", + "start":56,"end":70,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":27}}, + "object": { + "type": "ThisExpression", + "start":56,"end":60,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":17}} + }, + "computed": false, + "property": { + "type": "PrivateName", + "start":61,"end":70,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":27}}, + "id": { + "type": "Identifier", + "start":62,"end":70,"loc":{"start":{"line":5,"column":19},"end":{"line":5,"column":27},"identifierName":"property"}, + "name": "property" + } + } + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":73,"end":75,"loc":{"start":{"line":5,"column":30},"end":{"line":5,"column":32}} + } + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/input.js new file mode 100644 index 000000000000..868f072fde49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/input.js @@ -0,0 +1 @@ +value |> (@@) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/output.json new file mode 100644 index 000000000000..81a91c7a1330 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-parenthesized/output.json @@ -0,0 +1,35 @@ +{ + "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":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/input.js new file mode 100644 index 000000000000..8a575976cf92 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/input.js @@ -0,0 +1 @@ +value |> @@ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/output.json new file mode 100644 index 000000000000..8b15798610ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-identity-unparenthesized/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "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": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/input.js new file mode 100644 index 000000000000..9063e5a9dcb4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/input.js @@ -0,0 +1 @@ +x |> @@42; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/options.json new file mode 100644 index 000000000000..c0d9c24a71cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "@@" + } + ] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/output.json new file mode 100644 index 000000000000..017aba97749b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-then-digit/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Missing semicolon. (1:7)" + ], + "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":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "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": "TopicReference", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}} + } + } + }, + { + "type": "ExpressionStatement", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/input.js new file mode 100644 index 000000000000..49aeabea11a7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/input.js @@ -0,0 +1 @@ +value |> @@?.method() diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/output.json new file mode 100644 index 000000000000..57270291759b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-topic-with-optional-method-call/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "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": "OptionalCallExpression", + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, + "callee": { + "type": "OptionalMemberExpression", + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "object": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "computed": false, + "property": { + "type": "Identifier", + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19},"identifierName":"method"}, + "name": "method" + }, + "optional": true + }, + "optional": false, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/input.js new file mode 100644 index 000000000000..9943e737c61c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/input.js @@ -0,0 +1 @@ +1 + @@ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/output.json new file mode 100644 index 000000000000..3c7833aaa15c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-unbound-topic/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Topic reference is unbound; it must be inside a pipe body. (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "left": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}} + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-v8intrinsic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-v8intrinsic/input.js new file mode 100644 index 000000000000..4c6a361dae02 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-v8intrinsic/input.js @@ -0,0 +1 @@ +%GetOptimizationStatus(f); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-v8intrinsic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-v8intrinsic/options.json new file mode 100644 index 000000000000..a8302bf05306 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-v8intrinsic/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }], + "v8intrinsic" + ], + "throws": "Cannot combine v8intrinsic plugin and Hack-style pipes." +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/input.js new file mode 100644 index 000000000000..64e109fd55ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/input.js @@ -0,0 +1 @@ +x = 0 |> @@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/output.json new file mode 100644 index 000000000000..2c30399f40cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-assignment/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "BinaryExpression", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "left": { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/input.js new file mode 100644 index 000000000000..17b11e6f87f6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/input.js @@ -0,0 +1,2 @@ +for (var i = 0 |> @@; i <= 10; i++) + sum = sum + i; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/output.json new file mode 100644 index 000000000000..060f5e076bcd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-classic-for-statement-init/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForStatement", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "init": { + "type": "VariableDeclaration", + "start":5,"end":20,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":20}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"i"}, + "name": "i" + }, + "init": { + "type": "BinaryExpression", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "left": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}} + } + } + } + ], + "kind": "var" + }, + "test": { + "type": "BinaryExpression", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, + "left": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"i"}, + "name": "i" + }, + "operator": "<=", + "right": { + "type": "NumericLiteral", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + "update": { + "type": "UpdateExpression", + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"i"}, + "name": "i" + } + }, + "body": { + "type": "ExpressionStatement", + "start":38,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "expression": { + "type": "AssignmentExpression", + "start":38,"end":51,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":38,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"sum"}, + "name": "sum" + }, + "right": { + "type": "BinaryExpression", + "start":44,"end":51,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":15}}, + "left": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"sum"}, + "name": "sum" + }, + "operator": "+", + "right": { + "type": "Identifier", + "start":50,"end":51,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"i"}, + "name": "i" + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/input.js new file mode 100644 index 000000000000..a7badd053692 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/input.js @@ -0,0 +1 @@ +variable %= value |> @@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/output.json new file mode 100644 index 000000000000..b29a05daa578 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-with-spaces/output.json @@ -0,0 +1,41 @@ +{ + "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": "AssignmentExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "operator": "%=", + "left": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"variable"}, + "name": "variable" + }, + "right": { + "type": "BinaryExpression", + "start":12,"end":23,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":23}}, + "left": { + "type": "Identifier", + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/input.js new file mode 100644 index 000000000000..7eaf2543239b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/input.js @@ -0,0 +1 @@ +variable%=value |> @@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/output.json new file mode 100644 index 000000000000..e06d1258b946 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-modulo-assignment-without-spaces/output.json @@ -0,0 +1,41 @@ +{ + "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": "AssignmentExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "operator": "%=", + "left": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"variable"}, + "name": "variable" + }, + "right": { + "type": "BinaryExpression", + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, + "left": { + "type": "Identifier", + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/input.js new file mode 100644 index 000000000000..c36d96442df1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/input.js @@ -0,0 +1 @@ +const x = 0 |> @@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/output.json new file mode 100644 index 000000000000..2142f35fc204 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-within-variable-declaration/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "BinaryExpression", + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "left": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}} + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/input.js new file mode 100644 index 000000000000..d6c413a4382e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/input.js @@ -0,0 +1,3 @@ +function * f (x) { + return x |> (yield @@); +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/options.json new file mode 100644 index 000000000000..7d78ef60d1b8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/output.json new file mode 100644 index 000000000000..ce25fc689b94 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-parenthesized/output.json @@ -0,0 +1,65 @@ +{ + "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":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, + "name": "f" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":21,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}}, + "argument": { + "type": "BinaryExpression", + "start":28,"end":43,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":24}}, + "left": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "YieldExpression", + "start":34,"end":42,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":23}}, + "delegate": false, + "argument": { + "type": "TopicReference", + "start":40,"end":42,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":23}} + }, + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/input.js new file mode 100644 index 000000000000..5754b98a8885 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/input.js @@ -0,0 +1,3 @@ +function * f (x) { + return x |> yield @@; +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/options.json new file mode 100644 index 000000000000..0dfb1fc3aa49 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "@@" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/output.json new file mode 100644 index 000000000000..09bad13154b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-generator-unparenthesized/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized yield expression; please wrap it in parentheses. (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, + "name": "f" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":44,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":21,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "argument": { + "type": "BinaryExpression", + "start":28,"end":41,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":22}}, + "left": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "YieldExpression", + "start":33,"end":41,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, + "delegate": false, + "argument": { + "type": "TopicReference", + "start":39,"end":41,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}} + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/input.js new file mode 100644 index 000000000000..010e5bd09a6d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/input.js @@ -0,0 +1 @@ +x |> yield + @@; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/options.json new file mode 100644 index 000000000000..c0d9c24a71cd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "@@" + } + ] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/output.json new file mode 100644 index 000000000000..fd8b41311ceb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-at-proposal-yield-identifier-unparenthesized/output.json @@ -0,0 +1,41 @@ +{ + "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":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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": "BinaryExpression", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "left": { + "type": "Identifier", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"yield"}, + "name": "yield" + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/input.js new file mode 100644 index 000000000000..cf13f13394d6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/input.js @@ -0,0 +1 @@ +value |> ^^ + 1 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/output.json new file mode 100644 index 000000000000..14a12f4fc9ad --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-first/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "+", + "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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/input.js new file mode 100644 index 000000000000..64774874bd7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/input.js @@ -0,0 +1 @@ +value |> 1 + ^^ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/output.json new file mode 100644 index 000000000000..64f362be927d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-with-topic-last/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/input.js new file mode 100644 index 000000000000..e952adac15fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/input.js @@ -0,0 +1 @@ +value |> a + b diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/output.json new file mode 100644 index 000000000000..6565ae6d9aa2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-addition-without-topic/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/input.js new file mode 100644 index 000000000000..6bf6ad3b7886 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/input.js @@ -0,0 +1 @@ +value |> (() => ^^ + 1) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/output.json new file mode 100644 index 000000000000..5e034e6dee57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-parenthesized/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BinaryExpression", + "start":16,"end":22,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":22}}, + "left": { + "type": "TopicReference", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}} + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/input.js new file mode 100644 index 000000000000..2b9bda557a97 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/input.js @@ -0,0 +1 @@ +10 |> x => x + ^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/options.json new file mode 100644 index 000000000000..ae184a44d3d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "^^" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/output.json new file mode 100644 index 000000000000..8266a4927101 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-arrow-function-unparenthesized/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized arrow function expression; please wrap it in parentheses. (1:6)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "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": "ArrowFunctionExpression", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "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":"x"}, + "name": "x" + } + ], + "body": { + "type": "BinaryExpression", + "start":11,"end":17,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":17}}, + "left": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"x"}, + "name": "x" + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}} + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/input.js new file mode 100644 index 000000000000..d86ba27b5fb6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/input.js @@ -0,0 +1 @@ +value |> x &&= ^^ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/options.json new file mode 100644 index 000000000000..ae184a44d3d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "^^" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/output.json new file mode 100644 index 000000000000..e3d61d042cdb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-logical-and/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized assignment expression; please wrap it in parentheses. (1:9)" + ], + "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":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "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":9,"end":17,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":17}}, + "operator": "&&=", + "left": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "TopicReference", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/input.js new file mode 100644 index 000000000000..69886af44e4a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/input.js @@ -0,0 +1 @@ +value |> [x, y] = ^^ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/options.json new file mode 100644 index 000000000000..ae184a44d3d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "^^" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/output.json new file mode 100644 index 000000000000..4e13d17f8b5e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-normal/output.json @@ -0,0 +1,55 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized assignment expression; please wrap it in parentheses. (1:9)" + ], + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "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":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "elements": [ + { + "type": "Identifier", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11},"identifierName":"x"}, + "name": "x" + }, + { + "type": "Identifier", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14},"identifierName":"y"}, + "name": "y" + } + ] + }, + "right": { + "type": "TopicReference", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/input.js new file mode 100644 index 000000000000..69f15199278b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/input.js @@ -0,0 +1 @@ +value |> x += ^^ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/options.json new file mode 100644 index 000000000000..ae184a44d3d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "^^" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/output.json new file mode 100644 index 000000000000..8f65e60606a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-plus/output.json @@ -0,0 +1,44 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized assignment expression; please wrap it in parentheses. (1:9)" + ], + "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": "AssignmentExpression", + "start":9,"end":16,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":16}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "TopicReference", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/input.js new file mode 100644 index 000000000000..08d370210a2c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/input.js @@ -0,0 +1 @@ +value |> (^^ = 1); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/output.json new file mode 100644 index 000000000000..1c0352cc28cb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-assignment-to-topic/output.json @@ -0,0 +1,52 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "errors": [ + "SyntaxError: Invalid left-hand side in assignment expression. (1:10)" + ], + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":17,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":17}}, + "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":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}}, + "operator": "=", + "left": { + "type": "TopicReference", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}} + }, + "right": { + "type": "NumericLiteral", + "start":15,"end":16,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":16}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/input.js new file mode 100644 index 000000000000..1393e755cf04 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/input.js @@ -0,0 +1 @@ +1 |> f(^^) |> g(^^); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/output.json new file mode 100644 index 000000000000..db7ebf40c8f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-associativity/output.json @@ -0,0 +1,66 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "left": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":5,"end":19,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":19}}, + "left": { + "type": "CallExpression", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, + "callee": { + "type": "Identifier", + "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6},"identifierName":"f"}, + "name": "f" + }, + "arguments": [ + { + "type": "TopicReference", + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}} + } + ] + }, + "operator": "|>", + "right": { + "type": "CallExpression", + "start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, + "callee": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"g"}, + "name": "g" + }, + "arguments": [ + { + "type": "TopicReference", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}} + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/input.js new file mode 100644 index 000000000000..bf04b785006e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/input.js @@ -0,0 +1,3 @@ +async function f () { + return x |> await ^^; +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/output.json new file mode 100644 index 000000000000..9c6d1e74bd5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-async-await/output.json @@ -0,0 +1,54 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":47,"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":47,"loc":{"start":{"line":1,"column":20},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":24,"end":45,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "argument": { + "type": "BinaryExpression", + "start":31,"end":44,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":22}}, + "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":44,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, + "argument": { + "type": "TopicReference", + "start":42,"end":44,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}} + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/input.js new file mode 100644 index 000000000000..b9753fe61125 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/input.js @@ -0,0 +1 @@ +value |> @foo class { constructor () { ^^; } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/options.json new file mode 100644 index 000000000000..5ba6fd121df6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/output.json new file mode 100644 index 000000000000..65e2053d6f2a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-bare-identifier/output.json @@ -0,0 +1,81 @@ +{ + "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": "ClassExpression", + "start":9,"end":46,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":46}}, + "decorators": [ + { + "type": "Decorator", + "start":9,"end":13,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":13}}, + "expression": { + "type": "Identifier", + "start":10,"end":13,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":13},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":20,"end":46,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ClassMethod", + "start":22,"end":44,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":44}}, + "static": false, + "key": { + "type": "Identifier", + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":37,"end":44,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":39,"end":42,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":42}}, + "expression": { + "type": "TopicReference", + "start":39,"end":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}} + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/input.js new file mode 100644 index 000000000000..ae4455ff35bc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/input.js @@ -0,0 +1 @@ +value |> @(foo) class { constructor () { ^^; } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/options.json new file mode 100644 index 000000000000..5ba6fd121df6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/output.json new file mode 100644 index 000000000000..06455b0c8955 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-identifier/output.json @@ -0,0 +1,81 @@ +{ + "type": "File", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "program": { + "type": "Program", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}}, + "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": "ClassExpression", + "start":9,"end":48,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":48}}, + "decorators": [ + { + "type": "Decorator", + "start":9,"end":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "expression": { + "type": "Identifier", + "start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"foo"}, + "name": "foo" + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":22,"end":48,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":48}}, + "body": [ + { + "type": "ClassMethod", + "start":24,"end":46,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":46}}, + "static": false, + "key": { + "type": "Identifier", + "start":24,"end":35,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":35},"identifierName":"constructor"}, + "name": "constructor" + }, + "computed": false, + "kind": "constructor", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":39,"end":46,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ExpressionStatement", + "start":41,"end":44,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":44}}, + "expression": { + "type": "TopicReference", + "start":41,"end":43,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":43}} + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/input.js new file mode 100644 index 000000000000..0f36376fdf7f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/input.js @@ -0,0 +1 @@ +value |> @(^^) class {} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/options.json new file mode 100644 index 000000000000..5ba6fd121df6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + ["decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/output.json new file mode 100644 index 000000000000..66492e7e5519 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-decorator-with-parenthesized-topic/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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": "ClassExpression", + "start":9,"end":23,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":23}}, + "decorators": [ + { + "type": "Decorator", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "expression": { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + } + } + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}}, + "body": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/input.js new file mode 100644 index 000000000000..552689be78bd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/input.js @@ -0,0 +1,7 @@ +value |> new (class Thing { + #property; + + method () { + return ^^ + this.#property; + } +}); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/options.json new file mode 100644 index 000000000000..77d2746d0ac0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + "classPrivateProperties", + "classPrivateMethods" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/output.json new file mode 100644 index 000000000000..5e32fe170d3e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-with-private-property/output.json @@ -0,0 +1,121 @@ +{ + "type": "File", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "program": { + "type": "Program", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":95,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":3}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":94,"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":94,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":2}}, + "callee": { + "type": "ClassExpression", + "start":14,"end":93,"loc":{"start":{"line":1,"column":14},"end":{"line":7,"column":1}}, + "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":93,"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":91,"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":91,"loc":{"start":{"line":4,"column":12},"end":{"line":6,"column":3}}, + "body": [ + { + "type": "ReturnStatement", + "start":60,"end":87,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":31}}, + "argument": { + "type": "BinaryExpression", + "start":67,"end":86,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":30}}, + "left": { + "type": "TopicReference", + "start":67,"end":69,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":13}} + }, + "operator": "+", + "right": { + "type": "MemberExpression", + "start":72,"end":86,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":30}}, + "object": { + "type": "ThisExpression", + "start":72,"end":76,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":20}} + }, + "computed": false, + "property": { + "type": "PrivateName", + "start":77,"end":86,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":30}}, + "id": { + "type": "Identifier", + "start":78,"end":86,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":30},"identifierName":"property"}, + "name": "property" + } + } + } + } + } + ], + "directives": [] + } + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 13 + } + }, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/input.js new file mode 100644 index 000000000000..25d456544a7c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/input.js @@ -0,0 +1 @@ +x |> class { constructor () { this.x = ^^; } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/output.json new file mode 100644 index 000000000000..6673187ad7a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-class-expression-without-private-property/output.json @@ -0,0 +1,89 @@ +{ + "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":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "ClassExpression", + "start":5,"end":46,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":46}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":11,"end":46,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":46}}, + "body": [ + { + "type": "ClassMethod", + "start":13,"end":44,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":44}}, + "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":44,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":44}}, + "body": [ + { + "type": "ExpressionStatement", + "start":30,"end":42,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":42}}, + "expression": { + "type": "AssignmentExpression", + "start":30,"end":41,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":41}}, + "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":41,"loc":{"start":{"line":1,"column":39},"end":{"line":1,"column":41}} + } + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/input.js new file mode 100644 index 000000000000..29bfaba15992 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/input.js @@ -0,0 +1 @@ +10 |> (^^, ^^); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/output.json new file mode 100644 index 000000000000..07c3718a305e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-comma-topic-pair/output.json @@ -0,0 +1,49 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, + "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":13,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":13}}, + "expressions": [ + { + "type": "TopicReference", + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}} + }, + { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + } + ], + "extra": { + "parenthesized": true, + "parenStart": 6 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/input.js new file mode 100644 index 000000000000..5a02dee8ec60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/input.js @@ -0,0 +1 @@ +value |> a[b] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/output.json new file mode 100644 index 000000000000..3959a09863b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-computed-no-topic/output.json @@ -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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/input.js new file mode 100644 index 000000000000..4ad75cd85778 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/input.js @@ -0,0 +1 @@ +value |> ^^ / 2 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/output.json new file mode 100644 index 000000000000..b270f10daff6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-division/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "/", + "right": { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..483882381f09 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { do x += ^^; while (x < 50); } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..941f2f506218 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "program": { + "type": "Program", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":43,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":43}}, + "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":43,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":43}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":43,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":43}}, + "body": [ + { + "type": "DoWhileStatement", + "start":14,"end":41,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":41}}, + "body": { + "type": "ExpressionStatement", + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, + "expression": { + "type": "AssignmentExpression", + "start":17,"end":24,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":24}}, + "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":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}} + } + } + }, + "test": { + "type": "BinaryExpression", + "start":33,"end":39,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":39}}, + "left": { + "type": "Identifier", + "start":33,"end":34,"loc":{"start":{"line":1,"column":33},"end":{"line":1,"column":34},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start":37,"end":39,"loc":{"start":{"line":1,"column":37},"end":{"line":1,"column":39}}, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..ab8054321160 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { do x += 1; while (x < ^^); } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..19a23bc8d0a9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-do-while-loop-and-topic-in-loop-head/output.json @@ -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": "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":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": "TopicReference", + "start":36,"end":38,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":38}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..713a2f9da3a3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/input.js @@ -0,0 +1,3 @@ +async function af () { + value |> do { for await (const e of sequence) ^^; } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..d96bb6647ab0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + "doExpressions" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..fddba25fc5fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":78,"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":78,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "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":76,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":53}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":37,"end":76,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":53}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":74,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":51}}, + "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":74,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":51}}, + "expression": { + "type": "TopicReference", + "start":71,"end":73,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":50}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..132c5f9c1644 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/input.js @@ -0,0 +1,3 @@ +async function af () { + value |> do { for await (const e of ^^) e; } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..d96bb6647ab0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + "doExpressions" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..4f5624112439 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-and-topic-in-loop-head/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":71,"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":71,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":46}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":46}}, + "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":69,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":46}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":37,"end":69,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":46}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":67,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":44}}, + "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":63,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":40}} + }, + "body": { + "type": "ExpressionStatement", + "start":65,"end":67,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":44}}, + "expression": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":43},"identifierName":"e"}, + "name": "e" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..713a2f9da3a3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/input.js @@ -0,0 +1,3 @@ +async function af () { + value |> do { for await (const e of sequence) ^^; } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..ab375cbf19e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + "doExpressions", + "asyncGenerators" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..fddba25fc5fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-body/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":78,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":78,"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":78,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":76,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":53}}, + "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":76,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":53}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":37,"end":76,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":53}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":74,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":51}}, + "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":74,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":51}}, + "expression": { + "type": "TopicReference", + "start":71,"end":73,"loc":{"start":{"line":2,"column":48},"end":{"line":2,"column":50}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..132c5f9c1644 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/input.js @@ -0,0 +1,3 @@ +async function af () { + value |> do { for await (const e of ^^) e; } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..ab375cbf19e6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + "doExpressions", + "asyncGenerators" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..4f5624112439 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-await-of-loop-transform-and-topic-in-loop-head/output.json @@ -0,0 +1,93 @@ +{ + "type": "File", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":71,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":71,"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":71,"loc":{"start":{"line":1,"column":21},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ExpressionStatement", + "start":25,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":46}}, + "expression": { + "type": "BinaryExpression", + "start":25,"end":69,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":46}}, + "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":69,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":46}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":37,"end":69,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":46}}, + "body": [ + { + "type": "ForOfStatement", + "start":39,"end":67,"loc":{"start":{"line":2,"column":16},"end":{"line":2,"column":44}}, + "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":63,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":40}} + }, + "body": { + "type": "ExpressionStatement", + "start":65,"end":67,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":44}}, + "expression": { + "type": "Identifier", + "start":65,"end":66,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":43},"identifierName":"e"}, + "name": "e" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..35943c02ee31 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { for (let i = 0; i < n; i += 1) ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..de572e961fe4 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "program": { + "type": "Program", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":50,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":50}}, + "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":50,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":50}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":50,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":50}}, + "body": [ + { + "type": "ForStatement", + "start":14,"end":48,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":48}}, + "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":48,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":48}}, + "expression": { + "type": "TopicReference", + "start":45,"end":47,"loc":{"start":{"line":1,"column":45},"end":{"line":1,"column":47}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..a115a3f2e5b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { for (let i = ^^; predicate(i, ^^); i += ^^) i; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..3afffc17b927 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-classic-loop-and-topic-in-loop-head/output.json @@ -0,0 +1,106 @@ +{ + "type": "File", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "program": { + "type": "Program", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":62,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":62}}, + "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":62,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":62}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":62,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":62}}, + "body": [ + { + "type": "ForStatement", + "start":14,"end":60,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":60}}, + "init": { + "type": "VariableDeclaration", + "start":19,"end":29,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":29}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":23,"end":29,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":29}}, + "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":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}} + } + } + ], + "kind": "let" + }, + "test": { + "type": "CallExpression", + "start":31,"end":47,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":47}}, + "callee": { + "type": "Identifier", + "start":31,"end":40,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":40},"identifierName":"predicate"}, + "name": "predicate" + }, + "arguments": [ + { + "type": "Identifier", + "start":41,"end":42,"loc":{"start":{"line":1,"column":41},"end":{"line":1,"column":42},"identifierName":"i"}, + "name": "i" + }, + { + "type": "TopicReference", + "start":44,"end":46,"loc":{"start":{"line":1,"column":44},"end":{"line":1,"column":46}} + } + ] + }, + "update": { + "type": "AssignmentExpression", + "start":49,"end":56,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":56}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":49,"end":50,"loc":{"start":{"line":1,"column":49},"end":{"line":1,"column":50},"identifierName":"i"}, + "name": "i" + }, + "right": { + "type": "TopicReference", + "start":54,"end":56,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":56}} + } + }, + "body": { + "type": "ExpressionStatement", + "start":58,"end":60,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":60}}, + "expression": { + "type": "Identifier", + "start":58,"end":59,"loc":{"start":{"line":1,"column":58},"end":{"line":1,"column":59},"identifierName":"i"}, + "name": "i" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..31ef18436069 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { for (e in object) ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..daa667eaaed9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "program": { + "type": "Program", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":37}}, + "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":37,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":37}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":37,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":37}}, + "body": [ + { + "type": "ForInStatement", + "start":14,"end":35,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":35}}, + "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":35,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":35}}, + "expression": { + "type": "TopicReference", + "start":32,"end":34,"loc":{"start":{"line":1,"column":32},"end":{"line":1,"column":34}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..fbfcb2157610 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { for (e in ^^) e; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..f230de3579f5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-in-loop-and-topic-in-loop-head/output.json @@ -0,0 +1,61 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "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":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, + "body": [ + { + "type": "ForInStatement", + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, + "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":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}} + }, + "body": { + "type": "ExpressionStatement", + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "expression": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"e"}, + "name": "e" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/input.js new file mode 100644 index 000000000000..23642b59994e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { for (e of sequence) ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/output.json new file mode 100644 index 000000000000..45b65d93e930 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-body/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "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":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "ForOfStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "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":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, + "expression": { + "type": "TopicReference", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/input.js new file mode 100644 index 000000000000..b1eaa87e4c36 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { for (e of ^^) e; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/output.json new file mode 100644 index 000000000000..0a487cc24354 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-for-of-loop-and-topic-in-loop-head/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "program": { + "type": "Program", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":32,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":32}}, + "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":32,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":32}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":32,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":32}}, + "body": [ + { + "type": "ForOfStatement", + "start":14,"end":30,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":30}}, + "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":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}} + }, + "body": { + "type": "ExpressionStatement", + "start":28,"end":30,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":30}}, + "expression": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":29},"identifierName":"e"}, + "name": "e" + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/input.js new file mode 100644 index 000000000000..4aea463b8e0a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/input.js @@ -0,0 +1 @@ +value |> do { if (yes) null; else if (no) ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/output.json new file mode 100644 index 000000000000..be79908de4c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-body/output.json @@ -0,0 +1,74 @@ +{ + "type": "File", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "program": { + "type": "Program", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":47,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":47}}, + "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":47,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":47}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":47,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":47}}, + "body": [ + { + "type": "IfStatement", + "start":14,"end":45,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":45}}, + "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":45,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":45}}, + "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":45,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":45}}, + "expression": { + "type": "TopicReference", + "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}} + } + }, + "alternate": null + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/input.js new file mode 100644 index 000000000000..1019b6f7d9e0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/input.js @@ -0,0 +1 @@ +value |> do { if (yes) null; else ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/output.json new file mode 100644 index 000000000000..dc4340eba991 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-else-if-body/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "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":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "IfStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "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": "ExpressionStatement", + "start":34,"end":37,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":37}}, + "expression": { + "type": "TopicReference", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/input.js new file mode 100644 index 000000000000..d1305366931e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/input.js @@ -0,0 +1 @@ +value |> do { if (yes) ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/output.json new file mode 100644 index 000000000000..e16a87fba31f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-body/output.json @@ -0,0 +1,57 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}}, + "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":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":28,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":28}}, + "body": [ + { + "type": "IfStatement", + "start":14,"end":26,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":26}}, + "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":26,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":26}}, + "expression": { + "type": "TopicReference", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}} + } + }, + "alternate": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/input.js new file mode 100644 index 000000000000..d1caca34d0cf --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/input.js @@ -0,0 +1 @@ +value |> do { if (^^) 1; else 0; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/output.json new file mode 100644 index 000000000000..727a3813b9f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-if-statement-and-topic-in-if-head/output.json @@ -0,0 +1,73 @@ +{ + "type": "File", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "program": { + "type": "Program", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":34,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":34}}, + "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":34,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":34}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":34,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":34}}, + "body": [ + { + "type": "IfStatement", + "start":14,"end":32,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":32}}, + "test": { + "type": "TopicReference", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}} + }, + "consequent": { + "type": "ExpressionStatement", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}}, + "expression": { + "type": "NumericLiteral", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + "alternate": { + "type": "ExpressionStatement", + "start":30,"end":32,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":32}}, + "expression": { + "type": "NumericLiteral", + "start":30,"end":31,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":31}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/input.js new file mode 100644 index 000000000000..c7309bf7f69c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/input.js @@ -0,0 +1,7 @@ +value |> do { + switch (number) { + case 0: ^^; + case 1: ^^ + 1; + default: ^^ + 10; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/output.json new file mode 100644 index 000000000000..3fa9c9962c8b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-body/output.json @@ -0,0 +1,139 @@ +{ + "type": "File", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":97,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"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": "DoExpression", + "start":9,"end":97,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":97,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "SwitchStatement", + "start":16,"end":95,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "discriminant": { + "type": "Identifier", + "start":24,"end":30,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":16},"identifierName":"number"}, + "name": "number" + }, + "cases": [ + { + "type": "SwitchCase", + "start":38,"end":49,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":46,"end":49,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":15}}, + "expression": { + "type": "TopicReference", + "start":46,"end":48,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}} + } + } + ], + "test": { + "type": "NumericLiteral", + "start":43,"end":44,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "SwitchCase", + "start":54,"end":69,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":19}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":62,"end":69,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":19}}, + "expression": { + "type": "BinaryExpression", + "start":62,"end":68,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":18}}, + "left": { + "type": "TopicReference", + "start":62,"end":64,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":14}} + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":67,"end":68,"loc":{"start":{"line":4,"column":17},"end":{"line":4,"column":18}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + ], + "test": { + "type": "NumericLiteral", + "start":59,"end":60,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "SwitchCase", + "start":74,"end":91,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":21}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":83,"end":91,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":21}}, + "expression": { + "type": "BinaryExpression", + "start":83,"end":90,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":20}}, + "left": { + "type": "TopicReference", + "start":83,"end":85,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":15}} + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":88,"end":90,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":20}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + } + } + ], + "test": null + } + ] + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/input.js new file mode 100644 index 000000000000..0fa54d2628f1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/input.js @@ -0,0 +1,7 @@ +value |> do { + switch (^^) { + case 0: 50; + case 1: 60; + default: 70; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/output.json new file mode 100644 index 000000000000..93929e99ee58 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-switch-statement-and-topic-in-switch-head/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":84,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"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": "DoExpression", + "start":9,"end":84,"loc":{"start":{"line":1,"column":9},"end":{"line":7,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":84,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "SwitchStatement", + "start":16,"end":82,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, + "discriminant": { + "type": "TopicReference", + "start":24,"end":26,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}} + }, + "cases": [ + { + "type": "SwitchCase", + "start":34,"end":45,"loc":{"start":{"line":3,"column":4},"end":{"line":3,"column":15}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":42,"end":45,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":15}}, + "expression": { + "type": "NumericLiteral", + "start":42,"end":44,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + } + ], + "test": { + "type": "NumericLiteral", + "start":39,"end":40,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + { + "type": "SwitchCase", + "start":50,"end":61,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":58,"end":61,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":15}}, + "expression": { + "type": "NumericLiteral", + "start":58,"end":60,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":14}}, + "extra": { + "rawValue": 60, + "raw": "60" + }, + "value": 60 + } + } + ], + "test": { + "type": "NumericLiteral", + "start":55,"end":56,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + }, + { + "type": "SwitchCase", + "start":66,"end":78,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":16}}, + "consequent": [ + { + "type": "ExpressionStatement", + "start":75,"end":78,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":16}}, + "expression": { + "type": "NumericLiteral", + "start":75,"end":77,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":15}}, + "extra": { + "rawValue": 70, + "raw": "70" + }, + "value": 70 + } + } + ], + "test": null + } + ] + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/input.js new file mode 100644 index 000000000000..0bda1af6aee9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/input.js @@ -0,0 +1 @@ +value |> do { ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/output.json new file mode 100644 index 000000000000..2c53651ce7fe --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-topic-identity/output.json @@ -0,0 +1,47 @@ +{ + "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":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "DoExpression", + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":19,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":19}}, + "body": [ + { + "type": "ExpressionStatement", + "start":14,"end":17,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":17}}, + "expression": { + "type": "TopicReference", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}} + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/input.js new file mode 100644 index 000000000000..bd46d35dd51a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/input.js @@ -0,0 +1,4 @@ +value |> do { + try { JSON.parse(^^); } + catch (error) { console.error(^^); } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/output.json new file mode 100644 index 000000000000..eae50a367908 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-catch-clause/output.json @@ -0,0 +1,125 @@ +{ + "type": "File", + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":80,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"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": "DoExpression", + "start":9,"end":80,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":80,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":78,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":38}}, + "block": { + "type": "BlockStatement", + "start":20,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":25}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":37,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":23}}, + "expression": { + "type": "CallExpression", + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + } + }, + "arguments": [ + { + "type": "TopicReference", + "start":33,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}} + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":42,"end":78,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":38}}, + "param": { + "type": "Identifier", + "start":49,"end":54,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":56,"end":78,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":38}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":76,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":36}}, + "expression": { + "type": "CallExpression", + "start":58,"end":75,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":35}}, + "callee": { + "type": "MemberExpression", + "start":58,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":58,"end":65,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":66,"end":71,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + } + }, + "arguments": [ + { + "type": "TopicReference", + "start":72,"end":74,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":34}} + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/input.js new file mode 100644 index 000000000000..ac5a8f522f39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/input.js @@ -0,0 +1,5 @@ +value |> do { + try { JSON.parse(whatever); } + catch (error) { console.error(error); } + finally { something(^^); } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/output.json new file mode 100644 index 000000000000..798e55fdc030 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-finally-clause/output.json @@ -0,0 +1,152 @@ +{ + "type": "File", + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":118,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"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": "DoExpression", + "start":9,"end":118,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":118,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":116,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":28}}, + "block": { + "type": "BlockStatement", + "start":20,"end":45,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":31}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":43,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":29}}, + "expression": { + "type": "CallExpression", + "start":22,"end":42,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":28}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + } + }, + "arguments": [ + { + "type": "Identifier", + "start":33,"end":41,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":27},"identifierName":"whatever"}, + "name": "whatever" + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":48,"end":87,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, + "param": { + "type": "Identifier", + "start":55,"end":60,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":62,"end":87,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":64,"end":85,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, + "expression": { + "type": "CallExpression", + "start":64,"end":84,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, + "callee": { + "type": "MemberExpression", + "start":64,"end":77,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":64,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":72,"end":77,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + } + }, + "arguments": [ + { + "type": "Identifier", + "start":78,"end":83,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, + "name": "error" + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": { + "type": "BlockStatement", + "start":98,"end":116,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":28}}, + "body": [ + { + "type": "ExpressionStatement", + "start":100,"end":114,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":26}}, + "expression": { + "type": "CallExpression", + "start":100,"end":113,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":25}}, + "callee": { + "type": "Identifier", + "start":100,"end":109,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":21},"identifierName":"something"}, + "name": "something" + }, + "arguments": [ + { + "type": "TopicReference", + "start":110,"end":112,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":24}} + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/input.js new file mode 100644 index 000000000000..d104b53442b0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/input.js @@ -0,0 +1,5 @@ +value |> do { + try { JSON.parse(^^); } + catch (error) { console.error(error); } + finally { something(); } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/output.json new file mode 100644 index 000000000000..963ec3e5f04b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-finally-statements-and-topic-in-try-clause/output.json @@ -0,0 +1,146 @@ +{ + "type": "File", + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":110,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"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": "DoExpression", + "start":9,"end":110,"loc":{"start":{"line":1,"column":9},"end":{"line":5,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":110,"loc":{"start":{"line":1,"column":12},"end":{"line":5,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":108,"loc":{"start":{"line":2,"column":2},"end":{"line":4,"column":26}}, + "block": { + "type": "BlockStatement", + "start":20,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":25}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":37,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":23}}, + "expression": { + "type": "CallExpression", + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + } + }, + "arguments": [ + { + "type": "TopicReference", + "start":33,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}} + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":42,"end":81,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, + "param": { + "type": "Identifier", + "start":49,"end":54,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":56,"end":81,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":79,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, + "expression": { + "type": "CallExpression", + "start":58,"end":78,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, + "callee": { + "type": "MemberExpression", + "start":58,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":58,"end":65,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":66,"end":71,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + } + }, + "arguments": [ + { + "type": "Identifier", + "start":72,"end":77,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, + "name": "error" + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": { + "type": "BlockStatement", + "start":92,"end":108,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":26}}, + "body": [ + { + "type": "ExpressionStatement", + "start":94,"end":106,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":24}}, + "expression": { + "type": "CallExpression", + "start":94,"end":105,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":23}}, + "callee": { + "type": "Identifier", + "start":94,"end":103,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":21},"identifierName":"something"}, + "name": "something" + }, + "arguments": [] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/input.js new file mode 100644 index 000000000000..b1571556cb70 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/input.js @@ -0,0 +1,4 @@ +value |> do { + try { JSON.parse(^^); } + catch (error) { console.error(error); } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/output.json new file mode 100644 index 000000000000..11241eb3ca0e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-try-catch-statements-topic-in-try-clause/output.json @@ -0,0 +1,126 @@ +{ + "type": "File", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":83,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"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": "DoExpression", + "start":9,"end":83,"loc":{"start":{"line":1,"column":9},"end":{"line":4,"column":1}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":83,"loc":{"start":{"line":1,"column":12},"end":{"line":4,"column":1}}, + "body": [ + { + "type": "TryStatement", + "start":16,"end":81,"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":41}}, + "block": { + "type": "BlockStatement", + "start":20,"end":39,"loc":{"start":{"line":2,"column":6},"end":{"line":2,"column":25}}, + "body": [ + { + "type": "ExpressionStatement", + "start":22,"end":37,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":23}}, + "expression": { + "type": "CallExpression", + "start":22,"end":36,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":22}}, + "callee": { + "type": "MemberExpression", + "start":22,"end":32,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":18}}, + "object": { + "type": "Identifier", + "start":22,"end":26,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":12},"identifierName":"JSON"}, + "name": "JSON" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":27,"end":32,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":18},"identifierName":"parse"}, + "name": "parse" + } + }, + "arguments": [ + { + "type": "TopicReference", + "start":33,"end":35,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":21}} + } + ] + } + } + ], + "directives": [] + }, + "handler": { + "type": "CatchClause", + "start":42,"end":81,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":41}}, + "param": { + "type": "Identifier", + "start":49,"end":54,"loc":{"start":{"line":3,"column":9},"end":{"line":3,"column":14},"identifierName":"error"}, + "name": "error" + }, + "body": { + "type": "BlockStatement", + "start":56,"end":81,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":41}}, + "body": [ + { + "type": "ExpressionStatement", + "start":58,"end":79,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":39}}, + "expression": { + "type": "CallExpression", + "start":58,"end":78,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":38}}, + "callee": { + "type": "MemberExpression", + "start":58,"end":71,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":31}}, + "object": { + "type": "Identifier", + "start":58,"end":65,"loc":{"start":{"line":3,"column":18},"end":{"line":3,"column":25},"identifierName":"console"}, + "name": "console" + }, + "computed": false, + "property": { + "type": "Identifier", + "start":66,"end":71,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":31},"identifierName":"error"}, + "name": "error" + } + }, + "arguments": [ + { + "type": "Identifier", + "start":72,"end":77,"loc":{"start":{"line":3,"column":32},"end":{"line":3,"column":37},"identifierName":"error"}, + "name": "error" + } + ] + } + } + ], + "directives": [] + } + }, + "finalizer": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/input.js new file mode 100644 index 000000000000..381952ffe772 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/input.js @@ -0,0 +1 @@ +value |> do { while (x < 50) x += ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/output.json new file mode 100644 index 000000000000..ac3f99102fec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-body/output.json @@ -0,0 +1,80 @@ +{ + "type": "File", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "program": { + "type": "Program", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}}, + "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":39,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":39}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":39,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":39}}, + "body": [ + { + "type": "WhileStatement", + "start":14,"end":37,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":37}}, + "test": { + "type": "BinaryExpression", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "left": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}}, + "extra": { + "rawValue": 50, + "raw": "50" + }, + "value": 50 + } + }, + "body": { + "type": "ExpressionStatement", + "start":29,"end":37,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":37}}, + "expression": { + "type": "AssignmentExpression", + "start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "TopicReference", + "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}} + } + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/input.js new file mode 100644 index 000000000000..f26c89059aeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/input.js @@ -0,0 +1 @@ +value |> do { while (x < ^^) x += 1; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/output.json new file mode 100644 index 000000000000..0f197cbea8b2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-while-loop-topic-in-loop-head/output.json @@ -0,0 +1,80 @@ +{ + "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": "WhileStatement", + "start":14,"end":36,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":36}}, + "test": { + "type": "BinaryExpression", + "start":21,"end":27,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":27}}, + "left": { + "type": "Identifier", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22},"identifierName":"x"}, + "name": "x" + }, + "operator": "<", + "right": { + "type": "TopicReference", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}} + } + }, + "body": { + "type": "ExpressionStatement", + "start":29,"end":36,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":36}}, + "expression": { + "type": "AssignmentExpression", + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "operator": "+=", + "left": { + "type": "Identifier", + "start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/input.js new file mode 100644 index 000000000000..c6ab3ba44bb9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/input.js @@ -0,0 +1 @@ +value |> do { with ({}) ^^; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/options.json new file mode 100644 index 000000000000..94dfada55ca3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "doExpressions"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/output.json new file mode 100644 index 000000000000..4b7b5543bb3b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-do-transform-with-block-topic-in-body/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "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":29,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":29}}, + "async": false, + "body": { + "type": "BlockStatement", + "start":12,"end":29,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":29}}, + "body": [ + { + "type": "WithStatement", + "start":14,"end":27,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":27}}, + "object": { + "type": "ObjectExpression", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, + "properties": [] + }, + "body": { + "type": "ExpressionStatement", + "start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}}, + "expression": { + "type": "TopicReference", + "start":24,"end":26,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":26}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/input.js new file mode 100644 index 000000000000..1bf01584ef25 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/input.js @@ -0,0 +1 @@ +value |> ^^==1 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/output.json new file mode 100644 index 000000000000..98ecc4bca832 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-loose-with-topic-first-without-spaces/output.json @@ -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":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/input.js new file mode 100644 index 000000000000..eff56264f60c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/input.js @@ -0,0 +1 @@ +value |> ^^===1 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/output.json new file mode 100644 index 000000000000..0d9b61f0bf65 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-equality-strict-with-topic-first-without-spaces/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "program": { + "type": "Program", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "===", + "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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/input.js new file mode 100644 index 000000000000..230a2929ae2b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/input.js @@ -0,0 +1 @@ +value |> f(^^) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/output.json new file mode 100644 index 000000000000..a2fa21c6ceb7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-with-topic-in-argument/output.json @@ -0,0 +1,42 @@ +{ + "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": "CallExpression", + "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, + "callee": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + }, + "arguments": [ + { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/input.js new file mode 100644 index 000000000000..15a3d7657b9c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/input.js @@ -0,0 +1 @@ +value |> f diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/output.json new file mode 100644 index 000000000000..3917568d724f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-call-without-topic/output.json @@ -0,0 +1,35 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "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":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": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, + "name": "f" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/input.js new file mode 100644 index 000000000000..15025273a903 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/input.js @@ -0,0 +1 @@ +x |> function () { ^^ |> ^^ } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/output.json new file mode 100644 index 000000000000..f81c748e7378 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-another-pipe-in-function-body/output.json @@ -0,0 +1,59 @@ +{ + "type": "File", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "program": { + "type": "Program", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":29,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":29}}, + "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": "FunctionExpression", + "start":5,"end":29,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":29}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":29,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":29}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "expression": { + "type": "BinaryExpression", + "start":19,"end":27,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":27}}, + "left": { + "type": "TopicReference", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":25,"end":27,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":27}} + } + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/input.js new file mode 100644 index 000000000000..3ff87e96dff6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/input.js @@ -0,0 +1 @@ +value |> function (x = ^^) { return x; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/output.json new file mode 100644 index 000000000000..640dfd370737 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-default-parameter/output.json @@ -0,0 +1,65 @@ +{ + "type": "File", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "program": { + "type": "Program", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":40,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":40}}, + "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": "FunctionExpression", + "start":9,"end":40,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":40}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "start":19,"end":25,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":25}}, + "left": { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "TopicReference", + "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}} + } + } + ], + "body": { + "type": "BlockStatement", + "start":27,"end":40,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":40}}, + "body": [ + { + "type": "ReturnStatement", + "start":29,"end":38,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":38}}, + "argument": { + "type": "Identifier", + "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37},"identifierName":"x"}, + "name": "x" + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/input.js new file mode 100644 index 000000000000..b27ad6d60dd2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/input.js @@ -0,0 +1 @@ +x |> function () { ^^ } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/output.json new file mode 100644 index 000000000000..ab81762b5445 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-function-definition-with-topic-in-function-body/output.json @@ -0,0 +1,50 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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": "FunctionExpression", + "start":5,"end":23,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":23}}, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":17,"end":23,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":23}}, + "body": [ + { + "type": "ExpressionStatement", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}}, + "expression": { + "type": "TopicReference", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + } + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-topic/input.js new file mode 100644 index 000000000000..a18cbd0f1bb2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-topic/input.js @@ -0,0 +1 @@ +value |> # diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-topic/options.json new file mode 100644 index 000000000000..332d1bfe8aae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-topic/options.json @@ -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)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/input.js new file mode 100644 index 000000000000..5a6ea279ee6f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/input.js @@ -0,0 +1,2 @@ +#[0]; +1 |> #[0, ^^]; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/options.json new file mode 100644 index 000000000000..16ae6a6075f2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + ["recordAndTuple", { "syntaxType": "hash" }] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/output.json new file mode 100644 index 000000000000..4056d03b8c29 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-hash-tuple/output.json @@ -0,0 +1,69 @@ +{ + "type": "File", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "program": { + "type": "Program", + "start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":14}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}}, + "expression": { + "type": "TupleExpression", + "start":0,"end":4,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":4}}, + "elements": [ + { + "type": "NumericLiteral", + "start":2,"end":3,"loc":{"start":{"line":1,"column":2},"end":{"line":1,"column":3}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + ] + } + }, + { + "type": "ExpressionStatement", + "start":6,"end":20,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":14}}, + "expression": { + "type": "BinaryExpression", + "start":6,"end":19,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":13}}, + "left": { + "type": "NumericLiteral", + "start":6,"end":7,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "|>", + "right": { + "type": "TupleExpression", + "start":11,"end":19,"loc":{"start":{"line":2,"column":5},"end":{"line":2,"column":13}}, + "elements": [ + { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + { + "type": "TopicReference", + "start":16,"end":18,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":12}} + } + ] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/input.js new file mode 100644 index 000000000000..ebfd2971b61d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/input.js @@ -0,0 +1 @@ +value |> ^^ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/options.json new file mode 100644 index 000000000000..524e72afed8f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], "pipelineOperator"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/output.json new file mode 100644 index 000000000000..8b15798610ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-mixed-pipeline-plugins/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "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": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/input.js new file mode 100644 index 000000000000..13668512bfdd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/input.js @@ -0,0 +1 @@ +x |> ($ => ^^ |> f(^^, $) |> ^^ > 1) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/output.json new file mode 100644 index 000000000000..c715bce7e7ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-with-required-topics/output.json @@ -0,0 +1,97 @@ +{ + "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":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "ArrowFunctionExpression", + "start":6,"end":35,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":35}}, + "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":35,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":35}}, + "left": { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":17,"end":35,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":35}}, + "left": { + "type": "CallExpression", + "start":17,"end":25,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":25}}, + "callee": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"f"}, + "name": "f" + }, + "arguments": [ + { + "type": "TopicReference", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + }, + { + "type": "Identifier", + "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24},"identifierName":"$"}, + "name": "$" + } + ] + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":29,"end":35,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":35}}, + "left": { + "type": "TopicReference", + "start":29,"end":31,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":31}} + }, + "operator": ">", + "right": { + "type": "NumericLiteral", + "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/input.js new file mode 100644 index 000000000000..772174790e79 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/input.js @@ -0,0 +1 @@ +x |> ($ => ^^ |> $ + 1) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json new file mode 100644 index 000000000000..d0b6b79bd97e --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json @@ -0,0 +1,76 @@ +{ + "type": "File", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "errors": [ + "SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:17)" + ], + "program": { + "type": "Program", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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": "ArrowFunctionExpression", + "start":6,"end":22,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":22}}, + "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":22,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":22}}, + "left": { + "type": "TopicReference", + "start":11,"end":13,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":13}} + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":17,"end":22,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":22}}, + "left": { + "type": "Identifier", + "start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18},"identifierName":"$"}, + "name": "$" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start":21,"end":22,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":22}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/input.js new file mode 100644 index 000000000000..9f92c6862b1f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/input.js @@ -0,0 +1 @@ +x |> ($ => $ |> ^^) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json new file mode 100644 index 000000000000..e51b8230caeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json @@ -0,0 +1,62 @@ +{ + "type": "File", + "start":0,"end":19,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":19}}, + "errors": [ + "SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:5)" + ], + "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": "ArrowFunctionExpression", + "start":6,"end":18,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":18}}, + "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":18,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":18}}, + "left": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"$"}, + "name": "$" + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":16,"end":18,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":18}} + } + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/input.js new file mode 100644 index 000000000000..ea18fee6db62 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/input.js @@ -0,0 +1 @@ +x |> (^^ |> f(^^, x)) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/output.json new file mode 100644 index 000000000000..9e38a74f8f60 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-with-function-call/output.json @@ -0,0 +1,60 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "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": "BinaryExpression", + "start":6,"end":20,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":20}}, + "left": { + "type": "TopicReference", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}} + }, + "operator": "|>", + "right": { + "type": "CallExpression", + "start":12,"end":20,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":20}}, + "callee": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"f"}, + "name": "f" + }, + "arguments": [ + { + "type": "TopicReference", + "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}} + }, + { + "type": "Identifier", + "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19},"identifierName":"x"}, + "name": "x" + } + ] + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/input.js new file mode 100644 index 000000000000..9afeed5ee8e1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/input.js @@ -0,0 +1 @@ +x |> (^^ |> f()) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/output.json new file mode 100644 index 000000000000..8390963fe8c2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-inner-topic/output.json @@ -0,0 +1,53 @@ +{ + "type": "File", + "start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}}, + "errors": [ + "SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:12)" + ], + "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":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":6,"end":15,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":6,"end":8,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":8}} + }, + "operator": "|>", + "right": { + "type": "CallExpression", + "start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}}, + "callee": { + "type": "Identifier", + "start":12,"end":13,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":13},"identifierName":"f"}, + "name": "f" + }, + "arguments": [] + }, + "extra": { + "parenthesized": true, + "parenStart": 5 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/input.js new file mode 100644 index 000000000000..9d00837048ed --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/input.js @@ -0,0 +1 @@ +x |> ($ |> f) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/output.json new file mode 100644 index 000000000000..cfab816d1276 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-nested-pipelines-without-outer-topic/output.json @@ -0,0 +1,50 @@ +{ + "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:11)", + "SyntaxError: Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once. (1:5)" + ], + "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": "BinaryExpression", + "start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}}, + "left": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"$"}, + "name": "$" + }, + "operator": "|>", + "right": { + "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": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/input.js new file mode 100644 index 000000000000..6ccb6ca13351 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/input.js @@ -0,0 +1 @@ +value |> class { } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/output.json new file mode 100644 index 000000000000..1e904fe3ddea --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-class-expression/output.json @@ -0,0 +1,41 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "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":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "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": "ClassExpression", + "start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}}, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start":15,"end":18,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":18}}, + "body": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/input.js new file mode 100644 index 000000000000..faf09879d637 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/input.js @@ -0,0 +1 @@ +value |> function (x) { return; } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/output.json new file mode 100644 index 000000000000..4a5325355978 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-no-topic-function-expression/output.json @@ -0,0 +1,56 @@ +{ + "type": "File", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "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":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":33,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":33}}, + "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": "FunctionExpression", + "start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}}, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start":19,"end":20,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":20},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":22,"end":33,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":33}}, + "body": [ + { + "type": "ReturnStatement", + "start":24,"end":31,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":31}}, + "argument": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/input.js new file mode 100644 index 000000000000..1a174774e84c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/input.js @@ -0,0 +1 @@ +x |> yield + ^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/output.json new file mode 100644 index 000000000000..fd8b41311ceb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-non-generator-yield-identifier/output.json @@ -0,0 +1,41 @@ +{ + "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":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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": "BinaryExpression", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "left": { + "type": "Identifier", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"yield"}, + "name": "yield" + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-placeholder-template/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-placeholder-template/input.js new file mode 100644 index 000000000000..4aa33d979b5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-placeholder-template/input.js @@ -0,0 +1 @@ +^^^^FUNCTION^^^^(0, ^^^^VALUE^^^^); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-placeholder-template/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-placeholder-template/options.json new file mode 100644 index 000000000000..c6b020e739ac --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-placeholder-template/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + "placeholders" + ], + "throws": "Cannot combine placeholders plugin and Hack-style pipes." +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/input.js new file mode 100644 index 000000000000..23ebdd2a9f7b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/input.js @@ -0,0 +1,7 @@ +class Thing { + #property; + + #method () { + value |> this.#property + ^^; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/options.json new file mode 100644 index 000000000000..77d2746d0ac0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + "classPrivateProperties", + "classPrivateMethods" + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/output.json new file mode 100644 index 000000000000..9be0015cd858 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-private-property-in-private-method/output.json @@ -0,0 +1,111 @@ +{ + "type": "File", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "program": { + "type": "Program", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start":0,"end":82,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}}, + "id": { + "type": "Identifier", + "start":6,"end":11,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":11},"identifierName":"Thing"}, + "name": "Thing" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start":12,"end":82,"loc":{"start":{"line":1,"column":12},"end":{"line":7,"column":1}}, + "body": [ + { + "type": "ClassPrivateProperty", + "start":16,"end":26,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":12}}, + "static": false, + "key": { + "type": "PrivateName", + "start":16,"end":25,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11}}, + "id": { + "type": "Identifier", + "start":17,"end":25,"loc":{"start":{"line":2,"column":3},"end":{"line":2,"column":11},"identifierName":"property"}, + "name": "property" + } + }, + "value": null + }, + { + "type": "ClassPrivateMethod", + "start":30,"end":80,"loc":{"start":{"line":4,"column":2},"end":{"line":6,"column":3}}, + "static": false, + "key": { + "type": "PrivateName", + "start":30,"end":37,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":9}}, + "id": { + "type": "Identifier", + "start":31,"end":37,"loc":{"start":{"line":4,"column":3},"end":{"line":4,"column":9},"identifierName":"method"}, + "name": "method" + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start":41,"end":80,"loc":{"start":{"line":4,"column":13},"end":{"line":6,"column":3}}, + "body": [ + { + "type": "ExpressionStatement", + "start":47,"end":76,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":33}}, + "expression": { + "type": "BinaryExpression", + "start":47,"end":75,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":32}}, + "left": { + "type": "Identifier", + "start":47,"end":52,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":9},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "BinaryExpression", + "start":56,"end":75,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":32}}, + "left": { + "type": "MemberExpression", + "start":56,"end":70,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":27}}, + "object": { + "type": "ThisExpression", + "start":56,"end":60,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":17}} + }, + "computed": false, + "property": { + "type": "PrivateName", + "start":61,"end":70,"loc":{"start":{"line":5,"column":18},"end":{"line":5,"column":27}}, + "id": { + "type": "Identifier", + "start":62,"end":70,"loc":{"start":{"line":5,"column":19},"end":{"line":5,"column":27},"identifierName":"property"}, + "name": "property" + } + } + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":73,"end":75,"loc":{"start":{"line":5,"column":30},"end":{"line":5,"column":32}} + } + } + } + } + ], + "directives": [] + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/input.js new file mode 100644 index 000000000000..7161ae9f6732 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/input.js @@ -0,0 +1 @@ +value |> (^^) diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/output.json new file mode 100644 index 000000000000..81a91c7a1330 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-parenthesized/output.json @@ -0,0 +1,35 @@ +{ + "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":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":10,"end":12,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":12}}, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/input.js new file mode 100644 index 000000000000..ebfd2971b61d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/input.js @@ -0,0 +1 @@ +value |> ^^ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/output.json new file mode 100644 index 000000000000..8b15798610ae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-identity-unparenthesized/output.json @@ -0,0 +1,31 @@ +{ + "type": "File", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "program": { + "type": "Program", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "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": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/input.js new file mode 100644 index 000000000000..ff677cd47beb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/input.js @@ -0,0 +1 @@ +x |> ^^42; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/options.json new file mode 100644 index 000000000000..298f226ff26b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "^^" + } + ] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/output.json new file mode 100644 index 000000000000..017aba97749b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-then-digit/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":10,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":10}}, + "errors": [ + "SyntaxError: Missing semicolon. (1:7)" + ], + "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":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":7,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":7}}, + "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": "TopicReference", + "start":5,"end":7,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":7}} + } + } + }, + { + "type": "ExpressionStatement", + "start":7,"end":10,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":10}}, + "expression": { + "type": "NumericLiteral", + "start":7,"end":9,"loc":{"start":{"line":1,"column":7},"end":{"line":1,"column":9}}, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/input.js new file mode 100644 index 000000000000..72d18278ec5d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/input.js @@ -0,0 +1 @@ +value |> ^^?.method() diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/output.json new file mode 100644 index 000000000000..57270291759b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-topic-with-optional-method-call/output.json @@ -0,0 +1,48 @@ +{ + "type": "File", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "program": { + "type": "Program", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "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": "OptionalCallExpression", + "start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}}, + "callee": { + "type": "OptionalMemberExpression", + "start":9,"end":19,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":19}}, + "object": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "computed": false, + "property": { + "type": "Identifier", + "start":13,"end":19,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":19},"identifierName":"method"}, + "name": "method" + }, + "optional": true + }, + "optional": false, + "arguments": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/input.js new file mode 100644 index 000000000000..edf4e3bfb345 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/input.js @@ -0,0 +1 @@ +1 + ^^ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/output.json new file mode 100644 index 000000000000..3c7833aaa15c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-unbound-topic/output.json @@ -0,0 +1,38 @@ +{ + "type": "File", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "errors": [ + "SyntaxError: Topic reference is unbound; it must be inside a pipe body. (1:4)" + ], + "program": { + "type": "Program", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":6,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}, + "left": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":4,"end":6,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":6}} + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-v8intrinsic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-v8intrinsic/input.js new file mode 100644 index 000000000000..4c6a361dae02 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-v8intrinsic/input.js @@ -0,0 +1 @@ +%GetOptimizationStatus(f); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-v8intrinsic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-v8intrinsic/options.json new file mode 100644 index 000000000000..c0c09a4f7f5b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-v8intrinsic/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + ["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }], + "v8intrinsic" + ], + "throws": "Cannot combine v8intrinsic plugin and Hack-style pipes." +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/input.js new file mode 100644 index 000000000000..8771f297f7fd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/input.js @@ -0,0 +1 @@ +x = 0 |> ^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/output.json new file mode 100644 index 000000000000..2c30399f40cc --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-assignment/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "program": { + "type": "Program", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}}, + "expression": { + "type": "AssignmentExpression", + "start":0,"end":11,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":11}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1},"identifierName":"x"}, + "name": "x" + }, + "right": { + "type": "BinaryExpression", + "start":4,"end":11,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":11}}, + "left": { + "type": "NumericLiteral", + "start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/input.js new file mode 100644 index 000000000000..88bb77106a1b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/input.js @@ -0,0 +1,2 @@ +for (var i = 0 |> ^^; i <= 10; i++) + sum = sum + i; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/output.json new file mode 100644 index 000000000000..060f5e076bcd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-classic-for-statement-init/output.json @@ -0,0 +1,110 @@ +{ + "type": "File", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "program": { + "type": "Program", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ForStatement", + "start":0,"end":52,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":16}}, + "init": { + "type": "VariableDeclaration", + "start":5,"end":20,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":20}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":9,"end":20,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}}, + "id": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"i"}, + "name": "i" + }, + "init": { + "type": "BinaryExpression", + "start":13,"end":20,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":20}}, + "left": { + "type": "NumericLiteral", + "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}} + } + } + } + ], + "kind": "var" + }, + "test": { + "type": "BinaryExpression", + "start":22,"end":29,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":29}}, + "left": { + "type": "Identifier", + "start":22,"end":23,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":23},"identifierName":"i"}, + "name": "i" + }, + "operator": "<=", + "right": { + "type": "NumericLiteral", + "start":27,"end":29,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":29}}, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + } + }, + "update": { + "type": "UpdateExpression", + "start":31,"end":34,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":34}}, + "operator": "++", + "prefix": false, + "argument": { + "type": "Identifier", + "start":31,"end":32,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":32},"identifierName":"i"}, + "name": "i" + } + }, + "body": { + "type": "ExpressionStatement", + "start":38,"end":52,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":16}}, + "expression": { + "type": "AssignmentExpression", + "start":38,"end":51,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":15}}, + "operator": "=", + "left": { + "type": "Identifier", + "start":38,"end":41,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"sum"}, + "name": "sum" + }, + "right": { + "type": "BinaryExpression", + "start":44,"end":51,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":15}}, + "left": { + "type": "Identifier", + "start":44,"end":47,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":11},"identifierName":"sum"}, + "name": "sum" + }, + "operator": "+", + "right": { + "type": "Identifier", + "start":50,"end":51,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":15},"identifierName":"i"}, + "name": "i" + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/input.js new file mode 100644 index 000000000000..019c6be5d0a5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/input.js @@ -0,0 +1 @@ +const x = 0 |> ^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/output.json new file mode 100644 index 000000000000..2142f35fc204 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-variable-declaration/output.json @@ -0,0 +1,47 @@ +{ + "type": "File", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "program": { + "type": "Program", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "VariableDeclaration", + "start":0,"end":18,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":18}}, + "declarations": [ + { + "type": "VariableDeclarator", + "start":6,"end":17,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":17}}, + "id": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"x"}, + "name": "x" + }, + "init": { + "type": "BinaryExpression", + "start":10,"end":17,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":17}}, + "left": { + "type": "NumericLiteral", + "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":15,"end":17,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":17}} + } + } + } + ], + "kind": "const" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/input.js new file mode 100644 index 000000000000..112609549d43 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/input.js @@ -0,0 +1 @@ +variable ^= value |> ^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/output.json new file mode 100644 index 000000000000..e11c36890aab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-with-spaces/output.json @@ -0,0 +1,41 @@ +{ + "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": "AssignmentExpression", + "start":0,"end":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "operator": "^=", + "left": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"variable"}, + "name": "variable" + }, + "right": { + "type": "BinaryExpression", + "start":12,"end":23,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":23}}, + "left": { + "type": "Identifier", + "start":12,"end":17,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":17},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":21,"end":23,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":23}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/input.js new file mode 100644 index 000000000000..85afbba55aec --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/input.js @@ -0,0 +1 @@ +variable^=value |> ^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/output.json new file mode 100644 index 000000000000..42206068becd --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-within-xor-assignment-without-spaces/output.json @@ -0,0 +1,41 @@ +{ + "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": "AssignmentExpression", + "start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, + "operator": "^=", + "left": { + "type": "Identifier", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8},"identifierName":"variable"}, + "name": "variable" + }, + "right": { + "type": "BinaryExpression", + "start":10,"end":21,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":21}}, + "left": { + "type": "Identifier", + "start":10,"end":15,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":15},"identifierName":"value"}, + "name": "value" + }, + "operator": "|>", + "right": { + "type": "TopicReference", + "start":19,"end":21,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":21}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/input.js new file mode 100644 index 000000000000..3604cfbf29d2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/input.js @@ -0,0 +1 @@ +value |> (variable ^= ^^); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/output.json new file mode 100644 index 000000000000..a0e7f446a38f --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-with-spaces/output.json @@ -0,0 +1,45 @@ +{ + "type": "File", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "program": { + "type": "Program", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":26,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":26}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}}, + "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":24,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":24}}, + "operator": "^=", + "left": { + "type": "Identifier", + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18},"identifierName":"variable"}, + "name": "variable" + }, + "right": { + "type": "TopicReference", + "start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}} + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/input.js new file mode 100644 index 000000000000..c20c2ab38deb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/input.js @@ -0,0 +1 @@ +value |> (variable^=^^); diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/output.json new file mode 100644 index 000000000000..b33ab2477fab --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-assignment-without-spaces/output.json @@ -0,0 +1,45 @@ +{ + "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":23,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}}, + "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":22,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":22}}, + "operator": "^=", + "left": { + "type": "Identifier", + "start":10,"end":18,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":18},"identifierName":"variable"}, + "name": "variable" + }, + "right": { + "type": "TopicReference", + "start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}} + }, + "extra": { + "parenthesized": true, + "parenStart": 9 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/input.js new file mode 100644 index 000000000000..036d7337789d --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/input.js @@ -0,0 +1 @@ +5 ^ /3/g; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/output.json new file mode 100644 index 000000000000..43c11bd73817 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-regex-outside-pipe/output.json @@ -0,0 +1,40 @@ +{ + "type": "File", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "program": { + "type": "Program", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":9,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":9}}, + "expression": { + "type": "BinaryExpression", + "start":0,"end":8,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":8}}, + "left": { + "type": "NumericLiteral", + "start":0,"end":1,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":1}}, + "extra": { + "rawValue": 5, + "raw": "5" + }, + "value": 5 + }, + "operator": "^", + "right": { + "type": "RegExpLiteral", + "start":4,"end":8,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":8}}, + "extra": { + "raw": "/3/g" + }, + "pattern": "3", + "flags": "g" + } + } + } + ], + "directives": [] + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/input.js new file mode 100644 index 000000000000..186e7141188a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/input.js @@ -0,0 +1 @@ +value |> ^^ ^ 2; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/output.json new file mode 100644 index 000000000000..c870aadc6ed1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-with-spaces/output.json @@ -0,0 +1,45 @@ +{ + "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":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "TopicReference", + "start":9,"end":11,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":11}} + }, + "operator": "^", + "right": { + "type": "NumericLiteral", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-without-spaces/input.js new file mode 100644 index 000000000000..6ba5ff57966c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-without-spaces/input.js @@ -0,0 +1 @@ +value |> ^^^2; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-without-spaces/options.json new file mode 100644 index 000000000000..c66383ce8ae2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-first-without-spaces/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]], + "throws": "Unexpected token (1:9)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/input.js new file mode 100644 index 000000000000..d8b84b6a31ee --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/input.js @@ -0,0 +1 @@ +value |> 2 ^ ^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/output.json new file mode 100644 index 000000000000..4b1d7c6ef12b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-with-spaces/output.json @@ -0,0 +1,45 @@ +{ + "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":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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":15,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":15}}, + "left": { + "type": "NumericLiteral", + "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, + "extra": { + "rawValue": 2, + "raw": "2" + }, + "value": 2 + }, + "operator": "^", + "right": { + "type": "TopicReference", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-without-spaces/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-without-spaces/input.js new file mode 100644 index 000000000000..97b4f3167341 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-without-spaces/input.js @@ -0,0 +1 @@ +value |> 2^^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-without-spaces/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-without-spaces/options.json new file mode 100644 index 000000000000..9f56158147e2 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-xor-topic-last-without-spaces/options.json @@ -0,0 +1,4 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]], + "throws": "Unexpected token (1:10)" +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/input.js new file mode 100644 index 000000000000..ebb609847dae --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/input.js @@ -0,0 +1,3 @@ +function * f (x) { + return x |> (yield ^^); +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/options.json new file mode 100644 index 000000000000..d58c37da1b57 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/output.json new file mode 100644 index 000000000000..ce25fc689b94 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-parenthesized/output.json @@ -0,0 +1,65 @@ +{ + "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":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, + "name": "f" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":46,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":21,"end":44,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":25}}, + "argument": { + "type": "BinaryExpression", + "start":28,"end":43,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":24}}, + "left": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "YieldExpression", + "start":34,"end":42,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":23}}, + "delegate": false, + "argument": { + "type": "TopicReference", + "start":40,"end":42,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":23}} + }, + "extra": { + "parenthesized": true, + "parenStart": 33 + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/input.js new file mode 100644 index 000000000000..499a51df8e11 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/input.js @@ -0,0 +1,3 @@ +function * f (x) { + return x |> yield ^^; +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/options.json new file mode 100644 index 000000000000..ae184a44d3d5 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "^^" + } + ] + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/output.json new file mode 100644 index 000000000000..09bad13154b3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-generator-unparenthesized/output.json @@ -0,0 +1,64 @@ +{ + "type": "File", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "errors": [ + "SyntaxError: Hack-style pipe body cannot be an unparenthesized yield expression; please wrap it in parentheses. (2:14)" + ], + "program": { + "type": "Program", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "FunctionDeclaration", + "start":0,"end":44,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, + "id": { + "type": "Identifier", + "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12},"identifierName":"f"}, + "name": "f" + }, + "generator": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15},"identifierName":"x"}, + "name": "x" + } + ], + "body": { + "type": "BlockStatement", + "start":17,"end":44,"loc":{"start":{"line":1,"column":17},"end":{"line":3,"column":1}}, + "body": [ + { + "type": "ReturnStatement", + "start":21,"end":42,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":23}}, + "argument": { + "type": "BinaryExpression", + "start":28,"end":41,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":22}}, + "left": { + "type": "Identifier", + "start":28,"end":29,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":10},"identifierName":"x"}, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "YieldExpression", + "start":33,"end":41,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":22}}, + "delegate": false, + "argument": { + "type": "TopicReference", + "start":39,"end":41,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":22}} + } + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/input.js new file mode 100644 index 000000000000..1a174774e84c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/input.js @@ -0,0 +1 @@ +x |> yield + ^^; diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/options.json new file mode 100644 index 000000000000..298f226ff26b --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/options.json @@ -0,0 +1,11 @@ +{ + "plugins": [ + [ + "pipelineOperator", + { + "proposal": "hack", + "topicToken": "^^" + } + ] + ] +} diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/output.json new file mode 100644 index 000000000000..fd8b41311ceb --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-double-caret-proposal-yield-identifier-unparenthesized/output.json @@ -0,0 +1,41 @@ +{ + "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":15,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":15}}, + "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": "BinaryExpression", + "start":5,"end":15,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":15}}, + "left": { + "type": "Identifier", + "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10},"identifierName":"yield"}, + "name": "yield" + }, + "operator": "+", + "right": { + "type": "TopicReference", + "start":13,"end":15,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":15}} + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/exec.js new file mode 100644 index 000000000000..a3857da1d980 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/exec.js @@ -0,0 +1,8 @@ +const expectedValue = 42; + +function decorator () {} + +const result = expectedValue + |> @decorator class { constructor () { this.value = @@; } }; + +expect((new result).value).toBe(expectedValue); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/input.js new file mode 100644 index 000000000000..2ac9913e95d2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/input.js @@ -0,0 +1,11 @@ +const expectedValue = 42; + +function decorator (target) { + target.decoratorValue = expectedValue; +} + +const result = expectedValue + |> @decorator class { constructor () { this.value = @@; } }; + +expect(result.decoratorValue).toBe(expectedValue); +expect((new result).value).toBe(expectedValue); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/options.json new file mode 100644 index 000000000000..d9bc8f93e7d4 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "@@" }], + ["proposal-decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js new file mode 100644 index 000000000000..743b6624c395 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/class-decorator/output.js @@ -0,0 +1,27 @@ +var _ref; + +const expectedValue = 42; + +function decorator(target) { + target.decoratorValue = expectedValue; +} + +const result = (_ref = expectedValue, babelHelpers.decorate([decorator], function (_initialize) { + "use strict"; + + class _class { + constructor() { + _initialize(this); + + this.value = _ref; + } + + } + + return { + F: _class, + d: [] + }; +})); +expect(result.decoratorValue).toBe(expectedValue); +expect(new result().value).toBe(expectedValue); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/input.js new file mode 100644 index 000000000000..81a3b28d74df --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/input.js @@ -0,0 +1,2 @@ +#[0]; +1 |> #[0, @@]; diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/options.json new file mode 100644 index 000000000000..0e8928650c99 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "@@" }], + ["proposal-record-and-tuple", { "syntaxType": "hash" }] + ] +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/output.js new file mode 100644 index 000000000000..877d41141fbe --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/hash-tuple/output.js @@ -0,0 +1,4 @@ +var _ref; + +Tuple(0); +_ref = 1, Tuple(0, _ref); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/options.json new file mode 100644 index 000000000000..f67a1804515d --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "@@" }]] +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/exec.js new file mode 100644 index 000000000000..3fe1f21a8ca5 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/exec.js @@ -0,0 +1,3 @@ +const result = 5 |> @@; + +expect(result).toBe(5); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/input.js new file mode 100644 index 000000000000..3fe1f21a8ca5 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/input.js @@ -0,0 +1,3 @@ +const result = 5 |> @@; + +expect(result).toBe(5); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/output.js new file mode 100644 index 000000000000..ab1b47369050 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-identity/output.js @@ -0,0 +1,4 @@ +var _ref; + +const result = (_ref = 5, _ref); +expect(result).toBe(5); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/exec.js new file mode 100644 index 000000000000..787c506985e2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/exec.js @@ -0,0 +1,3 @@ +const result = 5 |> @@ + 1 |> @@ + @@; + +expect(result).toBe(12); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/input.js new file mode 100644 index 000000000000..787c506985e2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/input.js @@ -0,0 +1,3 @@ +const result = 5 |> @@ + 1 |> @@ + @@; + +expect(result).toBe(12); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/output.js new file mode 100644 index 000000000000..62a22e6b7067 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-addition/output.js @@ -0,0 +1,4 @@ +var _ref, _ref2; + +const result = (_ref2 = 5, (_ref = _ref2 + 1, _ref + _ref)); +expect(result).toBe(12); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/exec.js new file mode 100644 index 000000000000..b9285c2183c9 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/exec.js @@ -0,0 +1,9 @@ +const result = 5 + |> Math.pow(@@, 2) + |> [1, 2, 3].map(n => n + @@ + |> @@ * 2 + |> `${@@} apples` + |> @@.toUpperCase()) + |> @@.join(); + +expect(result).toEqual('52 APPLES,54 APPLES,56 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/input.js new file mode 100644 index 000000000000..b9285c2183c9 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/input.js @@ -0,0 +1,9 @@ +const result = 5 + |> Math.pow(@@, 2) + |> [1, 2, 3].map(n => n + @@ + |> @@ * 2 + |> `${@@} apples` + |> @@.toUpperCase()) + |> @@.join(); + +expect(result).toEqual('52 APPLES,54 APPLES,56 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/output.js new file mode 100644 index 000000000000..bf1fcd321aef --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function-and-nested-pipe/output.js @@ -0,0 +1,8 @@ +var _ref4, _ref5, _ref6; + +const result = (_ref6 = 5, (_ref5 = Math.pow(_ref6, 2), (_ref4 = [1, 2, 3].map(n => { + var _ref, _ref2, _ref3; + + return _ref3 = n + _ref5, (_ref2 = _ref3 * 2, (_ref = `${_ref2} apples`, _ref.toUpperCase())); +}), _ref4.join()))); +expect(result).toEqual('52 APPLES,54 APPLES,56 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/exec.js new file mode 100644 index 000000000000..977bad252552 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/exec.js @@ -0,0 +1,6 @@ +const result = -2.2 // -2.2 + |> Math.floor(@@) // -3 + |> (() => Math.pow(@@, 5)) // () => -243 + |> @@(); // -243 + +expect(result).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/input.js new file mode 100644 index 000000000000..977bad252552 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/input.js @@ -0,0 +1,6 @@ +const result = -2.2 // -2.2 + |> Math.floor(@@) // -3 + |> (() => Math.pow(@@, 5)) // () => -243 + |> @@(); // -243 + +expect(result).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/output.js new file mode 100644 index 000000000000..5def3730d465 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-arrow-function/output.js @@ -0,0 +1,8 @@ +var _ref, _ref2, _ref3; + +const result = (_ref3 = -2.2 // -2.2 +, (_ref2 = Math.floor(_ref3) // -3 +, (_ref = () => Math.pow(_ref2, 5) // () => -243 +, _ref()))); // -243 + +expect(result).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/exec.js new file mode 100644 index 000000000000..41eba6c4b2f8 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/exec.js @@ -0,0 +1,14 @@ +function triple (x) { + return x * 3 +} + +async function asyncFunction(n) { + return n + |> Math.abs(@@) + |> await Promise.resolve(@@) + |> triple(@@); +} + +asyncFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/input.js new file mode 100644 index 000000000000..41eba6c4b2f8 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/input.js @@ -0,0 +1,14 @@ +function triple (x) { + return x * 3 +} + +async function asyncFunction(n) { + return n + |> Math.abs(@@) + |> await Promise.resolve(@@) + |> triple(@@); +} + +asyncFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/options.json new file mode 100644 index 000000000000..f19c36b8eef1 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/options.json @@ -0,0 +1,6 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + }, + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/output.js new file mode 100644 index 000000000000..aa3d4e62d419 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-await/output.js @@ -0,0 +1,13 @@ +function triple(x) { + return x * 3; +} + +async function asyncFunction(n) { + var _ref, _ref2, _ref3; + + return _ref3 = n, (_ref2 = Math.abs(_ref3), (_ref = await Promise.resolve(_ref2), triple(_ref))); +} + +asyncFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/exec.js new file mode 100644 index 000000000000..f156fd4aff7b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/exec.js @@ -0,0 +1,20 @@ +const result = 1 + |> class { + #baz; + + constructor () { + this.#baz = @@; + } + + #bar () { + return this.#baz + 2; + } + + foo () { + return this.#bar() + 3; + } + } + |> new @@ + |> @@.foo(); + +expect(result).toBe(1 + 2 + 3); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/input.js new file mode 100644 index 000000000000..f156fd4aff7b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/input.js @@ -0,0 +1,20 @@ +const result = 1 + |> class { + #baz; + + constructor () { + this.#baz = @@; + } + + #bar () { + return this.#baz + 2; + } + + foo () { + return this.#bar() + 3; + } + } + |> new @@ + |> @@.foo(); + +expect(result).toBe(1 + 2 + 3); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/options.json new file mode 100644 index 000000000000..90347a43739e --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "@@" }] + ], + "minNodeVersion": "14.0.0" +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/output.js new file mode 100644 index 000000000000..638f9cda750f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-class-expression-and-private-properties/output.js @@ -0,0 +1,19 @@ +var _ref, _ref2, _ref3; + +const result = (_ref3 = 1, (_ref2 = class { + #baz; + + constructor() { + this.#baz = _ref3; + } + + #bar() { + return this.#baz + 2; + } + + foo() { + return this.#bar() + 3; + } + +}, (_ref = new _ref2(), _ref.foo()))); +expect(result).toBe(1 + 2 + 3); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/exec.js new file mode 100644 index 000000000000..60e9821df70e --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/exec.js @@ -0,0 +1,4 @@ +const program = '(function() { return this; })()'; +const result = program |> eval(@@); + +expect(result).not.toBeUndefined(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/input.js new file mode 100644 index 000000000000..60e9821df70e --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/input.js @@ -0,0 +1,4 @@ +const program = '(function() { return this; })()'; +const result = program |> eval(@@); + +expect(result).not.toBeUndefined(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/output.js new file mode 100644 index 000000000000..c5dbd6107a44 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-eval/output.js @@ -0,0 +1,5 @@ +var _ref; + +const program = '(function() { return this; })()'; +const result = (_ref = program, eval(_ref)); +expect(result).not.toBeUndefined(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/exec.js new file mode 100644 index 000000000000..203f3a0728c1 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/exec.js @@ -0,0 +1,7 @@ +const result = 5 + |> Math.pow(@@, 2) + |> (@@ + 1 + |> `${@@} apples` + |> @@.toUpperCase()); + +expect(result).toEqual('26 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/input.js new file mode 100644 index 000000000000..203f3a0728c1 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/input.js @@ -0,0 +1,7 @@ +const result = 5 + |> Math.pow(@@, 2) + |> (@@ + 1 + |> `${@@} apples` + |> @@.toUpperCase()); + +expect(result).toEqual('26 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/output.js new file mode 100644 index 000000000000..8ee6b4bbf42f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-nested-pipe/output.js @@ -0,0 +1,4 @@ +var _ref, _ref2, _ref3, _ref4; + +const result = (_ref4 = 5, (_ref3 = Math.pow(_ref4, 2), (_ref2 = _ref3 + 1, (_ref = `${_ref2} apples`, _ref.toUpperCase())))); +expect(result).toEqual('26 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/exec.js new file mode 100644 index 000000000000..c646257782ef --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/exec.js @@ -0,0 +1,10 @@ +function area(rect) { + return rect.width * rect.height; +} + +const result = -5 + |> Math.abs(@@) + |> { width: @@, height: @@ + 3 } + |> area(@@); + +expect(result).toBe(40); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/input.js new file mode 100644 index 000000000000..c646257782ef --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/input.js @@ -0,0 +1,10 @@ +function area(rect) { + return rect.width * rect.height; +} + +const result = -5 + |> Math.abs(@@) + |> { width: @@, height: @@ + 3 } + |> area(@@); + +expect(result).toBe(40); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/output.js new file mode 100644 index 000000000000..cd74f2422e0a --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-object-literal/output.js @@ -0,0 +1,11 @@ +var _ref, _ref2, _ref3; + +function area(rect) { + return rect.width * rect.height; +} + +const result = (_ref3 = -5, (_ref2 = Math.abs(_ref3), (_ref = { + width: _ref2, + height: _ref2 + 3 +}, area(_ref)))); +expect(result).toBe(40); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/exec.js new file mode 100644 index 000000000000..9b7123ad6c7c --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/exec.js @@ -0,0 +1,3 @@ +const result = 'Hello' |> @@.toUpperCase(); + +expect(result).toBe('HELLO'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/input.js new file mode 100644 index 000000000000..9b7123ad6c7c --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/input.js @@ -0,0 +1,3 @@ +const result = 'Hello' |> @@.toUpperCase(); + +expect(result).toBe('HELLO'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/output.js new file mode 100644 index 000000000000..029efa564267 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-topic-method-call/output.js @@ -0,0 +1,4 @@ +var _ref; + +const result = (_ref = 'Hello', _ref.toUpperCase()); +expect(result).toBe('HELLO'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/exec.js new file mode 100644 index 000000000000..4d5b6e452e33 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/exec.js @@ -0,0 +1,13 @@ +function *myGenerator(n) { + return n + |> (yield @@) + |> Math.abs(@@); +} + +const myIterator = myGenerator(15); + +const yieldedValue = myIterator.next().value; +const returnedValue = myIterator.next(-30).value; + +expect(yieldedValue).toBe(15); +expect(returnedValue).toBe(30); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/input.js new file mode 100644 index 000000000000..4d5b6e452e33 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/input.js @@ -0,0 +1,13 @@ +function *myGenerator(n) { + return n + |> (yield @@) + |> Math.abs(@@); +} + +const myIterator = myGenerator(15); + +const yieldedValue = myIterator.next().value; +const returnedValue = myIterator.next(-30).value; + +expect(yieldedValue).toBe(15); +expect(returnedValue).toBe(30); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/output.js new file mode 100644 index 000000000000..40f127c27ae2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-body-with-yield/output.js @@ -0,0 +1,11 @@ +function* myGenerator(n) { + var _ref, _ref2; + + return _ref2 = n, (_ref = yield _ref2, Math.abs(_ref)); +} + +const myIterator = myGenerator(15); +const yieldedValue = myIterator.next().value; +const returnedValue = myIterator.next(-30).value; +expect(yieldedValue).toBe(15); +expect(returnedValue).toBe(30); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/exec.js new file mode 100644 index 000000000000..5513250d4d6c --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/exec.js @@ -0,0 +1,3 @@ +const result = (5 |> Math.pow(@@, 2)) |> @@ + 1; + +expect(result).toEqual(26); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/input.js new file mode 100644 index 000000000000..5513250d4d6c --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/input.js @@ -0,0 +1,3 @@ +const result = (5 |> Math.pow(@@, 2)) |> @@ + 1; + +expect(result).toEqual(26); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/output.js new file mode 100644 index 000000000000..1adde6582021 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-head-with-nested-pipe/output.js @@ -0,0 +1,4 @@ +var _ref, _ref2; + +const result = (_ref2 = (_ref = 5, Math.pow(_ref, 2)), _ref2 + 1); +expect(result).toEqual(26); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/exec.js new file mode 100644 index 000000000000..145a9ca45f61 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/exec.js @@ -0,0 +1,6 @@ +const result = () => -2.2 // -2.2 + |> Math.floor(@@) // -3 + |> (() => Math.pow(@@, 5)) // () => -243 + |> @@(); // -243 + +expect(result()).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/input.js new file mode 100644 index 000000000000..145a9ca45f61 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/input.js @@ -0,0 +1,6 @@ +const result = () => -2.2 // -2.2 + |> Math.floor(@@) // -3 + |> (() => Math.pow(@@, 5)) // () => -243 + |> @@(); // -243 + +expect(result()).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/output.js new file mode 100644 index 000000000000..66106a985d16 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/pipe-in-arrow-function/output.js @@ -0,0 +1,11 @@ +const result = () => { + var _ref, _ref2, _ref3; + + return _ref3 = -2.2 // -2.2 + , (_ref2 = Math.floor(_ref3) // -3 + , (_ref = () => Math.pow(_ref2, 5) // () => -243 + , _ref())); +}; // -243 + + +expect(result()).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/exec.js new file mode 100644 index 000000000000..ede4f00aa651 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/exec.js @@ -0,0 +1,5 @@ +const triple = x => x * 3; + +const result = -7 |> Math.abs(@@) |> triple(@@); + +return expect(result).toBe(21); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/input.js new file mode 100644 index 000000000000..ede4f00aa651 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/input.js @@ -0,0 +1,5 @@ +const triple = x => x * 3; + +const result = -7 |> Math.abs(@@) |> triple(@@); + +return expect(result).toBe(21); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/options.json new file mode 100644 index 000000000000..fdea82c9bef5 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "@@" }], + "transform-arrow-functions" + ], + "parserOpts": { + "allowReturnOutsideFunction": true + } +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/output.js new file mode 100644 index 000000000000..23cdd3fe2a2b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-arrow-functions/output.js @@ -0,0 +1,8 @@ +var _ref, _ref2; + +const triple = function (x) { + return x * 3; +}; + +const result = (_ref2 = -7, (_ref = Math.abs(_ref2), triple(_ref))); +return expect(result).toBe(21); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/exec.js new file mode 100644 index 000000000000..11bcbe57a5c2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/exec.js @@ -0,0 +1,13 @@ +const triple = (x) => x * 3; + +async function myFunction(n) { + return n + |> Math.abs(@@) + |> Promise.resolve(@@) + |> await @@ + |> triple(@@); +} + +return myFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/input.js new file mode 100644 index 000000000000..11bcbe57a5c2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/input.js @@ -0,0 +1,13 @@ +const triple = (x) => x * 3; + +async function myFunction(n) { + return n + |> Math.abs(@@) + |> Promise.resolve(@@) + |> await @@ + |> triple(@@); +} + +return myFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/options.json new file mode 100644 index 000000000000..3236584245d3 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/options.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "@@" }], + "transform-arrow-functions" + ], + "parserOpts": { + "allowReturnOutsideFunction": true + }, + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/output.js new file mode 100644 index 000000000000..3a32f6e23831 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/transform-await-and-arrow-functions/output.js @@ -0,0 +1,13 @@ +const triple = function (x) { + return x * 3; +}; + +async function myFunction(n) { + var _ref, _ref2, _ref3, _ref4; + + return _ref4 = n, (_ref3 = Math.abs(_ref4), (_ref2 = Promise.resolve(_ref3), (_ref = await _ref2, triple(_ref)))); +} + +return myFunction(-7).then(function (result) { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/exec.js new file mode 100644 index 000000000000..4e676936116b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/exec.js @@ -0,0 +1,7 @@ +let i = 0; +let sum = 0; + +while (i |> (i = @@ + 1) |> @@ <= 10) + sum += i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/input.js new file mode 100644 index 000000000000..4e676936116b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/input.js @@ -0,0 +1,7 @@ +let i = 0; +let sum = 0; + +while (i |> (i = @@ + 1) |> @@ <= 10) + sum += i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/output.js new file mode 100644 index 000000000000..0622dfee4902 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/while-statement-with-pipe-in-condition/output.js @@ -0,0 +1,10 @@ +let i = 0; +let sum = 0; + +while (_ref2 = i, (_ref = i = _ref2 + 1, _ref <= 10)) { + var _ref, _ref2; + + sum += i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/exec.js new file mode 100644 index 000000000000..dedb84b3374a --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/exec.js @@ -0,0 +1,3 @@ +const x = 0 |> @@ + 1; + +expect(x).toBe(1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/input.js new file mode 100644 index 000000000000..dedb84b3374a --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/input.js @@ -0,0 +1,3 @@ +const x = 0 |> @@ + 1; + +expect(x).toBe(1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/output.js new file mode 100644 index 000000000000..5ca2ce9e5390 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-assignment/output.js @@ -0,0 +1,4 @@ +var _ref; + +const x = (_ref = 0, _ref + 1); +expect(x).toBe(1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/exec.js new file mode 100644 index 000000000000..10982a809f34 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/exec.js @@ -0,0 +1,5 @@ +let sum = 0; +for (var i = 0 |> @@; i <= 10; i++) + sum += i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/input.js new file mode 100644 index 000000000000..10982a809f34 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/input.js @@ -0,0 +1,5 @@ +let sum = 0; +for (var i = 0 |> @@; i <= 10; i++) + sum += i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/output.js new file mode 100644 index 000000000000..dd399138c6fb --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-init/output.js @@ -0,0 +1,9 @@ +let sum = 0; + +for (var i = (_ref = 0, _ref); i <= 10; i++) { + var _ref; + + sum += i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/exec.js new file mode 100644 index 000000000000..97f7d9b45e87 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/exec.js @@ -0,0 +1,5 @@ +let sum = 0; +for (var i = 0; i |> @@ <= 10; i++) + sum = sum + i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/input.js new file mode 100644 index 000000000000..97f7d9b45e87 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/input.js @@ -0,0 +1,5 @@ +let sum = 0; +for (var i = 0; i |> @@ <= 10; i++) + sum = sum + i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/output.js new file mode 100644 index 000000000000..14ae06d74abf --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-test/output.js @@ -0,0 +1,9 @@ +let sum = 0; + +for (var i = 0; _ref = i, _ref <= 10; i++) { + var _ref; + + sum = sum + i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/exec.js new file mode 100644 index 000000000000..b174fbec0f29 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/exec.js @@ -0,0 +1,6 @@ +let sum = 0; +for (var i = 0; i <= 10; i = i |> @@ + 1) { + sum = sum + i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/input.js new file mode 100644 index 000000000000..b174fbec0f29 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/input.js @@ -0,0 +1,6 @@ +let sum = 0; +for (var i = 0; i <= 10; i = i |> @@ + 1) { + sum = sum + i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/output.js new file mode 100644 index 000000000000..a741096b130d --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-for-classic-statement-update/output.js @@ -0,0 +1,9 @@ +let sum = 0; + +for (var i = 0; i <= 10; i = (_ref = i, _ref + 1)) { + var _ref; + + sum = sum + i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-generator-with-yield/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-generator-with-yield/input.js new file mode 100644 index 000000000000..6d4009378926 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-generator-with-yield/input.js @@ -0,0 +1,5 @@ +function * myGenerator(n) { + return n + |> (yield @@) + |> Math.abs(@@); +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-generator-with-yield/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-generator-with-yield/output.js new file mode 100644 index 000000000000..4e9cfe3a1240 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-generator-with-yield/output.js @@ -0,0 +1,5 @@ +function* myGenerator(n) { + var _ref, _ref2; + + return _ref2 = n, (_ref = yield _ref2, Math.abs(_ref)); +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-if-else-block/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-if-else-block/input.js new file mode 100644 index 000000000000..107b765823de --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-if-else-block/input.js @@ -0,0 +1,4 @@ +if (v |> e(@@) |> f(@@)) + g() |> h(@@, @@ + 1) |> i(@@); +else + j(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-if-else-block/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-if-else-block/output.js new file mode 100644 index 000000000000..5d542dc97ffc --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-if-else-block/output.js @@ -0,0 +1,3 @@ +var _ref, _ref2, _ref3, _ref4; + +if (_ref2 = v, (_ref = e(_ref2), f(_ref))) _ref4 = g(), (_ref3 = h(_ref4, _ref4 + 1), i(_ref3));else j(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/exec.js new file mode 100644 index 000000000000..26837dd5150f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/exec.js @@ -0,0 +1,3 @@ +var i = 0; + +expect(i).toBe(0); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/input.js new file mode 100644 index 000000000000..26837dd5150f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/input.js @@ -0,0 +1,3 @@ +var i = 0; + +expect(i).toBe(0); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/output.js new file mode 100644 index 000000000000..126fd403042b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-at/within-var-statement/output.js @@ -0,0 +1,2 @@ +var i = 0; +expect(i).toBe(0); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/exec.js new file mode 100644 index 000000000000..c41b3898e235 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/exec.js @@ -0,0 +1,8 @@ +const expectedValue = 42; + +function decorator () {} + +const result = expectedValue + |> @decorator class { constructor () { this.value = ^^; } }; + +expect((new result).value).toBe(expectedValue); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/input.js new file mode 100644 index 000000000000..7567377fa7a7 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/input.js @@ -0,0 +1,11 @@ +const expectedValue = 42; + +function decorator (target) { + target.decoratorValue = expectedValue; +} + +const result = expectedValue + |> @decorator class { constructor () { this.value = ^^; } }; + +expect(result.decoratorValue).toBe(expectedValue); +expect((new result).value).toBe(expectedValue); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/options.json new file mode 100644 index 000000000000..15526f1d0636 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^^" }], + ["proposal-decorators", { "decoratorsBeforeExport": false }] + ] +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js new file mode 100644 index 000000000000..743b6624c395 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/class-decorator/output.js @@ -0,0 +1,27 @@ +var _ref; + +const expectedValue = 42; + +function decorator(target) { + target.decoratorValue = expectedValue; +} + +const result = (_ref = expectedValue, babelHelpers.decorate([decorator], function (_initialize) { + "use strict"; + + class _class { + constructor() { + _initialize(this); + + this.value = _ref; + } + + } + + return { + F: _class, + d: [] + }; +})); +expect(result.decoratorValue).toBe(expectedValue); +expect(new result().value).toBe(expectedValue); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/input.js new file mode 100644 index 000000000000..5a6ea279ee6f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/input.js @@ -0,0 +1,2 @@ +#[0]; +1 |> #[0, ^^]; diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/options.json new file mode 100644 index 000000000000..2c2a31351921 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^^" }], + ["proposal-record-and-tuple", { "syntaxType": "hash" }] + ] +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/output.js new file mode 100644 index 000000000000..877d41141fbe --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/hash-tuple/output.js @@ -0,0 +1,4 @@ +var _ref; + +Tuple(0); +_ref = 1, Tuple(0, _ref); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/options.json new file mode 100644 index 000000000000..5369c8cfb068 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^^" }]] +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/exec.js new file mode 100644 index 000000000000..a41e6d5c70ce --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/exec.js @@ -0,0 +1,3 @@ +const result = 5 |> ^^; + +expect(result).toBe(5); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/input.js new file mode 100644 index 000000000000..a41e6d5c70ce --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/input.js @@ -0,0 +1,3 @@ +const result = 5 |> ^^; + +expect(result).toBe(5); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/output.js new file mode 100644 index 000000000000..ab1b47369050 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-identity/output.js @@ -0,0 +1,4 @@ +var _ref; + +const result = (_ref = 5, _ref); +expect(result).toBe(5); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/exec.js new file mode 100644 index 000000000000..e8f7dd54ac2a --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/exec.js @@ -0,0 +1,3 @@ +const result = 5 |> ^^ + 1 |> ^^ + ^^; + +expect(result).toBe(12); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/input.js new file mode 100644 index 000000000000..e8f7dd54ac2a --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/input.js @@ -0,0 +1,3 @@ +const result = 5 |> ^^ + 1 |> ^^ + ^^; + +expect(result).toBe(12); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/output.js new file mode 100644 index 000000000000..62a22e6b7067 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-addition/output.js @@ -0,0 +1,4 @@ +var _ref, _ref2; + +const result = (_ref2 = 5, (_ref = _ref2 + 1, _ref + _ref)); +expect(result).toBe(12); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/exec.js new file mode 100644 index 000000000000..221d2065dfa4 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/exec.js @@ -0,0 +1,9 @@ +const result = 5 + |> Math.pow(^^, 2) + |> [1, 2, 3].map(n => n + ^^ + |> ^^ * 2 + |> `${^^} apples` + |> ^^.toUpperCase()) + |> ^^.join(); + +expect(result).toEqual('52 APPLES,54 APPLES,56 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/input.js new file mode 100644 index 000000000000..221d2065dfa4 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/input.js @@ -0,0 +1,9 @@ +const result = 5 + |> Math.pow(^^, 2) + |> [1, 2, 3].map(n => n + ^^ + |> ^^ * 2 + |> `${^^} apples` + |> ^^.toUpperCase()) + |> ^^.join(); + +expect(result).toEqual('52 APPLES,54 APPLES,56 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/output.js new file mode 100644 index 000000000000..bf1fcd321aef --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function-and-nested-pipe/output.js @@ -0,0 +1,8 @@ +var _ref4, _ref5, _ref6; + +const result = (_ref6 = 5, (_ref5 = Math.pow(_ref6, 2), (_ref4 = [1, 2, 3].map(n => { + var _ref, _ref2, _ref3; + + return _ref3 = n + _ref5, (_ref2 = _ref3 * 2, (_ref = `${_ref2} apples`, _ref.toUpperCase())); +}), _ref4.join()))); +expect(result).toEqual('52 APPLES,54 APPLES,56 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/exec.js new file mode 100644 index 000000000000..885448c3496b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/exec.js @@ -0,0 +1,6 @@ +const result = -2.2 // -2.2 + |> Math.floor(^^) // -3 + |> (() => Math.pow(^^, 5)) // () => -243 + |> ^^(); // -243 + +expect(result).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/input.js new file mode 100644 index 000000000000..885448c3496b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/input.js @@ -0,0 +1,6 @@ +const result = -2.2 // -2.2 + |> Math.floor(^^) // -3 + |> (() => Math.pow(^^, 5)) // () => -243 + |> ^^(); // -243 + +expect(result).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/output.js new file mode 100644 index 000000000000..5def3730d465 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-arrow-function/output.js @@ -0,0 +1,8 @@ +var _ref, _ref2, _ref3; + +const result = (_ref3 = -2.2 // -2.2 +, (_ref2 = Math.floor(_ref3) // -3 +, (_ref = () => Math.pow(_ref2, 5) // () => -243 +, _ref()))); // -243 + +expect(result).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/exec.js new file mode 100644 index 000000000000..9622d3c06339 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/exec.js @@ -0,0 +1,14 @@ +function triple (x) { + return x * 3 +} + +async function asyncFunction(n) { + return n + |> Math.abs(^^) + |> await Promise.resolve(^^) + |> triple(^^); +} + +asyncFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/input.js new file mode 100644 index 000000000000..9622d3c06339 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/input.js @@ -0,0 +1,14 @@ +function triple (x) { + return x * 3 +} + +async function asyncFunction(n) { + return n + |> Math.abs(^^) + |> await Promise.resolve(^^) + |> triple(^^); +} + +asyncFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/options.json new file mode 100644 index 000000000000..f19c36b8eef1 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/options.json @@ -0,0 +1,6 @@ +{ + "parserOpts": { + "allowReturnOutsideFunction": true + }, + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/output.js new file mode 100644 index 000000000000..aa3d4e62d419 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-await/output.js @@ -0,0 +1,13 @@ +function triple(x) { + return x * 3; +} + +async function asyncFunction(n) { + var _ref, _ref2, _ref3; + + return _ref3 = n, (_ref2 = Math.abs(_ref3), (_ref = await Promise.resolve(_ref2), triple(_ref))); +} + +asyncFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/exec.js new file mode 100644 index 000000000000..e2477d250ce1 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/exec.js @@ -0,0 +1,20 @@ +const result = 1 + |> class { + #baz; + + constructor () { + this.#baz = ^^; + } + + #bar () { + return this.#baz + 2; + } + + foo () { + return this.#bar() + 3; + } + } + |> new ^^ + |> ^^.foo(); + +expect(result).toBe(1 + 2 + 3); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/input.js new file mode 100644 index 000000000000..e2477d250ce1 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/input.js @@ -0,0 +1,20 @@ +const result = 1 + |> class { + #baz; + + constructor () { + this.#baz = ^^; + } + + #bar () { + return this.#baz + 2; + } + + foo () { + return this.#bar() + 3; + } + } + |> new ^^ + |> ^^.foo(); + +expect(result).toBe(1 + 2 + 3); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/options.json new file mode 100644 index 000000000000..470ca4a32b9b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^^" }] + ], + "minNodeVersion": "14.0.0" +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/output.js new file mode 100644 index 000000000000..638f9cda750f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-class-expression-and-private-properties/output.js @@ -0,0 +1,19 @@ +var _ref, _ref2, _ref3; + +const result = (_ref3 = 1, (_ref2 = class { + #baz; + + constructor() { + this.#baz = _ref3; + } + + #bar() { + return this.#baz + 2; + } + + foo() { + return this.#bar() + 3; + } + +}, (_ref = new _ref2(), _ref.foo()))); +expect(result).toBe(1 + 2 + 3); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/exec.js new file mode 100644 index 000000000000..de3a6fc8defa --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/exec.js @@ -0,0 +1,4 @@ +const program = '(function() { return this; })()'; +const result = program |> eval(^^); + +expect(result).not.toBeUndefined(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/input.js new file mode 100644 index 000000000000..de3a6fc8defa --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/input.js @@ -0,0 +1,4 @@ +const program = '(function() { return this; })()'; +const result = program |> eval(^^); + +expect(result).not.toBeUndefined(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/output.js new file mode 100644 index 000000000000..c5dbd6107a44 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-eval/output.js @@ -0,0 +1,5 @@ +var _ref; + +const program = '(function() { return this; })()'; +const result = (_ref = program, eval(_ref)); +expect(result).not.toBeUndefined(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/exec.js new file mode 100644 index 000000000000..0975847bc287 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/exec.js @@ -0,0 +1,7 @@ +const result = 5 + |> Math.pow(^^, 2) + |> (^^ + 1 + |> `${^^} apples` + |> ^^.toUpperCase()); + +expect(result).toEqual('26 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/input.js new file mode 100644 index 000000000000..0975847bc287 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/input.js @@ -0,0 +1,7 @@ +const result = 5 + |> Math.pow(^^, 2) + |> (^^ + 1 + |> `${^^} apples` + |> ^^.toUpperCase()); + +expect(result).toEqual('26 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/output.js new file mode 100644 index 000000000000..8ee6b4bbf42f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-nested-pipe/output.js @@ -0,0 +1,4 @@ +var _ref, _ref2, _ref3, _ref4; + +const result = (_ref4 = 5, (_ref3 = Math.pow(_ref4, 2), (_ref2 = _ref3 + 1, (_ref = `${_ref2} apples`, _ref.toUpperCase())))); +expect(result).toEqual('26 APPLES'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/exec.js new file mode 100644 index 000000000000..c9a4ae8080e6 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/exec.js @@ -0,0 +1,10 @@ +function area(rect) { + return rect.width * rect.height; +} + +const result = -5 + |> Math.abs(^^) + |> { width: ^^, height: ^^ + 3 } + |> area(^^); + +expect(result).toBe(40); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/input.js new file mode 100644 index 000000000000..c9a4ae8080e6 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/input.js @@ -0,0 +1,10 @@ +function area(rect) { + return rect.width * rect.height; +} + +const result = -5 + |> Math.abs(^^) + |> { width: ^^, height: ^^ + 3 } + |> area(^^); + +expect(result).toBe(40); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/output.js new file mode 100644 index 000000000000..cd74f2422e0a --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-object-literal/output.js @@ -0,0 +1,11 @@ +var _ref, _ref2, _ref3; + +function area(rect) { + return rect.width * rect.height; +} + +const result = (_ref3 = -5, (_ref2 = Math.abs(_ref3), (_ref = { + width: _ref2, + height: _ref2 + 3 +}, area(_ref)))); +expect(result).toBe(40); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/exec.js new file mode 100644 index 000000000000..7d906adffb42 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/exec.js @@ -0,0 +1,3 @@ +const result = 'Hello' |> ^^.toUpperCase(); + +expect(result).toBe('HELLO'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/input.js new file mode 100644 index 000000000000..7d906adffb42 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/input.js @@ -0,0 +1,3 @@ +const result = 'Hello' |> ^^.toUpperCase(); + +expect(result).toBe('HELLO'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/output.js new file mode 100644 index 000000000000..029efa564267 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-topic-method-call/output.js @@ -0,0 +1,4 @@ +var _ref; + +const result = (_ref = 'Hello', _ref.toUpperCase()); +expect(result).toBe('HELLO'); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/exec.js new file mode 100644 index 000000000000..0e65723ffaaf --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/exec.js @@ -0,0 +1,13 @@ +function *myGenerator(n) { + return n + |> (yield ^^) + |> Math.abs(^^); +} + +const myIterator = myGenerator(15); + +const yieldedValue = myIterator.next().value; +const returnedValue = myIterator.next(-30).value; + +expect(yieldedValue).toBe(15); +expect(returnedValue).toBe(30); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/input.js new file mode 100644 index 000000000000..0e65723ffaaf --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/input.js @@ -0,0 +1,13 @@ +function *myGenerator(n) { + return n + |> (yield ^^) + |> Math.abs(^^); +} + +const myIterator = myGenerator(15); + +const yieldedValue = myIterator.next().value; +const returnedValue = myIterator.next(-30).value; + +expect(yieldedValue).toBe(15); +expect(returnedValue).toBe(30); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/output.js new file mode 100644 index 000000000000..40f127c27ae2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-body-with-yield/output.js @@ -0,0 +1,11 @@ +function* myGenerator(n) { + var _ref, _ref2; + + return _ref2 = n, (_ref = yield _ref2, Math.abs(_ref)); +} + +const myIterator = myGenerator(15); +const yieldedValue = myIterator.next().value; +const returnedValue = myIterator.next(-30).value; +expect(yieldedValue).toBe(15); +expect(returnedValue).toBe(30); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/exec.js new file mode 100644 index 000000000000..9c09ad685c5d --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/exec.js @@ -0,0 +1,3 @@ +const result = (5 |> Math.pow(^^, 2)) |> ^^ + 1; + +expect(result).toEqual(26); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/input.js new file mode 100644 index 000000000000..9c09ad685c5d --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/input.js @@ -0,0 +1,3 @@ +const result = (5 |> Math.pow(^^, 2)) |> ^^ + 1; + +expect(result).toEqual(26); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/output.js new file mode 100644 index 000000000000..1adde6582021 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-head-with-nested-pipe/output.js @@ -0,0 +1,4 @@ +var _ref, _ref2; + +const result = (_ref2 = (_ref = 5, Math.pow(_ref, 2)), _ref2 + 1); +expect(result).toEqual(26); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/exec.js new file mode 100644 index 000000000000..a7652bd33860 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/exec.js @@ -0,0 +1,6 @@ +const result = () => -2.2 // -2.2 + |> Math.floor(^^) // -3 + |> (() => Math.pow(^^, 5)) // () => -243 + |> ^^(); // -243 + +expect(result()).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/input.js new file mode 100644 index 000000000000..a7652bd33860 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/input.js @@ -0,0 +1,6 @@ +const result = () => -2.2 // -2.2 + |> Math.floor(^^) // -3 + |> (() => Math.pow(^^, 5)) // () => -243 + |> ^^(); // -243 + +expect(result()).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/output.js new file mode 100644 index 000000000000..66106a985d16 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/pipe-in-arrow-function/output.js @@ -0,0 +1,11 @@ +const result = () => { + var _ref, _ref2, _ref3; + + return _ref3 = -2.2 // -2.2 + , (_ref2 = Math.floor(_ref3) // -3 + , (_ref = () => Math.pow(_ref2, 5) // () => -243 + , _ref())); +}; // -243 + + +expect(result()).toBe(-243); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/exec.js new file mode 100644 index 000000000000..49d1e40d10cb --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/exec.js @@ -0,0 +1,5 @@ +const triple = x => x * 3; + +const result = -7 |> Math.abs(^^) |> triple(^^); + +return expect(result).toBe(21); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/input.js new file mode 100644 index 000000000000..49d1e40d10cb --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/input.js @@ -0,0 +1,5 @@ +const triple = x => x * 3; + +const result = -7 |> Math.abs(^^) |> triple(^^); + +return expect(result).toBe(21); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/options.json new file mode 100644 index 000000000000..3149096b66a1 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/options.json @@ -0,0 +1,9 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^^" }], + "transform-arrow-functions" + ], + "parserOpts": { + "allowReturnOutsideFunction": true + } +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/output.js new file mode 100644 index 000000000000..23cdd3fe2a2b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-arrow-functions/output.js @@ -0,0 +1,8 @@ +var _ref, _ref2; + +const triple = function (x) { + return x * 3; +}; + +const result = (_ref2 = -7, (_ref = Math.abs(_ref2), triple(_ref))); +return expect(result).toBe(21); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/exec.js new file mode 100644 index 000000000000..806b90404de2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/exec.js @@ -0,0 +1,13 @@ +const triple = (x) => x * 3; + +async function myFunction(n) { + return n + |> Math.abs(^^) + |> Promise.resolve(^^) + |> await ^^ + |> triple(^^); +} + +return myFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/input.js new file mode 100644 index 000000000000..806b90404de2 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/input.js @@ -0,0 +1,13 @@ +const triple = (x) => x * 3; + +async function myFunction(n) { + return n + |> Math.abs(^^) + |> Promise.resolve(^^) + |> await ^^ + |> triple(^^); +} + +return myFunction(-7).then(result => { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/options.json b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/options.json new file mode 100644 index 000000000000..63e28b169e60 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/options.json @@ -0,0 +1,10 @@ +{ + "plugins": [ + ["proposal-pipeline-operator", { "proposal": "hack", "topicToken": "^^" }], + "transform-arrow-functions" + ], + "parserOpts": { + "allowReturnOutsideFunction": true + }, + "minNodeVersion": "8.0.0" +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/output.js new file mode 100644 index 000000000000..3a32f6e23831 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/transform-await-and-arrow-functions/output.js @@ -0,0 +1,13 @@ +const triple = function (x) { + return x * 3; +}; + +async function myFunction(n) { + var _ref, _ref2, _ref3, _ref4; + + return _ref4 = n, (_ref3 = Math.abs(_ref4), (_ref2 = Promise.resolve(_ref3), (_ref = await _ref2, triple(_ref)))); +} + +return myFunction(-7).then(function (result) { + expect(result).toBe(21); +}); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/exec.js new file mode 100644 index 000000000000..931b5fb0b577 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/exec.js @@ -0,0 +1,7 @@ +let i = 0; +let sum = 0; + +while (i |> (i = ^^ + 1) |> ^^ <= 10) + sum += i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/input.js new file mode 100644 index 000000000000..931b5fb0b577 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/input.js @@ -0,0 +1,7 @@ +let i = 0; +let sum = 0; + +while (i |> (i = ^^ + 1) |> ^^ <= 10) + sum += i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/output.js new file mode 100644 index 000000000000..0622dfee4902 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/while-statement-with-pipe-in-condition/output.js @@ -0,0 +1,10 @@ +let i = 0; +let sum = 0; + +while (_ref2 = i, (_ref = i = _ref2 + 1, _ref <= 10)) { + var _ref, _ref2; + + sum += i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/exec.js new file mode 100644 index 000000000000..49ac297fbbd7 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/exec.js @@ -0,0 +1,3 @@ +const x = 0 |> ^^ + 1; + +expect(x).toBe(1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/input.js new file mode 100644 index 000000000000..49ac297fbbd7 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/input.js @@ -0,0 +1,3 @@ +const x = 0 |> ^^ + 1; + +expect(x).toBe(1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/output.js new file mode 100644 index 000000000000..5ca2ce9e5390 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-assignment/output.js @@ -0,0 +1,4 @@ +var _ref; + +const x = (_ref = 0, _ref + 1); +expect(x).toBe(1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/exec.js new file mode 100644 index 000000000000..d8eca0034388 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/exec.js @@ -0,0 +1,5 @@ +let sum = 0; +for (var i = 0 |> ^^; i <= 10; i++) + sum += i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/input.js new file mode 100644 index 000000000000..d8eca0034388 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/input.js @@ -0,0 +1,5 @@ +let sum = 0; +for (var i = 0 |> ^^; i <= 10; i++) + sum += i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/output.js new file mode 100644 index 000000000000..dd399138c6fb --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-init/output.js @@ -0,0 +1,9 @@ +let sum = 0; + +for (var i = (_ref = 0, _ref); i <= 10; i++) { + var _ref; + + sum += i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/exec.js new file mode 100644 index 000000000000..1c3a2949330b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/exec.js @@ -0,0 +1,5 @@ +let sum = 0; +for (var i = 0; i |> ^^ <= 10; i++) + sum = sum + i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/input.js new file mode 100644 index 000000000000..1c3a2949330b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/input.js @@ -0,0 +1,5 @@ +let sum = 0; +for (var i = 0; i |> ^^ <= 10; i++) + sum = sum + i; + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/output.js new file mode 100644 index 000000000000..14ae06d74abf --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-test/output.js @@ -0,0 +1,9 @@ +let sum = 0; + +for (var i = 0; _ref = i, _ref <= 10; i++) { + var _ref; + + sum = sum + i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/exec.js new file mode 100644 index 000000000000..4a4f210bad58 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/exec.js @@ -0,0 +1,6 @@ +let sum = 0; +for (var i = 0; i <= 10; i = i |> ^^ + 1) { + sum = sum + i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/input.js new file mode 100644 index 000000000000..4a4f210bad58 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/input.js @@ -0,0 +1,6 @@ +let sum = 0; +for (var i = 0; i <= 10; i = i |> ^^ + 1) { + sum = sum + i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1) diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/output.js new file mode 100644 index 000000000000..a741096b130d --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-for-classic-statement-update/output.js @@ -0,0 +1,9 @@ +let sum = 0; + +for (var i = 0; i <= 10; i = (_ref = i, _ref + 1)) { + var _ref; + + sum = sum + i; +} + +expect(sum).toBe(10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-generator-with-yield/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-generator-with-yield/input.js new file mode 100644 index 000000000000..18d48528ed79 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-generator-with-yield/input.js @@ -0,0 +1,5 @@ +function * myGenerator(n) { + return n + |> (yield ^^) + |> Math.abs(^^); +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-generator-with-yield/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-generator-with-yield/output.js new file mode 100644 index 000000000000..4e9cfe3a1240 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-generator-with-yield/output.js @@ -0,0 +1,5 @@ +function* myGenerator(n) { + var _ref, _ref2; + + return _ref2 = n, (_ref = yield _ref2, Math.abs(_ref)); +} diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-if-else-block/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-if-else-block/input.js new file mode 100644 index 000000000000..b9b1692c7123 --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-if-else-block/input.js @@ -0,0 +1,4 @@ +if (v |> e(^^) |> f(^^)) + g() |> h(^^, ^^ + 1) |> i(^^); +else + j(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-if-else-block/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-if-else-block/output.js new file mode 100644 index 000000000000..5d542dc97ffc --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-if-else-block/output.js @@ -0,0 +1,3 @@ +var _ref, _ref2, _ref3, _ref4; + +if (_ref2 = v, (_ref = e(_ref2), f(_ref))) _ref4 = g(), (_ref3 = h(_ref4, _ref4 + 1), i(_ref3));else j(); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/exec.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/exec.js new file mode 100644 index 000000000000..26837dd5150f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/exec.js @@ -0,0 +1,3 @@ +var i = 0; + +expect(i).toBe(0); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/input.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/input.js new file mode 100644 index 000000000000..26837dd5150f --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/input.js @@ -0,0 +1,3 @@ +var i = 0; + +expect(i).toBe(0); diff --git a/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/output.js b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/output.js new file mode 100644 index 000000000000..126fd403042b --- /dev/null +++ b/packages/babel-plugin-proposal-pipeline-operator/test/fixtures/hack-double-caret/within-var-statement/output.js @@ -0,0 +1,2 @@ +var i = 0; +expect(i).toBe(0); diff --git a/packages/babel-plugin-syntax-pipeline-operator/src/index.ts b/packages/babel-plugin-syntax-pipeline-operator/src/index.ts index 6ee8d1fbb638..4a9013ed8965 100644 --- a/packages/babel-plugin-syntax-pipeline-operator/src/index.ts +++ b/packages/babel-plugin-syntax-pipeline-operator/src/index.ts @@ -1,7 +1,7 @@ import { declare } from "@babel/helper-plugin-utils"; const PIPELINE_PROPOSALS = ["minimal", "fsharp", "hack", "smart"]; -const TOPIC_TOKENS = ["^", "%", "#"]; +const TOPIC_TOKENS = ["^^", "@@", "^", "%", "#"]; const documentationURL = "https://babeljs.io/docs/en/babel-plugin-proposal-pipeline-operator";