Fix formatting for nested function returns (#4518)

Previously, this was the output of the formatter:

```
fn f = () => {
  return () => {
  return 1
}
}
```

Now the above will be reformatted as

```
fn f = () => {
  return () => {
    return 1
  }
}
```

Much better!
This commit is contained in:
Adam Chalmers
2024-11-20 08:23:30 -06:00
committed by GitHub
parent d8ce5ad8bd
commit 986675fe89
25 changed files with 3445 additions and 3428 deletions

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@ map(array: [KclValue], map_fn: FunctionParam) -> [KclValue]
r = 10 // radius r = 10 // radius
fn drawCircle = (id) => { fn drawCircle = (id) => {
return startSketchOn("XY") return startSketchOn("XY")
|> circle({ center: [id * 2 * r, 0], radius: r }, %) |> circle({ center: [id * 2 * r, 0], radius: r }, %)
} }
// Call `drawCircle`, passing in each element of the array. // Call `drawCircle`, passing in each element of the array.
@ -47,7 +47,7 @@ r = 10 // radius
// Call `map`, using an anonymous function instead of a named one. // Call `map`, using an anonymous function instead of a named one.
circles = map([1..3], (id) => { circles = map([1..3], (id) => {
return startSketchOn("XY") return startSketchOn("XY")
|> circle({ center: [id * 2 * r, 0], radius: r }, %) |> circle({ center: [id * 2 * r, 0], radius: r }, %)
}) })
``` ```

View File

@ -96,24 +96,24 @@ fn cube = (length, center) => {
p3 = [l + x, -l + y] p3 = [l + x, -l + y]
return startSketchAt(p0) return startSketchAt(p0)
|> lineTo(p1, %) |> lineTo(p1, %)
|> lineTo(p2, %) |> lineTo(p2, %)
|> lineTo(p3, %) |> lineTo(p3, %)
|> lineTo(p0, %) |> lineTo(p0, %)
|> close(%) |> close(%)
|> extrude(length, %) |> extrude(length, %)
} }
width = 20 width = 20
fn transform = (i) => { fn transform = (i) => {
return { return {
// Move down each time. // Move down each time.
translate: [0, 0, -i * width], translate: [0, 0, -i * width],
// Make the cube longer, wider and flatter each time. // Make the cube longer, wider and flatter each time.
scale: [pow(1.1, i), pow(1.1, i), pow(0.9, i)], scale: [pow(1.1, i), pow(1.1, i), pow(0.9, i)],
// Turn by 15 degrees each time. // Turn by 15 degrees each time.
rotation: { angle: 15 * i, origin: "local" } rotation: { angle: 15 * i, origin: "local" }
} }
} }
myCubes = cube(width, [100, 0]) myCubes = cube(width, [100, 0])
@ -133,25 +133,25 @@ fn cube = (length, center) => {
p3 = [l + x, -l + y] p3 = [l + x, -l + y]
return startSketchAt(p0) return startSketchAt(p0)
|> lineTo(p1, %) |> lineTo(p1, %)
|> lineTo(p2, %) |> lineTo(p2, %)
|> lineTo(p3, %) |> lineTo(p3, %)
|> lineTo(p0, %) |> lineTo(p0, %)
|> close(%) |> close(%)
|> extrude(length, %) |> extrude(length, %)
} }
width = 20 width = 20
fn transform = (i) => { fn transform = (i) => {
return { return {
translate: [0, 0, -i * width], translate: [0, 0, -i * width],
rotation: { rotation: {
angle: 90 * i, angle: 90 * i,
// Rotate around the overall scene's origin. // Rotate around the overall scene's origin.
origin: "global" origin: "global"
}
} }
} }
}
myCubes = cube(width, [100, 100]) myCubes = cube(width, [100, 100])
|> patternTransform(4, transform, %) |> patternTransform(4, transform, %)
``` ```
@ -168,16 +168,16 @@ t = 0.005 // taper factor [0-1)
fn transform = (replicaId) => { fn transform = (replicaId) => {
scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8)) scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))
return { return {
translate: [0, 0, replicaId * 10], translate: [0, 0, replicaId * 10],
scale: [scale, scale, 0] scale: [scale, scale, 0]
} }
} }
// Each layer is just a pretty thin cylinder. // Each layer is just a pretty thin cylinder.
fn layer = () => { fn layer = () => {
return startSketchOn("XY") return startSketchOn("XY")
// or some other plane idk // or some other plane idk
|> circle({ center: [0, 0], radius: 1 }, %, $tag1) |> circle({ center: [0, 0], radius: 1 }, %, $tag1)
|> extrude(h, %) |> extrude(h, %)
} }
// The vase is 100 layers tall. // The vase is 100 layers tall.
// The 100 layers are replica of each other, with a slight transformation applied to each. // The 100 layers are replica of each other, with a slight transformation applied to each.

View File

@ -89,7 +89,7 @@ fn decagon = (radius) => {
x = cos(stepAngle * i) * radius x = cos(stepAngle * i) * radius
y = sin(stepAngle * i) * radius y = sin(stepAngle * i) * radius
return lineTo([x, y], partialDecagon) return lineTo([x, y], partialDecagon)
}) })
return fullDecagon return fullDecagon
} }

View File

@ -38,8 +38,8 @@ cube = startSketchAt([0, 0])
fn cylinder = (radius, tag) => { fn cylinder = (radius, tag) => {
return startSketchAt([0, 0]) return startSketchAt([0, 0])
|> circle({ radius: radius, center: segEnd(tag) }, %) |> circle({ radius: radius, center: segEnd(tag) }, %)
|> extrude(radius, %) |> extrude(radius, %)
} }
cylinder(1, line1) cylinder(1, line1)

View File

@ -38,11 +38,11 @@ cube = startSketchAt([0, 0])
fn cylinder = (radius, tag) => { fn cylinder = (radius, tag) => {
return startSketchAt([0, 0]) return startSketchAt([0, 0])
|> circle({ |> circle({
radius: radius, radius: radius,
center: segStart(tag) center: segStart(tag)
}, %) }, %)
|> extrude(radius, %) |> extrude(radius, %)
} }
cylinder(1, line1) cylinder(1, line1)

View File

