Type check and coerce arguments to user functions and return values from std Rust functions (#6958)

* Shuffle around function call code

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Refactor function calls to share more code

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Hack to leave the result of revolve as a singleton rather than array

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-19 16:50:15 +12:00
committed by GitHub
parent f3e9d110c0
commit b19acd550d
197 changed files with 13837 additions and 14317 deletions

View File

@ -317,10 +317,7 @@ const OperationItem = (props: {
* TODO: https://github.com/KittyCAD/modeling-app/issues/4442
*/
function enterEditFlow() {
if (
props.item.type === 'StdLibCall' ||
props.item.type === 'KclStdLibCall'
) {
if (props.item.type === 'StdLibCall') {
props.send({
type: 'enterEditFlow',
data: {
@ -332,10 +329,7 @@ const OperationItem = (props: {
}
function enterAppearanceFlow() {
if (
props.item.type === 'StdLibCall' ||
props.item.type === 'KclStdLibCall'
) {
if (props.item.type === 'StdLibCall') {
props.send({
type: 'enterAppearanceFlow',
data: {
@ -347,11 +341,7 @@ const OperationItem = (props: {
}
function enterTranslateFlow() {
if (
props.item.type === 'StdLibCall' ||
props.item.type === 'KclStdLibCall' ||
props.item.type === 'GroupBegin'
) {
if (props.item.type === 'StdLibCall' || props.item.type === 'GroupBegin') {
props.send({
type: 'enterTranslateFlow',
data: {
@ -363,11 +353,7 @@ const OperationItem = (props: {
}
function enterRotateFlow() {
if (
props.item.type === 'StdLibCall' ||
props.item.type === 'KclStdLibCall' ||
props.item.type === 'GroupBegin'
) {
if (props.item.type === 'StdLibCall' || props.item.type === 'GroupBegin') {
props.send({
type: 'enterRotateFlow',
data: {
@ -379,11 +365,7 @@ const OperationItem = (props: {
}
function enterCloneFlow() {
if (
props.item.type === 'StdLibCall' ||
props.item.type === 'KclStdLibCall' ||
props.item.type === 'GroupBegin'
) {
if (props.item.type === 'StdLibCall' || props.item.type === 'GroupBegin') {
props.send({
type: 'enterCloneFlow',
data: {
@ -395,11 +377,7 @@ const OperationItem = (props: {
}
function deleteOperation() {
if (
props.item.type === 'StdLibCall' ||
props.item.type === 'GroupBegin' ||
props.item.type === 'KclStdLibCall'
) {
if (props.item.type === 'StdLibCall' || props.item.type === 'GroupBegin') {
props.send({
type: 'deleteOperation',
data: {
@ -454,8 +432,7 @@ const OperationItem = (props: {
</ContextMenuItem>,
]
: []),
...(props.item.type === 'StdLibCall' ||
props.item.type === 'KclStdLibCall'
...(props.item.type === 'StdLibCall'
? [
<ContextMenuItem
disabled={!stdLibMap[props.item.name]?.prepareToEdit}
@ -473,9 +450,7 @@ const OperationItem = (props: {
</ContextMenuItem>,
]
: []),
...(props.item.type === 'StdLibCall' ||
props.item.type === 'KclStdLibCall' ||
props.item.type === 'GroupBegin'
...(props.item.type === 'StdLibCall' || props.item.type === 'GroupBegin'
? [
<ContextMenuItem
onClick={enterTranslateFlow}