tag as top level part 2 (#2773)

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fmt

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* unit tests pass

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* playwright

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* format

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* format

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* more literals gone

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* remove console log

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* remove only

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix some recast shit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* last

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jess Frazelle
2024-06-24 22:39:04 -07:00
committed by GitHub
parent ad5bfa1a29
commit da6cd5cf9f
44 changed files with 720 additions and 536 deletions

View File

@ -2,8 +2,10 @@ import {
createArrayExpression,
createBinaryExpression,
createCallExpressionStdLib,
createIdentifier,
createLiteral,
createPipeSubstitution,
createTagDeclarator,
createUnaryExpression,
} from 'lang/modifyAst'
import { roundOff } from './utils'
@ -35,13 +37,13 @@ export const getRectangleCallExpressions = (
createLiteral(0), // This will be the width of the rectangle
]),
createPipeSubstitution(),
createLiteral(tags[0]),
createTagDeclarator(tags[0]),
]),
createCallExpressionStdLib('angledLine', [
createArrayExpression([
createBinaryExpression([
createCallExpressionStdLib('segAng', [
createLiteral(tags[0]),
createIdentifier(tags[0]),
createPipeSubstitution(),
]),
'+',
@ -50,24 +52,24 @@ export const getRectangleCallExpressions = (
createLiteral(0), // This will be the height of the rectangle
]),
createPipeSubstitution(),
createLiteral(tags[1]),
createTagDeclarator(tags[1]),
]),
createCallExpressionStdLib('angledLine', [
createArrayExpression([
createCallExpressionStdLib('segAng', [
createLiteral(tags[0]),
createIdentifier(tags[0]),
createPipeSubstitution(),
]), // same angle as the first line
createUnaryExpression(
createCallExpressionStdLib('segLen', [
createLiteral(tags[0]),
createIdentifier(tags[0]),
createPipeSubstitution(),
]),
'-'
), // negative height
]),
createPipeSubstitution(),
createLiteral(tags[2]),
createTagDeclarator(tags[2]),
]),
createCallExpressionStdLib('lineTo', [
createArrayExpression([
@ -101,7 +103,7 @@ export function updateRectangleSketch(
.arguments[0] as ArrayExpression) = createArrayExpression([
createBinaryExpression([
createCallExpressionStdLib('segAng', [
createLiteral(tag),
createIdentifier(tag),
createPipeSubstitution(),
]),
Math.sign(y) === Math.sign(x) ? '+' : '-',