KCL parser: Allow comments in multi-line object expression (#3607)

Like my previous PR to array expressions (https://github.com/KittyCAD/modeling-app/pull/3539), but for object expressions. Closes https://github.com/KittyCAD/modeling-app/issues/1528
This commit is contained in:
Adam Chalmers
2024-08-22 13:54:59 -05:00
committed by GitHub
parent a2d8c5a714
commit e16ecc28a3
5 changed files with 412 additions and 43 deletions

View File

@ -563,7 +563,7 @@ export function createArrayExpression(
start: 0,
end: 0,
digest: null,
nonCodeMeta: { nonCodeNodes: {}, start: [], digest: null },
nonCodeMeta: nonCodeMetaEmpty(),
elements,
}
}
@ -577,7 +577,7 @@ export function createPipeExpression(
end: 0,
digest: null,
body,
nonCodeMeta: { nonCodeNodes: {}, start: [], digest: null },
nonCodeMeta: nonCodeMetaEmpty(),
}
}
@ -613,6 +613,7 @@ export function createObjectExpression(properties: {
start: 0,
end: 0,
digest: null,
nonCodeMeta: nonCodeMetaEmpty(),
properties: Object.entries(properties).map(([key, value]) => ({
type: 'ObjectProperty',
start: 0,
@ -1065,3 +1066,7 @@ export async function deleteFromSelection(
return new Error('Selection not recognised, could not delete')
}
const nonCodeMetaEmpty = () => {
return { nonCodeNodes: {}, start: [], digest: null }
}