From 9c78154cd2310bb5f6828f55e414e39772b1b0f5 Mon Sep 17 00:00:00 2001 From: Clare Macrae Date: Sun, 22 Dec 2024 22:25:02 +0000 Subject: [PATCH] comment: Clarify descriptive comments in createStatementsFromExpandedPlaceholders() --- src/Query/Query.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Query/Query.ts b/src/Query/Query.ts index 7bbe97a04f..6261826fe4 100644 --- a/src/Query/Query.ts +++ b/src/Query/Query.ts @@ -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(