Skip to content

Commit

Permalink
Remove navigation for PipelineBody node
Browse files Browse the repository at this point in the history
The parser no longer produces a PipelineBody node
  • Loading branch information
thiagoarrais committed Apr 15, 2019
1 parent 6ac6faf commit 523e18c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Expand Up @@ -5,7 +5,7 @@ const fsharpVisitor = {
const { scope } = path;
const { node } = path;
const { operator, left } = node;
let right = node.right.body;
let { right } = node;
if (operator !== "|>") return;

let optimizeArrow =
Expand Down Expand Up @@ -35,10 +35,7 @@ const fsharpVisitor = {
const placeholder = scope.generateUidIdentifierBasedOnNode(param || left);
scope.push({ id: placeholder });
if (param) {
path
.get("right")
.get("body")
.scope.rename(param.name, placeholder.name);
path.get("right").scope.rename(param.name, placeholder.name);
}

const applied =
Expand Down
@@ -1,29 +1,34 @@
const y = 2;
// parenthised until parser is fixed

const f = (x) => (x
|> (y) => y + 1)
|> (z) => z * y

const _f = (x) => x
|> (y) => y + 1
|> (z) => z * y

const g = (x) => x
|> (y => { return (
|> (y) => (
y + 1
|> (z) => z * y);
}
|> (z) => z * y
)

const h = (x) => x
const _g = (x) => x
|> (y => (
y + 1
|> (z) => z * y)
)

const i = (x) => x
|> (y) => (
const __g = (x) => x
|> (y => { return (
y + 1
|> (z) => z * y
|> (z) => z * y);
}
)

expect(f(1)).toBe(4);
expect(g(1)).toBe(2);
expect(h(1)).toBe(2);
expect(i(1)).toBe(2);
expect( f(1)).toBe(4);
expect( _f(1)).toBe(4);
expect( g(1)).toBe(2);
expect( _g(1)).toBe(2);
expect(__g(1)).toBe(2);

0 comments on commit 523e18c

Please sign in to comment.