Rename kcl Value to Expr (#3360)

Rename kcl's Value to Expr

As Jon pointed out, kcl's `Value` enum is actually an expression.
"2+2" isn't a value, it's an expression, which can compute a value.
So I renamed it `Expr`.
This commit is contained in:
Adam Chalmers
2024-08-12 15:38:42 -05:00
committed by GitHub
parent d1e21d673e
commit 13986fcfd7
34 changed files with 473 additions and 475 deletions

View File

@ -6,7 +6,7 @@ import {
PipeExpression,
VariableDeclaration,
VariableDeclarator,
Value,
Expr,
Literal,
PipeSubstitution,
Identifier,
@ -195,10 +195,7 @@ export function findUniqueName(
return findUniqueName(searchStr, name, pad, index + 1)
}
export function mutateArrExp(
node: Value,
updateWith: ArrayExpression
): boolean {
export function mutateArrExp(node: Expr, updateWith: ArrayExpression): boolean {
if (node.type === 'ArrayExpression') {
node.elements.forEach((element, i) => {
if (isLiteralArrayOrStatic(element)) {
@ -211,7 +208,7 @@ export function mutateArrExp(
}
export function mutateObjExpProp(
node: Value,
node: Expr,
updateWith: Literal | ArrayExpression,
key: string
): boolean {
@ -254,7 +251,7 @@ export function extrudeSketch(
node: Program,
pathToNode: PathToNode,
shouldPipe = false,
distance = createLiteral(4) as Value
distance = createLiteral(4) as Expr
):
| {
modifiedAst: Program
@ -608,7 +605,7 @@ export function createVariableDeclaration(
}
export function createObjectExpression(properties: {
[key: string]: Value
[key: string]: Expr
}): ObjectExpression {
return {
type: 'ObjectExpression',