@ -78572,7 +78572,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"n = int(ceil(5 / 2))\nassertEqual(n, 3, 0.0001, \"5/2 = 2.5, rounded up makes 3\")\n// Draw n cylinders.\nstartSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(n, (id) => {\n return { translate: [4 * id, 0, 0] }\n}, %)" "n = int(ceil(5 / 2))\nassertEqual(n, 3, 0.0001, \"5/2 = 2.5, rounded up makes 3\")\n// Draw n cylinders.\nstartSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(n, (id) => {\n return { translate: [4 * id, 0, 0] }\n }, %)"
] ]
}, },
{ {
@ -105822,8 +105822,8 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"r = 10 // radius\nfn drawCircle = (id) => {\n return startSketchOn(\"XY\")\n |> circle({ center: [id * 2 * r, 0], radius: r }, %)\n}\n\n// Call `drawCircle`, passing in each element of the array.\n// The outputs from each `drawCircle` form a new array,\n// which is the return value from `map`.\ncircles = map([1..3], drawCircle)", "r = 10 // radius\nfn drawCircle = (id) => {\n return startSketchOn(\"XY\")\n |> circle({ center: [id * 2 * r, 0], radius: r }, %)\n}\n\n// Call `drawCircle`, passing in each element of the array.\n// The outputs from each `drawCircle` form a new array,\n// which is the return value from `map`.\ncircles = map([1..3], drawCircle)",
"r = 10 // radius\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map([1..3], (id) => {\n return startSketchOn(\"XY\")\n |> circle({ center: [id * 2 * r, 0], radius: r }, %)\n})" "r = 10 // radius\n// Call `map`, using an anonymous function instead of a named one.\ncircles = map([1..3], (id) => {\n return startSketchOn(\"XY\")\n |> circle({ center: [id * 2 * r, 0], radius: r }, %)\n})"
] ]
}, },
{ {
@ -123903,9 +123903,9 @@
"examples": [ "examples": [
"// Each instance will be shifted along the X axis.\nfn transform = (id) => {\n return { translate: [4 * id, 0, 0] }\n}\n\n// Sketch 4 cylinders.\nsketch001 = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(4, transform, %)", "// Each instance will be shifted along the X axis.\nfn transform = (id) => {\n return { translate: [4 * id, 0, 0] }\n}\n\n// Sketch 4 cylinders.\nsketch001 = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(4, transform, %)",
"// Each instance will be shifted along the X axis,\n// with a gap between the original (at x = 0) and the first replica\n// (at x = 8). This is because `id` starts at 1.\nfn transform = (id) => {\n return { translate: [4 * (1 + id), 0, 0] }\n}\n\nsketch001 = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(4, transform, %)", "// Each instance will be shifted along the X axis,\n// with a gap between the original (at x = 0) and the first replica\n// (at x = 8). This is because `id` starts at 1.\nfn transform = (id) => {\n return { translate: [4 * (1 + id), 0, 0] }\n}\n\nsketch001 = startSketchOn('XZ')\n |> circle({ center: [0, 0], radius: 2 }, %)\n |> extrude(5, %)\n |> patternTransform(4, transform, %)",
"fn cube = (length, center) => {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchAt(p0)\n |> lineTo(p1, %)\n |> lineTo(p2, %)\n |> lineTo(p3, %)\n |> lineTo(p0, %)\n |> close(%)\n |> extrude(length, %)\n}\n\nwidth = 20\nfn transform = (i) => {\n return {\n // Move down each time.\n translate: [0, 0, -i * width],\n // Make the cube longer, wider and flatter each time.\n scale: [pow(1.1, i), pow(1.1, i), pow(0.9, i)],\n // Turn by 15 degrees each time.\n rotation: { angle: 15 * i, origin: \"local\" }\n}\n}\n\nmyCubes = cube(width, [100, 0])\n |> patternTransform(25, transform, %)", "fn cube = (length, center) => {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchAt(p0)\n |> lineTo(p1, %)\n |> lineTo(p2, %)\n |> lineTo(p3, %)\n |> lineTo(p0, %)\n |> close(%)\n |> extrude(length, %)\n}\n\nwidth = 20\nfn transform = (i) => {\n return {\n // Move down each time.\n translate: [0, 0, -i * width],\n // Make the cube longer, wider and flatter each time.\n scale: [pow(1.1, i), pow(1.1, i), pow(0.9, i)],\n // Turn by 15 degrees each time.\n rotation: { angle: 15 * i, origin: \"local\" }\n }\n}\n\nmyCubes = cube(width, [100, 0])\n |> patternTransform(25, transform, %)",
"fn cube = (length, center) => {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchAt(p0)\n |> lineTo(p1, %)\n |> lineTo(p2, %)\n |> lineTo(p3, %)\n |> lineTo(p0, %)\n |> close(%)\n |> extrude(length, %)\n}\n\nwidth = 20\nfn transform = (i) => {\n return {\n translate: [0, 0, -i * width],\n rotation: {\n angle: 90 * i,\n // Rotate around the overall scene's origin.\n origin: \"global\"\n }\n}\n}\nmyCubes = cube(width, [100, 100])\n |> patternTransform(4, transform, %)", "fn cube = (length, center) => {\n l = length / 2\n x = center[0]\n y = center[1]\n p0 = [-l + x, -l + y]\n p1 = [-l + x, l + y]\n p2 = [l + x, l + y]\n p3 = [l + x, -l + y]\n\n return startSketchAt(p0)\n |> lineTo(p1, %)\n |> lineTo(p2, %)\n |> lineTo(p3, %)\n |> lineTo(p0, %)\n |> close(%)\n |> extrude(length, %)\n}\n\nwidth = 20\nfn transform = (i) => {\n return {\n translate: [0, 0, -i * width],\n rotation: {\n angle: 90 * i,\n // Rotate around the overall scene's origin.\n origin: \"global\"\n }\n }\n}\nmyCubes = cube(width, [100, 100])\n |> patternTransform(4, transform, %)",
"// Parameters\nr = 50 // base radius\nh = 10 // layer height\nt = 0.005 // taper factor [0-1)\n// Defines how to modify each layer of the vase.\n// Each replica is shifted up the Z axis, and has a smoothly-varying radius\nfn transform = (replicaId) => {\n scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))\n return {\n translate: [0, 0, replicaId * 10],\n scale: [scale, scale, 0]\n}\n}\n// Each layer is just a pretty thin cylinder.\nfn layer = () => {\n return startSketchOn(\"XY\")\n // or some other plane idk\n |> circle({ center: [0, 0], radius: 1 }, %, $tag1)\n |> extrude(h, %)\n}\n// The vase is 100 layers tall.\n// The 100 layers are replica of each other, with a slight transformation applied to each.\nvase = layer()\n |> patternTransform(100, transform, %)" "// Parameters\nr = 50 // base radius\nh = 10 // layer height\nt = 0.005 // taper factor [0-1)\n// Defines how to modify each layer of the vase.\n// Each replica is shifted up the Z axis, and has a smoothly-varying radius\nfn transform = (replicaId) => {\n scale = r * abs(1 - (t * replicaId)) * (5 + cos(replicaId / 8))\n return {\n translate: [0, 0, replicaId * 10],\n scale: [scale, scale, 0]\n }\n}\n// Each layer is just a pretty thin cylinder.\nfn layer = () => {\n return startSketchOn(\"XY\")\n // or some other plane idk\n |> circle({ center: [0, 0], radius: 1 }, %, $tag1)\n |> extrude(h, %)\n}\n// The vase is 100 layers tall.\n// The 100 layers are replica of each other, with a slight transformation applied to each.\nvase = layer()\n |> patternTransform(100, transform, %)"
] ]
}, },
{ {
@ -162563,7 +162563,7 @@
"examples": [ "examples": [
"// This function adds two numbers.\nfn add = (a, b) => {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum = (arr) => {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n let sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum([1, 2, 3]), 6, 0.00001, \"1 + 2 + 3 summed is 6\")", "// This function adds two numbers.\nfn add = (a, b) => {\n return a + b\n}\n\n// This function adds an array of numbers.\n// It uses the `reduce` function, to call the `add` function on every\n// element of the `arr` parameter. The starting value is 0.\nfn sum = (arr) => {\n return reduce(arr, 0, add)\n}\n\n/* The above is basically like this pseudo-code:\nfn sum(arr):\n let sumSoFar = 0\n for i in arr:\n sumSoFar = add(sumSoFar, i)\n return sumSoFar */\n\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum([1, 2, 3]), 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
"// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(arr, 0, (i, result_so_far) => {\n return i + result_so_far\n})\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum, 6, 0.00001, \"1 + 2 + 3 summed is 6\")", "// This example works just like the previous example above, but it uses\n// an anonymous `add` function as its parameter, instead of declaring a\n// named function outside.\narr = [1, 2, 3]\nsum = reduce(arr, 0, (i, result_so_far) => {\n return i + result_so_far\n})\n\n// We use `assertEqual` to check that our `sum` function gives the\n// expected result. It's good to check your work!\nassertEqual(sum, 6, 0.00001, \"1 + 2 + 3 summed is 6\")",
"// Declare a function that sketches a decagon.\nfn decagon = (radius) => {\n // Each side of the decagon is turned this many degrees from the previous angle.\n stepAngle = 1 / 10 * tau()\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchAt([cos(0) * radius, sin(0) * radius])\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, (i, partialDecagon) => {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return lineTo([x, y], partialDecagon)\n})\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n let stepAngle = (1/10) * tau()\n let startOfDecagonSketch = startSketchAt([(cos(0)*radius), (sin(0) * radius)])\n\n // Here's the reduce part.\n let partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n let x = cos(stepAngle * i) * radius\n let y = sin(stepAngle * i) * radius\n partialDecagon = lineTo([x, y], partialDecagon)\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close(%)" "// Declare a function that sketches a decagon.\nfn decagon = (radius) => {\n // Each side of the decagon is turned this many degrees from the previous angle.\n stepAngle = 1 / 10 * tau()\n\n // Start the decagon sketch at this point.\n startOfDecagonSketch = startSketchAt([cos(0) * radius, sin(0) * radius])\n\n // Use a `reduce` to draw the remaining decagon sides.\n // For each number in the array 1..10, run the given function,\n // which takes a partially-sketched decagon and adds one more edge to it.\n fullDecagon = reduce([1..10], startOfDecagonSketch, (i, partialDecagon) => {\n // Draw one edge of the decagon.\n x = cos(stepAngle * i) * radius\n y = sin(stepAngle * i) * radius\n return lineTo([x, y], partialDecagon)\n })\n\n return fullDecagon\n}\n\n/* The `decagon` above is basically like this pseudo-code:\nfn decagon(radius):\n let stepAngle = (1/10) * tau()\n let startOfDecagonSketch = startSketchAt([(cos(0)*radius), (sin(0) * radius)])\n\n // Here's the reduce part.\n let partialDecagon = startOfDecagonSketch\n for i in [1..10]:\n let x = cos(stepAngle * i) * radius\n let y = sin(stepAngle * i) * radius\n partialDecagon = lineTo([x, y], partialDecagon)\n fullDecagon = partialDecagon // it's now full\n return fullDecagon */\n\n\n// Use the `decagon` function declared above, to sketch a decagon with radius 5.\ndecagon(5.0)\n |> close(%)"
] ]
}, },
{ {
@ -168298,7 +168298,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"w = 15\ncube = startSketchAt([0, 0])\n |> line([w, 0], %, $line1)\n |> line([0, w], %, $line2)\n |> line([-w, 0], %, $line3)\n |> line([0, -w], %, $line4)\n |> close(%)\n |> extrude(5, %)\n\nfn cylinder = (radius, tag) => {\n return startSketchAt([0, 0])\n |> circle({ radius: radius, center: segEnd(tag) }, %)\n |> extrude(radius, %)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)" "w = 15\ncube = startSketchAt([0, 0])\n |> line([w, 0], %, $line1)\n |> line([0, w], %, $line2)\n |> line([-w, 0], %, $line3)\n |> line([0, -w], %, $line4)\n |> close(%)\n |> extrude(5, %)\n\nfn cylinder = (radius, tag) => {\n return startSketchAt([0, 0])\n |> circle({ radius: radius, center: segEnd(tag) }, %)\n |> extrude(radius, %)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
] ]
}, },
{ {
@ -171895,7 +171895,7 @@
"unpublished": false, "unpublished": false,
"deprecated": false, "deprecated": false,
"examples": [ "examples": [
"w = 15\ncube = startSketchAt([0, 0])\n |> line([w, 0], %, $line1)\n |> line([0, w], %, $line2)\n |> line([-w, 0], %, $line3)\n |> line([0, -w], %, $line4)\n |> close(%)\n |> extrude(5, %)\n\nfn cylinder = (radius, tag) => {\n return startSketchAt([0, 0])\n |> circle({\n radius: radius,\n center: segStart(tag)\n }, %)\n |> extrude(radius, %)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)" "w = 15\ncube = startSketchAt([0, 0])\n |> line([w, 0], %, $line1)\n |> line([0, w], %, $line2)\n |> line([-w, 0], %, $line3)\n |> line([0, -w], %, $line4)\n |> close(%)\n |> extrude(5, %)\n\nfn cylinder = (radius, tag) => {\n return startSketchAt([0, 0])\n |> circle({\n radius: radius,\n center: segStart(tag)\n }, %)\n |> extrude(radius, %)\n}\n\ncylinder(1, line1)\ncylinder(2, line2)\ncylinder(3, line3)\ncylinder(4, line4)"
] ]
}, },
{ {

View File

@ -1,11 +1,7 @@
cnr := "cargo nextest run" cnr := "cargo nextest run"
cita := "cargo insta test --accept" cita := "cargo insta test --accept"
# Create a new KCL snapshot test from `tests/inputs/my-test.kcl`. # Run the same lint checks we run in CI.
new-test name:
echo "kcl_test!(\"{{name}}\", {{name}});" >> tests/executor/visuals.rs
TWENTY_TWENTY=overwrite {{cnr}} --test executor -E 'test(=visuals::{{name}})'
lint: lint:
cargo clippy --workspace --all-targets -- -D warnings cargo clippy --workspace --all-targets -- -D warnings

View File

@ -16,7 +16,7 @@ impl Program {
let result = self let result = self
.body .body
.iter() .iter()
.map(|statement| match statement.clone() { .map(|body_item| match body_item.clone() {
BodyItem::ImportStatement(stmt) => stmt.recast(options, indentation_level), BodyItem::ImportStatement(stmt) => stmt.recast(options, indentation_level),
BodyItem::ExpressionStatement(expression_statement) => { BodyItem::ExpressionStatement(expression_statement) => {
expression_statement expression_statement
@ -30,7 +30,10 @@ impl Program {
format!( format!(
"{}return {}", "{}return {}",
indentation, indentation,
return_statement.argument.recast(options, 0, false) return_statement
.argument
.recast(options, indentation_level, false)
.trim_start()
) )
} }
}) })
@ -556,16 +559,16 @@ impl FunctionExpression {
// We don't want to end with a new line inside nested functions. // We don't want to end with a new line inside nested functions.
let mut new_options = options.clone(); let mut new_options = options.clone();
new_options.insert_final_newline = false; new_options.insert_final_newline = false;
format!( let param_list = self
"({}) => {{\n{}{}\n}}", .params
self.params .iter()
.iter() .map(|param| param.identifier.name.clone())
.map(|param| param.identifier.name.clone()) .collect::<Vec<String>>()
.collect::<Vec<String>>() .join(", ");
.join(", "), let tab0 = options.get_indentation(indentation_level);
options.get_indentation(indentation_level + 1), let tab1 = options.get_indentation(indentation_level + 1);
self.body.recast(&new_options, indentation_level + 1) let body = self.body.recast(&new_options, indentation_level + 1);
) format!("({param_list}) => {{\n{tab1}{body}\n{tab0}}}")
} }
} }
@ -1954,6 +1957,24 @@ thickness = sqrt(distance * p * FOS * 6 / (sigmaAllow * width))"#;
assert_eq!(recasted.trim(), some_program_string); assert_eq!(recasted.trim(), some_program_string);
} }
#[test]
fn recast_nested_fn() {
let some_program_string = r#"fn f = () => {
return () => {
return 1
}
}"#;
let program = crate::parser::top_level_parse(some_program_string).unwrap();
let recasted = program.recast(&Default::default(), 0);
let expected = "\
fn f = () => {
return () => {
return 1
}
}";
assert_eq!(recasted.trim(), expected);
}
#[test] #[test]
fn recast_literal() { fn recast_literal() {
use winnow::Parser; use winnow::Parser;

View File

@ -9,7 +9,7 @@ snapshot_kind: text
{ {
"declarations": [ "declarations": [
{ {
"end": 316, "end": 328,
"id": { "id": {
"end": 7, "end": 7,
"name": "cube", "name": "cube",
@ -481,177 +481,177 @@ snapshot_kind: text
{ {
"arguments": [ "arguments": [
{ {
"end": 215, "end": 217,
"name": "p1", "name": "p1",
"start": 213, "start": 215,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 218, "end": 220,
"start": 217, "start": 219,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 212, "end": 214,
"name": "lineTo", "name": "lineTo",
"start": 206, "start": 208,
"type": "Identifier" "type": "Identifier"
}, },
"end": 219, "end": 221,
"optional": false, "optional": false,
"start": 206, "start": 208,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 234, "end": 238,
"name": "p2", "name": "p2",
"start": 232,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 237,
"start": 236, "start": 236,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 241,
"start": 240,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 231, "end": 235,
"name": "lineTo", "name": "lineTo",
"start": 225, "start": 229,
"type": "Identifier" "type": "Identifier"
}, },
"end": 238, "end": 242,
"optional": false, "optional": false,
"start": 225, "start": 229,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 253, "end": 259,
"name": "p3", "name": "p3",
"start": 251, "start": 257,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 256, "end": 262,
"start": 255, "start": 261,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 250, "end": 256,
"name": "lineTo", "name": "lineTo",
"start": 244, "start": 250,
"type": "Identifier" "type": "Identifier"
}, },
"end": 257, "end": 263,
"optional": false, "optional": false,
"start": 244, "start": 250,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 272, "end": 280,
"name": "p0", "name": "p0",
"start": 270, "start": 278,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 275, "end": 283,
"start": 274, "start": 282,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 269, "end": 277,
"name": "lineTo", "name": "lineTo",
"start": 263, "start": 271,
"type": "Identifier" "type": "Identifier"
}, },
"end": 276, "end": 284,
"optional": false, "optional": false,
"start": 263, "start": 271,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 289, "end": 299,
"start": 288, "start": 298,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 287, "end": 297,
"name": "close", "name": "close",
"start": 282, "start": 292,
"type": "Identifier" "type": "Identifier"
}, },
"end": 290, "end": 300,
"optional": false, "optional": false,
"start": 282, "start": 292,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 310, "end": 322,
"name": "length", "name": "length",
"start": 304, "start": 316,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 313, "end": 325,
"start": 312, "start": 324,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 303, "end": 315,
"name": "extrude", "name": "extrude",
"start": 296, "start": 308,
"type": "Identifier" "type": "Identifier"
}, },
"end": 314, "end": 326,
"optional": false, "optional": false,
"start": 296, "start": 308,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 314, "end": 326,
"start": 183, "start": 183,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"end": 314, "end": 326,
"start": 176, "start": 176,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 316, "end": 328,
"nonCodeMeta": { "nonCodeMeta": {
"nonCodeNodes": { "nonCodeNodes": {
"6": [ "6": [
@ -669,7 +669,7 @@ snapshot_kind: text
}, },
"start": 30 "start": 30
}, },
"end": 316, "end": 328,
"params": [ "params": [
{ {
"type": "Parameter", "type": "Parameter",
@ -700,7 +700,7 @@ snapshot_kind: text
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 316, "end": 328,
"kind": "fn", "kind": "fn",
"start": 0, "start": 0,
"type": "VariableDeclaration", "type": "VariableDeclaration",
@ -709,19 +709,19 @@ snapshot_kind: text
{ {
"declarations": [ "declarations": [
{ {
"end": 343, "end": 355,
"id": { "id": {
"end": 324, "end": 336,
"name": "myCube", "name": "myCube",
"start": 318, "start": 330,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [ "arguments": [
{ {
"end": 334, "end": 346,
"raw": "40", "raw": "40",
"start": 332, "start": 344,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 40 "value": 40
@ -729,58 +729,58 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 338, "end": 350,
"raw": "0", "raw": "0",
"start": 337, "start": 349,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
}, },
{ {
"end": 341, "end": 353,
"raw": "0", "raw": "0",
"start": 340, "start": 352,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
} }
], ],
"end": 342, "end": 354,
"start": 336, "start": 348,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
} }
], ],
"callee": { "callee": {
"end": 331, "end": 343,
"name": "cube", "name": "cube",
"start": 327, "start": 339,
"type": "Identifier" "type": "Identifier"
}, },
"end": 343, "end": 355,
"optional": false, "optional": false,
"start": 327, "start": 339,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
"start": 318, "start": 330,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 343, "end": 355,
"kind": "const", "kind": "const",
"start": 318, "start": 330,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
} }
], ],
"end": 344, "end": 356,
"nonCodeMeta": { "nonCodeMeta": {
"nonCodeNodes": { "nonCodeNodes": {
"0": [ "0": [
{ {
"end": 318, "end": 330,
"start": 316, "start": 328,
"type": "NonCodeNode", "type": "NonCodeNode",
"value": { "value": {
"type": "newLine" "type": "newLine"

View File

@ -8,12 +8,12 @@ fn cube = (length, center) => {
p3 = [l + x, -l + y] p3 = [l + x, -l + y]
return startSketchAt(p0) return startSketchAt(p0)
|> lineTo(p1, %) |> lineTo(p1, %)
|> lineTo(p2, %) |> lineTo(p2, %)
|> lineTo(p3, %) |> lineTo(p3, %)
|> lineTo(p0, %) |> lineTo(p0, %)
|> close(%) |> close(%)
|> extrude(length, %) |> extrude(length, %)
} }
myCube = cube(40, [0, 0]) myCube = cube(40, [0, 0])

View File

@ -494,177 +494,177 @@ snapshot_kind: text
{ {
"arguments": [ "arguments": [
{ {
"end": 215, "end": 217,
"name": "p1", "name": "p1",
"start": 213, "start": 215,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 218, "end": 220,
"start": 217, "start": 219,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 212, "end": 214,
"name": "lineTo", "name": "lineTo",
"start": 206, "start": 208,
"type": "Identifier" "type": "Identifier"
}, },
"end": 219, "end": 221,
"optional": false, "optional": false,
"start": 206, "start": 208,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 234, "end": 238,
"name": "p2", "name": "p2",
"start": 232,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 237,
"start": 236, "start": 236,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 241,
"start": 240,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 231, "end": 235,
"name": "lineTo", "name": "lineTo",
"start": 225, "start": 229,
"type": "Identifier" "type": "Identifier"
}, },
"end": 238, "end": 242,
"optional": false, "optional": false,
"start": 225, "start": 229,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 253, "end": 259,
"name": "p3", "name": "p3",
"start": 251, "start": 257,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 256, "end": 262,
"start": 255, "start": 261,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 250, "end": 256,
"name": "lineTo", "name": "lineTo",
"start": 244, "start": 250,
"type": "Identifier" "type": "Identifier"
}, },
"end": 257, "end": 263,
"optional": false, "optional": false,
"start": 244, "start": 250,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 272, "end": 280,
"name": "p0", "name": "p0",
"start": 270, "start": 278,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 275, "end": 283,
"start": 274, "start": 282,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 269, "end": 277,
"name": "lineTo", "name": "lineTo",
"start": 263, "start": 271,
"type": "Identifier" "type": "Identifier"
}, },
"end": 276, "end": 284,
"optional": false, "optional": false,
"start": 263, "start": 271,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 289, "end": 299,
"start": 288, "start": 298,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 287, "end": 297,
"name": "close", "name": "close",
"start": 282, "start": 292,
"type": "Identifier" "type": "Identifier"
}, },
"end": 290, "end": 300,
"optional": false, "optional": false,
"start": 282, "start": 292,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 310, "end": 322,
"name": "length", "name": "length",
"start": 304, "start": 316,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 313, "end": 325,
"start": 312, "start": 324,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 303, "end": 315,
"name": "extrude", "name": "extrude",
"start": 296, "start": 308,
"type": "Identifier" "type": "Identifier"
}, },
"end": 314, "end": 326,
"optional": false, "optional": false,
"start": 296, "start": 308,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 314, "end": 326,
"start": 183, "start": 183,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"end": 314, "end": 326,
"start": 176, "start": 176,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 316, "end": 328,
"nonCodeMeta": { "nonCodeMeta": {
"nonCodeNodes": { "nonCodeNodes": {
"6": [ "6": [
@ -682,7 +682,7 @@ snapshot_kind: text
}, },
"start": 30 "start": 30
}, },
"end": 316, "end": 328,
"params": [ "params": [
{ {
"type": "Parameter", "type": "Parameter",
@ -743,7 +743,7 @@ snapshot_kind: text
{ {
"sourceRange": [ "sourceRange": [
10, 10,
316, 328,
0 0
] ]
} }
@ -758,8 +758,8 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
206, 208,
219, 221,
0 0
], ],
"tag": null, "tag": null,
@ -769,19 +769,8 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
225, 229,
238, 242,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
244,
257,
0 0
], ],
"tag": null, "tag": null,
@ -791,8 +780,19 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
250,
263, 263,
276, 0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
271,
284,
0 0
], ],
"tag": null, "tag": null,
@ -807,8 +807,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
206, 208,
219, 221,
0 0
] ]
}, },
@ -827,8 +827,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
225, 229,
238, 242,
0 0
] ]
}, },
@ -847,28 +847,28 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
244, 250,
257,
0
]
},
"from": [
20.0,
20.0
],
"tag": null,
"to": [
20.0,
-20.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
263, 263,
276, 0
]
},
"from": [
20.0,
20.0
],
"tag": null,
"to": [
20.0,
-20.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
271,
284,
0 0
] ]
}, },
@ -887,8 +887,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
282, 292,
290, 300,
0 0
] ]
}, },

