fix function variable panel issue (#2392)
* fix function variable panel issue * fix test
This commit is contained in:
@ -38,7 +38,7 @@ describe('processMemory', () => {
|
|||||||
expect(output.otherVar).toEqual(3)
|
expect(output.otherVar).toEqual(3)
|
||||||
expect(output).toEqual({
|
expect(output).toEqual({
|
||||||
myVar: 5,
|
myVar: 5,
|
||||||
myFn: undefined,
|
myFn: '__function(a)__',
|
||||||
otherVar: 3,
|
otherVar: 3,
|
||||||
theExtrude: [
|
theExtrude: [
|
||||||
{
|
{
|
||||||
|
@ -83,6 +83,10 @@ export const processMemory = (programMemory: ProgramMemory) => {
|
|||||||
processedMemory[key] = val.value.map(({ ...rest }: ExtrudeSurface) => {
|
processedMemory[key] = val.value.map(({ ...rest }: ExtrudeSurface) => {
|
||||||
return rest
|
return rest
|
||||||
})
|
})
|
||||||
|
} else if ((val.type as any) === 'Function') {
|
||||||
|
processedMemory[key] = `__function(${(val as any)?.expression?.params
|
||||||
|
?.map?.(({ identifier }: any) => identifier?.name || '')
|
||||||
|
.join(', ')})__`
|
||||||
} else {
|
} else {
|
||||||
processedMemory[key] = val.value
|
processedMemory[key] = val.value
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user