Add trivia to AST Node (#5330)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-02-11 18:30:14 +13:00
committed by GitHub
parent 0e9d37c0a0
commit d4d9bf6c7f
56 changed files with 119 additions and 65 deletions

View File

@ -128,15 +128,78 @@ describe('Testing findUniqueName', () => {
it('should find a unique name', () => {
const result = findUniqueName(
JSON.stringify([
{ type: 'Identifier', name: 'yo01', start: 0, end: 0, moduleId: 0 },
{ type: 'Identifier', name: 'yo02', start: 0, end: 0, moduleId: 0 },
{ type: 'Identifier', name: 'yo03', start: 0, end: 0, moduleId: 0 },
{ type: 'Identifier', name: 'yo04', start: 0, end: 0, moduleId: 0 },
{ type: 'Identifier', name: 'yo05', start: 0, end: 0, moduleId: 0 },
{ type: 'Identifier', name: 'yo06', start: 0, end: 0, moduleId: 0 },
{ type: 'Identifier', name: 'yo07', start: 0, end: 0, moduleId: 0 },
{ type: 'Identifier', name: 'yo08', start: 0, end: 0, moduleId: 0 },
{ type: 'Identifier', name: 'yo09', start: 0, end: 0, moduleId: 0 },
{
type: 'Identifier',
name: 'yo01',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
{
type: 'Identifier',
name: 'yo02',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
{
type: 'Identifier',
name: 'yo03',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
{
type: 'Identifier',
name: 'yo04',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
{
type: 'Identifier',
name: 'yo05',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
{
type: 'Identifier',
name: 'yo06',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
{
type: 'Identifier',
name: 'yo07',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
{
type: 'Identifier',
name: 'yo08',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
{
type: 'Identifier',
name: 'yo09',
start: 0,
end: 0,
moduleId: 0,
trivia: [],
},
] satisfies Node<Identifier>[]),
'yo',
2
@ -154,6 +217,7 @@ describe('Testing addSketchTo', () => {
end: 0,
moduleId: 0,
nonCodeMeta: { nonCodeNodes: {}, startNodes: [] },
trivia: [],
},
'yz'
)