Skip to content

Commit 8dbb04c

Browse files
committed
chore: wip
1 parent cfc3831 commit 8dbb04c

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

src/extract.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
// ===========================
23
// Type Definitions
34
// ===========================
@@ -217,7 +218,6 @@ export function createProcessingState(): ProcessingState {
217218
moduleImports: new Map(),
218219
availableTypes: new Map(),
219220
availableValues: new Map(),
220-
sourceLines: [],
221221
currentIndentation: '',
222222
declarationBuffer: null,
223223
}
@@ -259,20 +259,8 @@ export function processLine(line: string, state: ProcessingState): void {
259259
const indent = getIndentation(line)
260260
console.log('Processing line with indent:', { line, indent })
261261

262-
if (!state.sourceLines) {
263-
state.sourceLines = []
264-
}
265-
266-
state.sourceLines.push(line)
267262
state.currentIndentation = indent
268263

269-
if (!state.isMultiLineDeclaration) {
270-
state.declarationFormatting = {
271-
indent,
272-
content: [],
273-
}
274-
}
275-
276264
const trimmedLine = line.trim()
277265
if (!trimmedLine)
278266
return
@@ -509,9 +497,9 @@ export function processDeclaration(declaration: string, state: ProcessingState):
509497
function processDeclarationBuffer(
510498
buffer: NonNullable<ProcessingState['declarationBuffer']>,
511499
state: ProcessingState,
500+
isExported: boolean,
512501
): string {
513502
const declaration = buffer.lines.join('\n')
514-
const isExported = needsExport(declaration)
515503
const cleaned = cleanDeclaration(declaration)
516504

517505
switch (buffer.type) {
@@ -1425,8 +1413,11 @@ function processDeclarationLine(line: string, state: ProcessingState): void {
14251413
// Clean up any existing declaration first
14261414
if (state.declarationBuffer) {
14271415
const cleaned = cleanDeclaration(state.declarationBuffer.lines.join('\n'))
1428-
const isExported = needsExport(cleaned)
1429-
const processed = processDeclarationBuffer(state.declarationBuffer, state)
1416+
const processed = processDeclarationBuffer(
1417+
state.declarationBuffer,
1418+
state,
1419+
needsExport(cleaned),
1420+
)
14301421

14311422
if (processed) {
14321423
if (state.declarationBuffer.comments.length > 0) {
@@ -1454,8 +1445,11 @@ function processDeclarationLine(line: string, state: ProcessingState): void {
14541445
// Check for completion
14551446
if (isDeclarationComplete(state.declarationBuffer.lines)) {
14561447
const cleaned = cleanDeclaration(state.declarationBuffer.lines.join('\n'))
1457-
const isExported = needsExport(cleaned)
1458-
const processed = processDeclarationBuffer(state.declarationBuffer, state)
1448+
const processed = processDeclarationBuffer(
1449+
state.declarationBuffer,
1450+
state,
1451+
needsExport(cleaned),
1452+
)
14591453

14601454
if (processed) {
14611455
if (state.declarationBuffer.comments.length > 0) {

0 commit comments

Comments
 (0)