View File

@ -794,463 +794,463 @@ snapshot_kind: text
{ {
"type": "whitespace", "type": "whitespace",
"start": 200, "start": 200,
"end": 203, "end": 205,
"value": "\n " "value": "\n "
}, },
{ {
"type": "operator", "type": "operator",
"start": 203, "start": 205,
"end": 205, "end": 207,
"value": "|>" "value": "|>"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 205, "start": 207,
"end": 206, "end": 208,
"value": " " "value": " "
}, },
{ {
"type": "word", "type": "word",
"start": 206, "start": 208,
"end": 212, "end": 214,
"value": "lineTo" "value": "lineTo"
}, },
{ {
"type": "brace", "type": "brace",
"start": 212, "start": 214,
"end": 213, "end": 215,
"value": "(" "value": "("
}, },
{ {
"type": "word", "type": "word",
"start": 213, "start": 215,
"end": 215, "end": 217,
"value": "p1" "value": "p1"
}, },
{ {
"type": "comma", "type": "comma",
"start": 215, "start": 217,
"end": 216, "end": 218,
"value": "," "value": ","
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 216, "start": 218,
"end": 217, "end": 219,
"value": " " "value": " "
}, },
{ {
"type": "operator", "type": "operator",
"start": 217, "start": 219,
"end": 218, "end": 220,
"value": "%" "value": "%"
}, },
{ {
"type": "brace", "type": "brace",
"start": 218, "start": 220,
"end": 219, "end": 221,
"value": ")" "value": ")"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 219, "start": 221,
"end": 222, "end": 226,
"value": "\n " "value": "\n "
}, },
{ {
"type": "operator", "type": "operator",
"start": 222, "start": 226,
"end": 224, "end": 228,
"value": "|>" "value": "|>"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 224, "start": 228,
"end": 225, "end": 229,
"value": " " "value": " "
}, },
{ {
"type": "word", "type": "word",
"start": 225, "start": 229,
"end": 231, "end": 235,
"value": "lineTo" "value": "lineTo"
}, },
{ {
"type": "brace", "type": "brace",
"start": 231, "start": 235,
"end": 232, "end": 236,
"value": "(" "value": "("
}, },
{ {
"type": "word", "type": "word",
"start": 232, "start": 236,
"end": 234, "end": 238,
"value": "p2" "value": "p2"
}, },
{ {
"type": "comma", "type": "comma",
"start": 234, "start": 238,
"end": 235, "end": 239,
"value": "," "value": ","
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 235, "start": 239,
"end": 236, "end": 240,
"value": " " "value": " "
}, },
{ {
"type": "operator", "type": "operator",
"start": 236, "start": 240,
"end": 237, "end": 241,
"value": "%" "value": "%"
}, },
{ {
"type": "brace", "type": "brace",
"start": 237, "start": 241,
"end": 238, "end": 242,
"value": ")" "value": ")"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 238, "start": 242,
"end": 241, "end": 247,
"value": "\n " "value": "\n "
}, },
{ {
"type": "operator", "type": "operator",
"start": 241, "start": 247,
"end": 243, "end": 249,
"value": "|>" "value": "|>"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 243, "start": 249,
"end": 244,
"value": " "
},
{
"type": "word",
"start": 244,
"end": 250, "end": 250,
"value": "lineTo"
},
{
"type": "brace",
"start": 250,
"end": 251,
"value": "("
},
{
"type": "word",
"start": 251,
"end": 253,
"value": "p3"
},
{
"type": "comma",
"start": 253,
"end": 254,
"value": ","
},
{
"type": "whitespace",
"start": 254,
"end": 255,
"value": " " "value": " "
}, },
{ {
"type": "operator", "type": "word",
"start": 255, "start": 250,
"end": 256, "end": 256,
"value": "%" "value": "lineTo"
}, },
{ {
"type": "brace", "type": "brace",
"start": 256, "start": 256,
"end": 257, "end": 257,
"value": ")"
},
{
"type": "whitespace",
"start": 257,
"end": 260,
"value": "\n "
},
{
"type": "operator",
"start": 260,
"end": 262,
"value": "|>"
},
{
"type": "whitespace",
"start": 262,
"end": 263,
"value": " "
},
{
"type": "word",
"start": 263,
"end": 269,
"value": "lineTo"
},
{
"type": "brace",
"start": 269,
"end": 270,
"value": "(" "value": "("
}, },
{ {
"type": "word", "type": "word",
"start": 270, "start": 257,
"end": 272, "end": 259,
"value": "p0" "value": "p3"
}, },
{ {
"type": "comma", "type": "comma",
"start": 272, "start": 259,
"end": 273, "end": 260,
"value": "," "value": ","
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 273, "start": 260,
"end": 274, "end": 261,
"value": " " "value": " "
}, },
{ {
"type": "operator", "type": "operator",
"start": 274, "start": 261,
"end": 275, "end": 262,
"value": "%" "value": "%"
}, },
{ {
"type": "brace", "type": "brace",
"start": 275, "start": 262,
"end": 276, "end": 263,
"value": ")" "value": ")"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 276, "start": 263,
"end": 279, "end": 268,
"value": "\n " "value": "\n "
}, },
{ {
"type": "operator", "type": "operator",
"start": 279, "start": 268,
"end": 281, "end": 270,
"value": "|>" "value": "|>"
}, },
{
"type": "whitespace",
"start": 270,
"end": 271,
"value": " "
},
{
"type": "word",
"start": 271,
"end": 277,
"value": "lineTo"
},
{
"type": "brace",
"start": 277,
"end": 278,
"value": "("
},
{
"type": "word",
"start": 278,
"end": 280,
"value": "p0"
},
{
"type": "comma",
"start": 280,
"end": 281,
"value": ","
},
{ {
"type": "whitespace", "type": "whitespace",
"start": 281, "start": 281,
"end": 282, "end": 282,
"value": " " "value": " "
}, },
{
"type": "word",
"start": 282,
"end": 287,
"value": "close"
},
{
"type": "brace",
"start": 287,
"end": 288,
"value": "("
},
{ {
"type": "operator", "type": "operator",
"start": 288, "start": 282,
"end": 289, "end": 283,
"value": "%" "value": "%"
}, },
{ {
"type": "brace", "type": "brace",
"start": 289, "start": 283,
"end": 290, "end": 284,
"value": ")" "value": ")"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 290, "start": 284,
"end": 293, "end": 289,
"value": "\n " "value": "\n "
}, },
{ {
"type": "operator", "type": "operator",
"start": 293, "start": 289,
"end": 295, "end": 291,
"value": "|>" "value": "|>"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 295, "start": 291,
"end": 296, "end": 292,
"value": " " "value": " "
}, },
{ {
"type": "word", "type": "word",
"start": 296, "start": 292,
"end": 303, "end": 297,
"value": "extrude" "value": "close"
}, },
{ {
"type": "brace", "type": "brace",
"start": 303, "start": 297,
"end": 304, "end": 298,
"value": "(" "value": "("
}, },
{
"type": "word",
"start": 304,
"end": 310,
"value": "length"
},
{
"type": "comma",
"start": 310,
"end": 311,
"value": ","
},
{
"type": "whitespace",
"start": 311,
"end": 312,
"value": " "
},
{ {
"type": "operator", "type": "operator",
"start": 312, "start": 298,
"end": 313, "end": 299,
"value": "%" "value": "%"
}, },
{ {
"type": "brace", "type": "brace",
"start": 313, "start": 299,
"end": 314, "end": 300,
"value": ")" "value": ")"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 314, "start": 300,
"end": 305,
"value": "\n "
},
{
"type": "operator",
"start": 305,
"end": 307,
"value": "|>"
},
{
"type": "whitespace",
"start": 307,
"end": 308,
"value": " "
},
{
"type": "word",
"start": 308,
"end": 315, "end": 315,
"value": "\n" "value": "extrude"
}, },
{ {
"type": "brace", "type": "brace",
"start": 315, "start": 315,
"end": 316, "end": 316,
"value": "}" "value": "("
},
{
"type": "whitespace",
"start": 316,
"end": 318,
"value": "\n\n"
}, },
{ {
"type": "word", "type": "word",
"start": 318, "start": 316,
"end": 324, "end": 322,
"value": "myCube" "value": "length"
},
{
"type": "comma",
"start": 322,
"end": 323,
"value": ","
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 324, "start": 323,
"end": 325, "end": 324,
"value": " " "value": " "
}, },
{ {
"type": "operator", "type": "operator",
"start": 324,
"end": 325,
"value": "%"
},
{
"type": "brace",
"start": 325, "start": 325,
"end": 326, "end": 326,
"value": "=" "value": ")"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 326, "start": 326,
"end": 327, "end": 327,
"value": "\n"
},
{
"type": "brace",
"start": 327,
"end": 328,
"value": "}"
},
{
"type": "whitespace",
"start": 328,
"end": 330,
"value": "\n\n"
},
{
"type": "word",
"start": 330,
"end": 336,
"value": "myCube"
},
{
"type": "whitespace",
"start": 336,
"end": 337,
"value": " "
},
{
"type": "operator",
"start": 337,
"end": 338,
"value": "="
},
{
"type": "whitespace",
"start": 338,
"end": 339,
"value": " " "value": " "
}, },
{ {
"type": "word", "type": "word",
"start": 327, "start": 339,
"end": 331, "end": 343,
"value": "cube" "value": "cube"
}, },
{ {
"type": "brace", "type": "brace",
"start": 331, "start": 343,
"end": 332, "end": 344,
"value": "(" "value": "("
}, },
{ {
"type": "number", "type": "number",
"start": 332, "start": 344,
"end": 334, "end": 346,
"value": "40" "value": "40"
}, },
{ {
"type": "comma", "type": "comma",
"start": 334, "start": 346,
"end": 335, "end": 347,
"value": "," "value": ","
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 335, "start": 347,
"end": 336, "end": 348,
"value": " " "value": " "
}, },
{ {
"type": "brace", "type": "brace",
"start": 336, "start": 348,
"end": 337, "end": 349,
"value": "[" "value": "["
}, },
{ {
"type": "number", "type": "number",
"start": 337, "start": 349,
"end": 338, "end": 350,
"value": "0" "value": "0"
}, },
{ {
"type": "comma", "type": "comma",
"start": 338, "start": 350,
"end": 339, "end": 351,
"value": "," "value": ","
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 339, "start": 351,
"end": 340, "end": 352,
"value": " " "value": " "
}, },
{ {
"type": "number", "type": "number",
"start": 340, "start": 352,
"end": 341, "end": 353,
"value": "0" "value": "0"
}, },
{ {
"type": "brace", "type": "brace",
"start": 341, "start": 353,
"end": 342, "end": 354,
"value": "]" "value": "]"
}, },
{ {
"type": "brace", "type": "brace",
"start": 342, "start": 354,
"end": 343, "end": 355,
"value": ")" "value": ")"
}, },
{ {
"type": "whitespace", "type": "whitespace",
"start": 343, "start": 355,
"end": 344, "end": 356,
"value": "\n" "value": "\n"
} }
] ]

