Skip to content

Commit

Permalink
comment: Clarify descriptive comments in createStatementsFromExpanded…
Browse files Browse the repository at this point in the history
…Placeholders()
  • Loading branch information
claremacrae committed Dec 22, 2024
1 parent 344b60d commit 9c78154
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Query/Query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,19 @@ ${source}`;
}

private createStatementsFromExpandedPlaceholders(expandedSource: string, statement: Statement) {
// Trim and filter empty lines in one step.
const expandedSourceLines = expandedSource
.split('\n')
.map((line) => line.trim())
.filter((line) => line.length > 0);

if (expandedSourceLines.length === 1) {
// Save any expanded text back in to the statement:
// Save the single expanded line back into the statement.
statement.recordExpandedPlaceholders(expandedSourceLines[0]);
return [statement];
}

// The expanded source is more than one line, so we will need to create multiple statements.
// This only happens if the placeholder was a multiple-line property from the query file.
// Handle multiple-line placeholders.
return expandedSourceLines.map((expandedSourceLine, index) => {
const counter = `: statement ${index + 1} after expansion of placeholder`;
const newStatement = new Statement(
Expand Down

0 comments on commit 9c78154

Please sign in to comment.