View File

@ -548,7 +548,7 @@ snapshot_kind: text
{ {
"declarations": [ "declarations": [
{ {
"end": 558, "end": 564,
"id": { "id": {
"end": 408, "end": 408,
"name": "circl", "name": "circl",
@ -595,145 +595,145 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 489, "end": 491,
"left": { "left": {
"end": 480, "end": 482,
"name": "x", "name": "x",
"start": 479, "start": 481,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"operator": "+", "operator": "+",
"right": { "right": {
"end": 489, "end": 491,
"name": "radius", "name": "radius",
"start": 483, "start": 485,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 479, "start": 481,
"type": "BinaryExpression", "type": "BinaryExpression",
"type": "BinaryExpression" "type": "BinaryExpression"
}, },
{ {
"end": 509, "end": 511,
"left": { "left": {
"end": 505, "end": 507,
"name": "triangleHeight", "name": "triangleHeight",
"start": 491, "start": 493,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"operator": "/", "operator": "/",
"right": { "right": {
"end": 509, "end": 511,
"raw": "2", "raw": "2",
"start": 508, "start": 510,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2 "value": 2
}, },
"start": 491, "start": 493,
"type": "BinaryExpression", "type": "BinaryExpression",
"type": "BinaryExpression" "type": "BinaryExpression"
} }
], ],
"end": 510, "end": 512,
"start": 478, "start": 480,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 513, "end": 515,
"start": 512, "start": 514,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 477, "end": 479,
"name": "startProfileAt", "name": "startProfileAt",
"start": 463, "start": 465,
"type": "Identifier" "type": "Identifier"
}, },
"end": 514, "end": 516,
"optional": false, "optional": false,
"start": 463, "start": 465,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 528, "end": 532,
"name": "circ", "name": "circ",
"start": 524, "start": 528,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 531, "end": 535,
"start": 530, "start": 534,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
}, },
{ {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
} }
], ],
"callee": { "callee": {
"end": 523, "end": 527,
"name": "arc", "name": "arc",
"start": 520, "start": 524,
"type": "Identifier" "type": "Identifier"
}, },
"end": 542, "end": 546,
"optional": false, "optional": false,
"start": 520, "start": 524,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 555, "end": 561,
"start": 554, "start": 560,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 553, "end": 559,
"name": "close", "name": "close",
"start": 548, "start": 554,
"type": "Identifier" "type": "Identifier"
}, },
"end": 556, "end": 562,
"optional": false, "optional": false,
"start": 548, "start": 554,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 556, "end": 562,
"start": 435, "start": 435,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"end": 556, "end": 562,
"start": 428, "start": 428,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 558, "end": 564,
"start": 424 "start": 424
}, },
"end": 558, "end": 564,
"params": [ "params": [
{ {
"type": "Parameter", "type": "Parameter",
@ -764,7 +764,7 @@ snapshot_kind: text
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 558, "end": 564,
"kind": "fn", "kind": "fn",
"start": 400, "start": 400,
"type": "VariableDeclaration", "type": "VariableDeclaration",
@ -773,175 +773,175 @@ snapshot_kind: text
{ {
"declarations": [ "declarations": [
{ {
"end": 579, "end": 585,
"id": { "id": {
"end": 562, "end": 568,
"name": "c1", "name": "c1",
"start": 560, "start": 566,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [ "arguments": [
{ {
"argument": { "argument": {
"end": 575, "end": 581,
"raw": "200", "raw": "200",
"start": 572, "start": 578,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 200 "value": 200
}, },
"end": 575, "end": 581,
"operator": "-", "operator": "-",
"start": 571, "start": 577,
"type": "UnaryExpression", "type": "UnaryExpression",
"type": "UnaryExpression" "type": "UnaryExpression"
}, },
{ {
"end": 578, "end": 584,
"name": "c", "name": "c",
"start": 577, "start": 583,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
} }
], ],
"callee": { "callee": {
"end": 570, "end": 576,
"name": "circl", "name": "circl",
"start": 565, "start": 571,
"type": "Identifier" "type": "Identifier"
}, },
"end": 579, "end": 585,
"optional": false, "optional": false,
"start": 565, "start": 571,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
"start": 560, "start": 566,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 579, "end": 585,
"kind": "const", "kind": "const",
"start": 560, "start": 566,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
}, },
{ {
"declarations": [ "declarations": [
{ {
"end": 756, "end": 762,
"id": { "id": {
"end": 588, "end": 594,
"name": "plumbus1", "name": "plumbus1",
"start": 580, "start": 586,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"body": [ "body": [
{ {
"end": 593, "end": 599,
"name": "c1", "name": "c1",
"start": 591, "start": 597,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 617, "end": 623,
"name": "plumbusLen", "name": "plumbusLen",
"start": 607, "start": 613,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 620, "end": 626,
"start": 619, "start": 625,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 606, "end": 612,
"name": "extrude", "name": "extrude",
"start": 599, "start": 605,
"type": "Identifier" "type": "Identifier"
}, },
"end": 621, "end": 627,
"optional": false, "optional": false,
"start": 599, "start": 605,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 752, "end": 758,
"properties": [ "properties": [
{ {
"end": 652, "end": 658,
"key": { "key": {
"end": 649, "end": 655,
"name": "radius", "name": "radius",
"start": 643, "start": 649,
"type": "Identifier" "type": "Identifier"
}, },
"start": 643, "start": 649,
"type": "ObjectProperty", "type": "ObjectProperty",
"value": { "value": {
"end": 652, "end": 658,
"raw": "5", "raw": "5",
"start": 651, "start": 657,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5 "value": 5
} }
}, },
{ {
"end": 745, "end": 751,
"key": { "key": {
"end": 665, "end": 671,
"name": "tags", "name": "tags",
"start": 661, "start": 667,
"type": "Identifier" "type": "Identifier"
}, },
"start": 661, "start": 667,
"type": "ObjectProperty", "type": "ObjectProperty",
"value": { "value": {
"elements": [ "elements": [
{ {
"computed": false, "computed": false,
"end": 693, "end": 699,
"object": { "object": {
"computed": false, "computed": false,
"end": 685, "end": 691,
"object": { "object": {
"end": 680, "end": 686,
"name": "c1", "name": "c1",
"start": 678, "start": 684,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"property": { "property": {
"end": 685, "end": 691,
"name": "tags", "name": "tags",
"start": 681, "start": 687,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 678, "start": 684,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
}, },
"property": { "property": {
"end": 693, "end": 699,
"name": "arc_tag", "name": "arc_tag",
"start": 686, "start": 692,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 678, "start": 684,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
}, },
@ -949,264 +949,264 @@ snapshot_kind: text
"arguments": [ "arguments": [
{ {
"computed": false, "computed": false,
"end": 735, "end": 741,
"object": { "object": {
"computed": false, "computed": false,
"end": 727, "end": 733,
"object": { "object": {
"end": 722, "end": 728,
"name": "c1", "name": "c1",
"start": 720, "start": 726,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"property": { "property": {
"end": 727, "end": 733,
"name": "tags", "name": "tags",
"start": 723, "start": 729,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 720, "start": 726,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
}, },
"property": { "property": {
"end": 735, "end": 741,
"name": "arc_tag", "name": "arc_tag",
"start": 728, "start": 734,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 720, "start": 726,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
} }
], ],
"callee": { "callee": {
"end": 719, "end": 725,
"name": "getOppositeEdge", "name": "getOppositeEdge",
"start": 704, "start": 710,
"type": "Identifier" "type": "Identifier"
}, },
"end": 736, "end": 742,
"optional": false, "optional": false,
"start": 704, "start": 710,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 745, "end": 751,
"start": 667, "start": 673,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
} }
} }
], ],
"start": 634, "start": 640,
"type": "ObjectExpression", "type": "ObjectExpression",
"type": "ObjectExpression" "type": "ObjectExpression"
}, },
{ {
"end": 755, "end": 761,
"start": 754, "start": 760,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 633, "end": 639,
"name": "fillet", "name": "fillet",
"start": 627, "start": 633,
"type": "Identifier" "type": "Identifier"
}, },
"end": 756, "end": 762,
"optional": false, "optional": false,
"start": 627, "start": 633,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 756, "end": 762,
"start": 591, "start": 597,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"start": 580, "start": 586,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 756, "end": 762,
"kind": "const", "kind": "const",
"start": 580, "start": 586,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
}, },
{ {
"declarations": [ "declarations": [
{ {
"end": 775, "end": 781,
"id": { "id": {
"end": 759, "end": 765,
"name": "c2", "name": "c2",
"start": 757, "start": 763,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [ "arguments": [
{ {
"end": 771, "end": 777,
"raw": "200", "raw": "200",
"start": 768, "start": 774,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 200 "value": 200
}, },
{ {
"end": 774, "end": 780,
"name": "a", "name": "a",
"start": 773, "start": 779,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
} }
], ],
"callee": { "callee": {
"end": 767, "end": 773,
"name": "circl", "name": "circl",
"start": 762, "start": 768,
"type": "Identifier" "type": "Identifier"
}, },
"end": 775, "end": 781,
"optional": false, "optional": false,
"start": 762, "start": 768,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
"start": 757, "start": 763,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 775, "end": 781,
"kind": "const", "kind": "const",
"start": 757, "start": 763,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
}, },
{ {
"declarations": [ "declarations": [
{ {
"end": 952, "end": 958,
"id": { "id": {
"end": 784, "end": 790,
"name": "plumbus0", "name": "plumbus0",
"start": 776, "start": 782,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"body": [ "body": [
{ {
"end": 789, "end": 795,
"name": "c2", "name": "c2",
"start": 787, "start": 793,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 813, "end": 819,
"name": "plumbusLen", "name": "plumbusLen",
"start": 803, "start": 809,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 816, "end": 822,
"start": 815, "start": 821,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 802, "end": 808,
"name": "extrude", "name": "extrude",
"start": 795, "start": 801,
"type": "Identifier" "type": "Identifier"
}, },
"end": 817, "end": 823,
"optional": false, "optional": false,
"start": 795, "start": 801,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 948, "end": 954,
"properties": [ "properties": [
{ {
"end": 848, "end": 854,
"key": { "key": {
"end": 845, "end": 851,
"name": "radius", "name": "radius",
"start": 839, "start": 845,
"type": "Identifier" "type": "Identifier"
}, },
"start": 839, "start": 845,
"type": "ObjectProperty", "type": "ObjectProperty",
"value": { "value": {
"end": 848, "end": 854,
"raw": "5", "raw": "5",
"start": 847, "start": 853,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 5 "value": 5
} }
}, },
{ {
"end": 941, "end": 947,
"key": { "key": {
"end": 861, "end": 867,
"name": "tags", "name": "tags",
"start": 857, "start": 863,
"type": "Identifier" "type": "Identifier"
}, },
"start": 857, "start": 863,
"type": "ObjectProperty", "type": "ObjectProperty",
"value": { "value": {
"elements": [ "elements": [
{ {
"computed": false, "computed": false,
"end": 889, "end": 895,
"object": { "object": {
"computed": false, "computed": false,
"end": 881, "end": 887,
"object": { "object": {
"end": 876, "end": 882,
"name": "c2", "name": "c2",
"start": 874, "start": 880,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"property": { "property": {
"end": 881, "end": 887,
"name": "tags", "name": "tags",
"start": 877, "start": 883,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 874, "start": 880,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
}, },
"property": { "property": {
"end": 889, "end": 895,
"name": "arc_tag", "name": "arc_tag",
"start": 882, "start": 888,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 874, "start": 880,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
}, },
@ -1214,101 +1214,101 @@ snapshot_kind: text
"arguments": [ "arguments": [
{ {
"computed": false, "computed": false,
"end": 931, "end": 937,
"object": { "object": {
"computed": false, "computed": false,
"end": 923, "end": 929,
"object": { "object": {
"end": 918, "end": 924,
"name": "c2", "name": "c2",
"start": 916, "start": 922,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"property": { "property": {
"end": 923, "end": 929,
"name": "tags", "name": "tags",
"start": 919, "start": 925,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 916, "start": 922,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
}, },
"property": { "property": {
"end": 931, "end": 937,
"name": "arc_tag", "name": "arc_tag",
"start": 924, "start": 930,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 916, "start": 922,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
} }
], ],
"callee": { "callee": {
"end": 915, "end": 921,
"name": "getOppositeEdge", "name": "getOppositeEdge",
"start": 900, "start": 906,
"type": "Identifier" "type": "Identifier"
}, },
"end": 932, "end": 938,
"optional": false, "optional": false,
"start": 900, "start": 906,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 941, "end": 947,
"start": 863, "start": 869,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
} }
} }
], ],
"start": 830, "start": 836,
"type": "ObjectExpression", "type": "ObjectExpression",
"type": "ObjectExpression" "type": "ObjectExpression"
}, },
{ {
"end": 951, "end": 957,
"start": 950, "start": 956,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 829, "end": 835,
"name": "fillet", "name": "fillet",
"start": 823, "start": 829,
"type": "Identifier" "type": "Identifier"
}, },
"end": 952, "end": 958,
"optional": false, "optional": false,
"start": 823, "start": 829,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 952, "end": 958,
"start": 787, "start": 793,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"start": 776, "start": 782,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 952, "end": 958,
"kind": "const", "kind": "const",
"start": 776, "start": 782,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
} }
], ],
"end": 953, "end": 959,
"nonCodeMeta": { "nonCodeMeta": {
"nonCodeNodes": { "nonCodeNodes": {
"3": [ "3": [
@ -1333,8 +1333,8 @@ snapshot_kind: text
], ],
"6": [ "6": [
{ {
"end": 560, "end": 566,
"start": 558, "start": 564,
"type": "NonCodeNode", "type": "NonCodeNode",
"value": { "value": {
"type": "newLine" "type": "newLine"

View File

@ -17,9 +17,9 @@ p = startSketchOn('XY')
fn circl = (x, face) => { fn circl = (x, face) => {
return startSketchOn(p, face) return startSketchOn(p, face)
|> startProfileAt([x + radius, triangleHeight / 2], %) |> startProfileAt([x + radius, triangleHeight / 2], %)
|> arc(circ, %, $arc_tag) |> arc(circ, %, $arc_tag)
|> close(%) |> close(%)
} }
c1 = circl(-200, c) c1 = circl(-200, c)

View File

@ -99,8 +99,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -114,8 +114,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -129,13 +129,13 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
], ],
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -145,8 +145,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
533, 537,
541, 545,
0 0
] ]
} }
@ -282,8 +282,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -297,8 +297,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -312,8 +312,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
548, 554,
556, 562,
0 0
] ]
}, },
@ -751,8 +751,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -769,8 +769,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -784,8 +784,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -799,13 +799,13 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
], ],
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -815,8 +815,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
533, 537,
541, 545,
0 0
] ]
} }
@ -826,8 +826,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -844,8 +844,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -859,8 +859,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -874,8 +874,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
548, 554,
556, 562,
0 0
] ]
}, },
@ -1313,8 +1313,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -1331,8 +1331,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -1346,8 +1346,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -1361,13 +1361,13 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
], ],
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -1377,8 +1377,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
533, 537,
541, 545,
0 0
] ]
} }
@ -1388,8 +1388,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -1491,145 +1491,145 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 489, "end": 491,
"left": { "left": {
"end": 480, "end": 482,
"name": "x", "name": "x",
"start": 479, "start": 481,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"operator": "+", "operator": "+",
"right": { "right": {
"end": 489, "end": 491,
"name": "radius", "name": "radius",
"start": 483, "start": 485,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 479, "start": 481,
"type": "BinaryExpression", "type": "BinaryExpression",
"type": "BinaryExpression" "type": "BinaryExpression"
}, },
{ {
"end": 509, "end": 511,
"left": { "left": {
"end": 505, "end": 507,
"name": "triangleHeight", "name": "triangleHeight",
"start": 491, "start": 493,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"operator": "/", "operator": "/",
"right": { "right": {
"end": 509, "end": 511,
"raw": "2", "raw": "2",
"start": 508, "start": 510,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2 "value": 2
}, },
"start": 491, "start": 493,
"type": "BinaryExpression", "type": "BinaryExpression",
"type": "BinaryExpression" "type": "BinaryExpression"
} }
], ],
"end": 510, "end": 512,
"start": 478, "start": 480,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 513, "end": 515,
"start": 512, "start": 514,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 477, "end": 479,
"name": "startProfileAt", "name": "startProfileAt",
"start": 463, "start": 465,
"type": "Identifier" "type": "Identifier"
}, },
"end": 514, "end": 516,
"optional": false, "optional": false,
"start": 463, "start": 465,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 528, "end": 532,
"name": "circ", "name": "circ",
"start": 524, "start": 528,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 531, "end": 535,
"start": 530, "start": 534,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
}, },
{ {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
} }
], ],
"callee": { "callee": {
"end": 523, "end": 527,
"name": "arc", "name": "arc",
"start": 520, "start": 524,
"type": "Identifier" "type": "Identifier"
}, },
"end": 542, "end": 546,
"optional": false, "optional": false,
"start": 520, "start": 524,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 555, "end": 561,
"start": 554, "start": 560,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 553, "end": 559,
"name": "close", "name": "close",
"start": 548, "start": 554,
"type": "Identifier" "type": "Identifier"
}, },
"end": 556, "end": 562,
"optional": false, "optional": false,
"start": 548, "start": 554,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 556, "end": 562,
"start": 435, "start": 435,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"end": 556, "end": 562,
"start": 428, "start": 428,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 558, "end": 564,
"start": 424 "start": 424
}, },
"end": 558, "end": 564,
"params": [ "params": [
{ {
"type": "Parameter", "type": "Parameter",
@ -2356,7 +2356,7 @@ snapshot_kind: text
{ {
"sourceRange": [ "sourceRange": [
411, 411,
558, 564,
0 0
] ]
} }
@ -2752,13 +2752,13 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
], ],
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -2773,8 +2773,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -2788,8 +2788,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -2803,8 +2803,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
548, 554,
556, 562,
0 0
] ]
}, },
@ -3242,8 +3242,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -3260,8 +3260,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -3275,8 +3275,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -3290,13 +3290,13 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
], ],
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -3306,8 +3306,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
533, 537,
541, 545,
0 0
] ]
} }
@ -3317,8 +3317,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -3346,8 +3346,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -3362,13 +3362,13 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
], ],
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -3383,8 +3383,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -3398,8 +3398,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -3413,8 +3413,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
548, 554,
556, 562,
0 0
] ]
}, },
@ -3852,8 +3852,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -3870,8 +3870,8 @@ snapshot_kind: text
"__geoMeta": { "__geoMeta": {
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
] ]
}, },
@ -3885,8 +3885,8 @@ snapshot_kind: text
], ],
"radius": 80.0, "radius": 80.0,
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -3900,13 +3900,13 @@ snapshot_kind: text
"faceId": "[uuid]", "faceId": "[uuid]",
"id": "[uuid]", "id": "[uuid]",
"sourceRange": [ "sourceRange": [
520, 524,
542, 546,
0 0
], ],
"tag": { "tag": {
"end": 541, "end": 545,
"start": 533, "start": 537,
"type": "TagDeclarator", "type": "TagDeclarator",
"value": "arc_tag" "value": "arc_tag"
}, },
@ -3916,8 +3916,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
533, 537,
541, 545,
0 0
] ]
} }
@ -3927,8 +3927,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }
@ -3956,8 +3956,8 @@ snapshot_kind: text
"__meta": [ "__meta": [
{ {
"sourceRange": [ "sourceRange": [
463, 465,
514, 516,
0 0
] ]
} }

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ snapshot_kind: text
{ {
"declarations": [ "declarations": [
{ {
"end": 316, "end": 328,
"id": { "id": {
"end": 7, "end": 7,
"name": "cube", "name": "cube",
@ -481,177 +481,177 @@ snapshot_kind: text
{ {
"arguments": [ "arguments": [
{ {
"end": 215, "end": 217,
"name": "p1", "name": "p1",
"start": 213, "start": 215,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 218, "end": 220,
"start": 217, "start": 219,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 212, "end": 214,
"name": "lineTo", "name": "lineTo",
"start": 206, "start": 208,
"type": "Identifier" "type": "Identifier"
}, },
"end": 219, "end": 221,
"optional": false, "optional": false,
"start": 206, "start": 208,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 234, "end": 238,
"name": "p2", "name": "p2",
"start": 232,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 237,
"start": 236, "start": 236,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 241,
"start": 240,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 231, "end": 235,
"name": "lineTo", "name": "lineTo",
"start": 225, "start": 229,
"type": "Identifier" "type": "Identifier"
}, },
"end": 238, "end": 242,
"optional": false, "optional": false,
"start": 225, "start": 229,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 253, "end": 259,
"name": "p3", "name": "p3",
"start": 251, "start": 257,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 256, "end": 262,
"start": 255, "start": 261,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 250, "end": 256,
"name": "lineTo", "name": "lineTo",
"start": 244, "start": 250,
"type": "Identifier" "type": "Identifier"
}, },
"end": 257, "end": 263,
"optional": false, "optional": false,
"start": 244, "start": 250,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 272, "end": 280,
"name": "p0", "name": "p0",
"start": 270, "start": 278,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 275, "end": 283,
"start": 274, "start": 282,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 269, "end": 277,
"name": "lineTo", "name": "lineTo",
"start": 263, "start": 271,
"type": "Identifier" "type": "Identifier"
}, },
"end": 276, "end": 284,
"optional": false, "optional": false,
"start": 263, "start": 271,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 289, "end": 299,
"start": 288, "start": 298,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 287, "end": 297,
"name": "close", "name": "close",
"start": 282, "start": 292,
"type": "Identifier" "type": "Identifier"
}, },
"end": 290, "end": 300,
"optional": false, "optional": false,
"start": 282, "start": 292,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 310, "end": 322,
"name": "length", "name": "length",
"start": 304, "start": 316,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
{ {
"end": 313, "end": 325,
"start": 312, "start": 324,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 303, "end": 315,
"name": "extrude", "name": "extrude",
"start": 296, "start": 308,
"type": "Identifier" "type": "Identifier"
}, },
"end": 314, "end": 326,
"optional": false, "optional": false,
"start": 296, "start": 308,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 314, "end": 326,
"start": 183, "start": 183,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"end": 314, "end": 326,
"start": 176, "start": 176,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 316, "end": 328,
"nonCodeMeta": { "nonCodeMeta": {
"nonCodeNodes": { "nonCodeNodes": {
"6": [ "6": [
@ -669,7 +669,7 @@ snapshot_kind: text
}, },
"start": 30 "start": 30
}, },
"end": 316, "end": 328,
"params": [ "params": [
{ {
"type": "Parameter", "type": "Parameter",
@ -700,7 +700,7 @@ snapshot_kind: text
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 316, "end": 328,
"kind": "fn", "kind": "fn",
"start": 0, "start": 0,
"type": "VariableDeclaration", "type": "VariableDeclaration",
@ -709,11 +709,11 @@ snapshot_kind: text
{ {
"declarations": [ "declarations": [
{ {
"end": 355, "end": 367,
"id": { "id": {
"end": 327, "end": 339,
"name": "double", "name": "double",
"start": 321, "start": 333,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
@ -721,71 +721,71 @@ snapshot_kind: text
"body": [ "body": [
{ {
"argument": { "argument": {
"end": 353, "end": 365,
"left": { "left": {
"end": 349, "end": 361,
"name": "x", "name": "x",
"start": 348, "start": 360,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"operator": "*", "operator": "*",
"right": { "right": {
"end": 353, "end": 365,
"raw": "2", "raw": "2",
"start": 352, "start": 364,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 2 "value": 2
}, },
"start": 348, "start": 360,
"type": "BinaryExpression", "type": "BinaryExpression",
"type": "BinaryExpression" "type": "BinaryExpression"
}, },
"end": 353, "end": 365,
"start": 341, "start": 353,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 355, "end": 367,
"start": 337 "start": 349
}, },
"end": 355, "end": 367,
"params": [ "params": [
{ {
"type": "Parameter", "type": "Parameter",
"identifier": { "identifier": {
"end": 332, "end": 344,
"name": "x", "name": "x",
"start": 331, "start": 343,
"type": "Identifier" "type": "Identifier"
}, },
"optional": false "optional": false
} }
], ],
"start": 330, "start": 342,
"type": "FunctionExpression", "type": "FunctionExpression",
"type": "FunctionExpression" "type": "FunctionExpression"
}, },
"start": 321, "start": 333,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 355, "end": 367,
"kind": "fn", "kind": "fn",
"start": 318, "start": 330,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
}, },
{ {
"declarations": [ "declarations": [
{ {
"end": 389, "end": 401,
"id": { "id": {
"end": 364, "end": 376,
"name": "width", "name": "width",
"start": 359, "start": 371,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
@ -793,46 +793,46 @@ snapshot_kind: text
"body": [ "body": [
{ {
"argument": { "argument": {
"end": 387, "end": 399,
"raw": "200", "raw": "200",
"start": 384, "start": 396,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 200 "value": 200
}, },
"end": 387, "end": 399,
"start": 377, "start": 389,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 389, "end": 401,
"start": 373 "start": 385
}, },
"end": 389, "end": 401,
"params": [], "params": [],
"start": 367, "start": 379,
"type": "FunctionExpression", "type": "FunctionExpression",
"type": "FunctionExpression" "type": "FunctionExpression"
}, },
"start": 359, "start": 371,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 389, "end": 401,
"kind": "fn", "kind": "fn",
"start": 356, "start": 368,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
}, },
{ {
"declarations": [ "declarations": [
{ {
"end": 432, "end": 444,
"id": { "id": {
"end": 397, "end": 409,
"name": "myCube", "name": "myCube",
"start": 391, "start": 403,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
@ -840,9 +840,9 @@ snapshot_kind: text
{ {
"body": [ "body": [
{ {
"end": 408, "end": 420,
"raw": "200", "raw": "200",
"start": 405, "start": 417,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 200 "value": 200
@ -850,85 +850,85 @@ snapshot_kind: text
{ {
"arguments": [ "arguments": [
{ {
"end": 422, "end": 434,
"start": 421, "start": 433,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 420, "end": 432,
"name": "double", "name": "double",
"start": 414, "start": 426,
"type": "Identifier" "type": "Identifier"
}, },
"end": 423, "end": 435,
"optional": false, "optional": false,
"start": 414, "start": 426,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 423, "end": 435,
"start": 405, "start": 417,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
{ {
"elements": [ "elements": [
{ {
"end": 427, "end": 439,
"raw": "0", "raw": "0",
"start": 426, "start": 438,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
}, },
{ {
"end": 430, "end": 442,
"raw": "0", "raw": "0",
"start": 429, "start": 441,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
} }
], ],
"end": 431, "end": 443,
"start": 425, "start": 437,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
} }
], ],
"callee": { "callee": {
"end": 404, "end": 416,
"name": "cube", "name": "cube",
"start": 400, "start": 412,
"type": "Identifier" "type": "Identifier"
}, },
"end": 432, "end": 444,
"optional": false, "optional": false,
"start": 400, "start": 412,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
"start": 391, "start": 403,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 432, "end": 444,
"kind": "const", "kind": "const",
"start": 391, "start": 403,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
} }
], ],
"end": 433, "end": 445,
"nonCodeMeta": { "nonCodeMeta": {
"nonCodeNodes": { "nonCodeNodes": {
"0": [ "0": [
{ {
"end": 318, "end": 330,
"start": 316, "start": 328,
"type": "NonCodeNode", "type": "NonCodeNode",
"value": { "value": {
"type": "newLine" "type": "newLine"
@ -937,8 +937,8 @@ snapshot_kind: text
], ],
"2": [ "2": [
{ {
"end": 391, "end": 403,
"start": 389, "start": 401,
"type": "NonCodeNode", "type": "NonCodeNode",
"value": { "value": {
"type": "newLine" "type": "newLine"

View File

@ -8,12 +8,12 @@ fn cube = (length, center) => {
p3 = [l + x, -l + y] p3 = [l + x, -l + y]
return startSketchAt(p0) return startSketchAt(p0)
|> lineTo(p1, %) |> lineTo(p1, %)
|> lineTo(p2, %) |> lineTo(p2, %)
|> lineTo(p3, %) |> lineTo(p3, %)
|> lineTo(p0, %) |> lineTo(p0, %)
|> close(%) |> close(%)
|> extrude(length, %) |> extrude(length, %)
} }
fn double = (x) => { fn double = (x) => {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ snapshot_kind: text
{ {
"declarations": [ "declarations": [
{ {
"end": 157, "end": 167,
"id": { "id": {
"end": 7, "end": 7,
"name": "test", "name": "test",
@ -50,43 +50,43 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 69, "end": 71,
"raw": "0", "raw": "0",
"start": 68, "start": 70,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
}, },
{ {
"end": 72, "end": 74,
"raw": "0", "raw": "0",
"start": 71, "start": 73,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
} }
], ],
"end": 73, "end": 75,
"start": 67, "start": 69,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 76, "end": 78,
"start": 75, "start": 77,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 66, "end": 68,
"name": "startProfileAt", "name": "startProfileAt",
"start": 52, "start": 54,
"type": "Identifier" "type": "Identifier"
}, },
"end": 77, "end": 79,
"optional": false, "optional": false,
"start": 52, "start": 54,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
@ -95,43 +95,43 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 90, "end": 94,
"raw": "0", "raw": "0",
"start": 89, "start": 93,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
}, },
{ {
"end": 93, "end": 97,
"raw": "1", "raw": "1",
"start": 92, "start": 96,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1 "value": 1
} }
], ],
"end": 94, "end": 98,
"start": 88, "start": 92,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 97, "end": 101,
"start": 96, "start": 100,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 87, "end": 91,
"name": "line", "name": "line",
"start": 83, "start": 87,
"type": "Identifier" "type": "Identifier"
}, },
"end": 98, "end": 102,
"optional": false, "optional": false,
"start": 83, "start": 87,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
@ -140,43 +140,43 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 111, "end": 117,
"raw": "1", "raw": "1",
"start": 110, "start": 116,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1 "value": 1
}, },
{ {
"end": 114, "end": 120,
"raw": "0", "raw": "0",
"start": 113, "start": 119,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
} }
], ],
"end": 115, "end": 121,
"start": 109, "start": 115,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 118, "end": 124,
"start": 117, "start": 123,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 108, "end": 114,
"name": "line", "name": "line",
"start": 104, "start": 110,
"type": "Identifier" "type": "Identifier"
}, },
"end": 119, "end": 125,
"optional": false, "optional": false,
"start": 104, "start": 110,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
@ -185,90 +185,90 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 132, "end": 140,
"raw": "0", "raw": "0",
"start": 131, "start": 139,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
}, },
{ {
"argument": { "argument": {
"end": 136, "end": 144,
"raw": "1", "raw": "1",
"start": 135, "start": 143,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1 "value": 1
}, },
"end": 136, "end": 144,
"operator": "-", "operator": "-",
"start": 134, "start": 142,
"type": "UnaryExpression", "type": "UnaryExpression",
"type": "UnaryExpression" "type": "UnaryExpression"
} }
], ],
"end": 137, "end": 145,
"start": 130, "start": 138,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 140, "end": 148,
"start": 139, "start": 147,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 129, "end": 137,
"name": "line", "name": "line",
"start": 125, "start": 133,
"type": "Identifier" "type": "Identifier"
}, },
"end": 141, "end": 149,
"optional": false, "optional": false,
"start": 125, "start": 133,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 154, "end": 164,
"start": 153, "start": 163,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 152, "end": 162,
"name": "close", "name": "close",
"start": 147, "start": 157,
"type": "Identifier" "type": "Identifier"
}, },
"end": 155, "end": 165,
"optional": false, "optional": false,
"start": 147, "start": 157,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 155, "end": 165,
"start": 27, "start": 27,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"end": 155, "end": 165,
"start": 20, "start": 20,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 157, "end": 167,
"start": 16 "start": 16
}, },
"end": 157, "end": 167,
"params": [], "params": [],
"start": 10, "start": 10,
"type": "FunctionExpression", "type": "FunctionExpression",
@ -278,7 +278,7 @@ snapshot_kind: text
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 157, "end": 167,
"kind": "fn", "kind": "fn",
"start": 0, "start": 0,
"type": "VariableDeclaration", "type": "VariableDeclaration",
@ -287,11 +287,11 @@ snapshot_kind: text
{ {
"declarations": [ "declarations": [
{ {
"end": 369, "end": 397,
"id": { "id": {
"end": 167, "end": 177,
"name": "test2", "name": "test2",
"start": 162, "start": 172,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
@ -299,53 +299,53 @@ snapshot_kind: text
"body": [ "body": [
{ {
"argument": { "argument": {
"end": 367, "end": 395,
"properties": [ "properties": [
{ {
"end": 365, "end": 391,
"key": { "key": {
"end": 197, "end": 209,
"name": "thing1", "name": "thing1",
"start": 191, "start": 203,
"type": "Identifier" "type": "Identifier"
}, },
"start": 191, "start": 203,
"type": "ObjectProperty", "type": "ObjectProperty",
"value": { "value": {
"end": 365, "end": 391,
"properties": [ "properties": [
{ {
"end": 361, "end": 385,
"key": { "key": {
"end": 211, "end": 225,
"name": "thing2", "name": "thing2",
"start": 205, "start": 219,
"type": "Identifier" "type": "Identifier"
}, },
"start": 205, "start": 219,
"type": "ObjectProperty", "type": "ObjectProperty",
"value": { "value": {
"body": [ "body": [
{ {
"arguments": [ "arguments": [
{ {
"end": 231, "end": 245,
"raw": "'XY'", "raw": "'XY'",
"start": 227, "start": 241,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": "XY" "value": "XY"
} }
], ],
"callee": { "callee": {
"end": 226, "end": 240,
"name": "startSketchOn", "name": "startSketchOn",
"start": 213, "start": 227,
"type": "Identifier" "type": "Identifier"
}, },
"end": 232, "end": 246,
"optional": false, "optional": false,
"start": 213, "start": 227,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
@ -354,43 +354,43 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 259, "end": 275,
"raw": "0", "raw": "0",
"start": 258, "start": 274,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
}, },
{ {
"end": 262, "end": 278,
"raw": "0", "raw": "0",
"start": 261, "start": 277,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
} }
], ],
"end": 263, "end": 279,
"start": 257, "start": 273,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 266, "end": 282,
"start": 265, "start": 281,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 256, "end": 272,
"name": "startProfileAt", "name": "startProfileAt",
"start": 242, "start": 258,
"type": "Identifier" "type": "Identifier"
}, },
"end": 267, "end": 283,
"optional": false, "optional": false,
"start": 242, "start": 258,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
@ -399,43 +399,43 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 284, "end": 302,
"raw": "0", "raw": "0",
"start": 283, "start": 301,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
}, },
{ {
"end": 287, "end": 305,
"raw": "1", "raw": "1",
"start": 286, "start": 304,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1 "value": 1
} }
], ],
"end": 288, "end": 306,
"start": 282, "start": 300,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 291, "end": 309,
"start": 290, "start": 308,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 281, "end": 299,
"name": "line", "name": "line",
"start": 277, "start": 295,
"type": "Identifier" "type": "Identifier"
}, },
"end": 292, "end": 310,
"optional": false, "optional": false,
"start": 277, "start": 295,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
@ -444,43 +444,43 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 309, "end": 329,
"raw": "1", "raw": "1",
"start": 308, "start": 328,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1 "value": 1
}, },
{ {
"end": 312, "end": 332,
"raw": "0", "raw": "0",
"start": 311, "start": 331,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
} }
], ],
"end": 313, "end": 333,
"start": 307, "start": 327,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 316, "end": 336,
"start": 315, "start": 335,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 306, "end": 326,
"name": "line", "name": "line",
"start": 302, "start": 322,
"type": "Identifier" "type": "Identifier"
}, },
"end": 317, "end": 337,
"optional": false, "optional": false,
"start": 302, "start": 322,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
@ -489,159 +489,159 @@ snapshot_kind: text
{ {
"elements": [ "elements": [
{ {
"end": 334, "end": 356,
"raw": "0", "raw": "0",
"start": 333, "start": 355,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 0 "value": 0
}, },
{ {
"argument": { "argument": {
"end": 338, "end": 360,
"raw": "1", "raw": "1",
"start": 337, "start": 359,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 1 "value": 1
}, },
"end": 338, "end": 360,
"operator": "-", "operator": "-",
"start": 336, "start": 358,
"type": "UnaryExpression", "type": "UnaryExpression",
"type": "UnaryExpression" "type": "UnaryExpression"
} }
], ],
"end": 339, "end": 361,
"start": 332, "start": 354,
"type": "ArrayExpression", "type": "ArrayExpression",
"type": "ArrayExpression" "type": "ArrayExpression"
}, },
{ {
"end": 342, "end": 364,
"start": 341, "start": 363,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 331, "end": 353,
"name": "line", "name": "line",
"start": 327, "start": 349,
"type": "Identifier" "type": "Identifier"
}, },
"end": 343, "end": 365,
"optional": false, "optional": false,
"start": 327, "start": 349,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 360, "end": 384,
"start": 359, "start": 383,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 358, "end": 382,
"name": "close", "name": "close",
"start": 353, "start": 377,
"type": "Identifier" "type": "Identifier"
}, },
"end": 361, "end": 385,
"optional": false, "optional": false,
"start": 353, "start": 377,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 361, "end": 385,
"start": 213, "start": 227,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
} }
} }
], ],
"start": 199, "start": 211,
"type": "ObjectExpression", "type": "ObjectExpression",
"type": "ObjectExpression" "type": "ObjectExpression"
} }
} }
], ],
"start": 187, "start": 197,
"type": "ObjectExpression", "type": "ObjectExpression",
"type": "ObjectExpression" "type": "ObjectExpression"
}, },
"end": 367, "end": 395,
"start": 180, "start": 190,
"type": "ReturnStatement", "type": "ReturnStatement",
"type": "ReturnStatement" "type": "ReturnStatement"
} }
], ],
"end": 369, "end": 397,
"start": 176 "start": 186
}, },
"end": 369, "end": 397,
"params": [], "params": [],
"start": 170, "start": 180,
"type": "FunctionExpression", "type": "FunctionExpression",
"type": "FunctionExpression" "type": "FunctionExpression"
}, },
"start": 162, "start": 172,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 369, "end": 397,
"kind": "fn", "kind": "fn",
"start": 159, "start": 169,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
}, },
{ {
"declarations": [ "declarations": [
{ {
"end": 381, "end": 409,
"id": { "id": {
"end": 372, "end": 400,
"name": "x", "name": "x",
"start": 371, "start": 399,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [], "arguments": [],
"callee": { "callee": {
"end": 379, "end": 407,
"name": "test", "name": "test",
"start": 375, "start": 403,
"type": "Identifier" "type": "Identifier"
}, },
"end": 381, "end": 409,
"optional": false, "optional": false,
"start": 375, "start": 403,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
"start": 371, "start": 399,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 381, "end": 409,
"kind": "const", "kind": "const",
"start": 371, "start": 399,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
}, },
{ {
"end": 404, "end": 432,
"expression": { "expression": {
"body": [ "body": [
{ {
"end": 383, "end": 411,
"name": "x", "name": "x",
"start": 382, "start": 410,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
@ -649,168 +649,168 @@ snapshot_kind: text
"arguments": [ "arguments": [
{ {
"argument": { "argument": {
"end": 400, "end": 428,
"raw": "10", "raw": "10",
"start": 398, "start": 426,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10 "value": 10
}, },
"end": 400, "end": 428,
"operator": "-", "operator": "-",
"start": 397, "start": 425,
"type": "UnaryExpression", "type": "UnaryExpression",
"type": "UnaryExpression" "type": "UnaryExpression"
}, },
{ {
"end": 403, "end": 431,
"start": 402, "start": 430,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 396, "end": 424,
"name": "extrude", "name": "extrude",
"start": 389, "start": 417,
"type": "Identifier" "type": "Identifier"
}, },
"end": 404, "end": 432,
"optional": false, "optional": false,
"start": 389, "start": 417,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 404, "end": 432,
"start": 382, "start": 410,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"start": 382, "start": 410,
"type": "ExpressionStatement", "type": "ExpressionStatement",
"type": "ExpressionStatement" "type": "ExpressionStatement"
}, },
{ {
"declarations": [ "declarations": [
{ {
"end": 418, "end": 446,
"id": { "id": {
"end": 408, "end": 436,
"name": "x2", "name": "x2",
"start": 406, "start": 434,
"type": "Identifier" "type": "Identifier"
}, },
"init": { "init": {
"arguments": [], "arguments": [],
"callee": { "callee": {
"end": 416, "end": 444,
"name": "test2", "name": "test2",
"start": 411, "start": 439,
"type": "Identifier" "type": "Identifier"
}, },
"end": 418, "end": 446,
"optional": false, "optional": false,
"start": 411, "start": 439,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
}, },
"start": 406, "start": 434,
"type": "VariableDeclarator" "type": "VariableDeclarator"
} }
], ],
"end": 418, "end": 446,
"kind": "const", "kind": "const",
"start": 406, "start": 434,
"type": "VariableDeclaration", "type": "VariableDeclaration",
"type": "VariableDeclaration" "type": "VariableDeclaration"
}, },
{ {
"end": 455, "end": 483,
"expression": { "expression": {
"body": [ "body": [
{ {
"computed": false, "computed": false,
"end": 435, "end": 463,
"object": { "object": {
"computed": false, "computed": false,
"end": 428, "end": 456,
"object": { "object": {
"end": 421, "end": 449,
"name": "x2", "name": "x2",
"start": 419, "start": 447,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"property": { "property": {
"end": 428, "end": 456,
"name": "thing1", "name": "thing1",
"start": 422, "start": 450,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 419, "start": 447,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
}, },
"property": { "property": {
"end": 435, "end": 463,
"name": "thing2", "name": "thing2",
"start": 429, "start": 457,
"type": "Identifier", "type": "Identifier",
"type": "Identifier" "type": "Identifier"
}, },
"start": 419, "start": 447,
"type": "MemberExpression", "type": "MemberExpression",
"type": "MemberExpression" "type": "MemberExpression"
}, },
{ {
"arguments": [ "arguments": [
{ {
"end": 451, "end": 479,
"raw": "10", "raw": "10",
"start": 449, "start": 477,
"type": "Literal", "type": "Literal",
"type": "Literal", "type": "Literal",
"value": 10 "value": 10
}, },
{ {
"end": 454, "end": 482,
"start": 453, "start": 481,
"type": "PipeSubstitution", "type": "PipeSubstitution",
"type": "PipeSubstitution" "type": "PipeSubstitution"
} }
], ],
"callee": { "callee": {
"end": 448, "end": 476,
"name": "extrude", "name": "extrude",
"start": 441, "start": 469,
"type": "Identifier" "type": "Identifier"
}, },
"end": 455, "end": 483,
"optional": false, "optional": false,
"start": 441, "start": 469,
"type": "CallExpression", "type": "CallExpression",
"type": "CallExpression" "type": "CallExpression"
} }
], ],
"end": 455, "end": 483,
"start": 419, "start": 447,
"type": "PipeExpression", "type": "PipeExpression",
"type": "PipeExpression" "type": "PipeExpression"
}, },
"start": 419, "start": 447,
"type": "ExpressionStatement", "type": "ExpressionStatement",
"type": "ExpressionStatement" "type": "ExpressionStatement"
} }
], ],
"end": 456, "end": 484,
"nonCodeMeta": { "nonCodeMeta": {
"nonCodeNodes": { "nonCodeNodes": {
"0": [ "0": [
{ {
"end": 159, "end": 169,
"start": 157, "start": 167,
"type": "NonCodeNode", "type": "NonCodeNode",
"value": { "value": {
"type": "newLine" "type": "newLine"
@ -819,8 +819,8 @@ snapshot_kind: text
], ],
"1": [ "1": [
{ {
"end": 371, "end": 399,
"start": 369, "start": 397,
"type": "NonCodeNode", "type": "NonCodeNode",
"value": { "value": {
"type": "newLine" "type": "newLine"
@ -829,8 +829,8 @@ snapshot_kind: text
], ],
"3": [ "3": [
{ {
"end": 406, "end": 434,
"start": 404, "start": 432,
"type": "NonCodeNode", "type": "NonCodeNode",
"value": { "value": {
"type": "newLine" "type": "newLine"

View File

@ -1,24 +1,24 @@
fn test = () => { fn test = () => {
return startSketchOn('XY') return startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0, 1], %) |> line([0, 1], %)
|> line([1, 0], %) |> line([1, 0], %)
|> line([0, -1], %) |> line([0, -1], %)
|> close(%) |> close(%)
} }
fn test2 = () => { fn test2 = () => {
return { return {
thing1: { thing1: {
thing2: startSketchOn('XY') thing2: startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0, 1], %) |> line([0, 1], %)
|> line([1, 0], %) |> line([1, 0], %)
|> line([0, -1], %) |> line([0, -1], %)
|> close(%) |> close(%)
}
} }
} }
}
x = test() x = test()
x x

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff