Skip to content

Commit dc4338e

Browse files
committed
completely remove parameter only needed for error messages
1 parent e12caee commit dc4338e

5 files changed

Lines changed: 9 additions & 16 deletions

File tree

src/parser/composer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ export function phrase(value: Phrase): string {
9090
return preposition(value);
9191
}
9292
}
93-
function particle(type: "and" | "anu", particle: null | string) {
93+
function particle(type: "and" | "anu", particle: string) {
9494
if (type === "and") {
95-
return particle!;
95+
return particle;
9696
} else {
9797
return "anu;";
9898
}
9999
}
100100
export function multiplePhrases(
101101
phrases: MultiplePhrases,
102-
andParticle: null | string,
102+
andParticle: string,
103103
): string {
104104
switch (phrases.type) {
105105
case "simple":

src/translator/phrase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ export function multiplePhrases(
427427
phrases: TokiPona.MultiplePhrases;
428428
place: Place;
429429
includeGerund: boolean;
430-
andParticle: null | string;
430+
andParticle: string;
431431
}>,
432432
): IterableResult<PhraseTranslation> {
433433
const { phrases, andParticle } = options;

src/translator/preposition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function preposition(
3030
phrases: preposition.phrases,
3131
place: "object",
3232
includeGerund: true,
33-
andParticle: null,
33+
andParticle: preposition.preposition.word,
3434
})
3535
.map((phrases) =>
3636
phrases.type === "noun"

src/translator2/phrase.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,8 @@ export function phraseAsVerb(
381381
}
382382

383383
export function multiplePhrases(
384-
options: Readonly<{
385-
phrases: TokiPona.MultiplePhrases;
386-
andParticle: null | string;
387-
}>,
384+
phrases: TokiPona.MultiplePhrases,
388385
): IterableResult<PhraseTranslation> {
389-
const { phrases, andParticle } = options;
390386
switch (phrases.type) {
391387
case "simple":
392388
return phrase(phrases.phrase);
@@ -395,7 +391,7 @@ export function multiplePhrases(
395391
const conjunction = CONJUNCTION[phrases.type];
396392
return IterableResult.combine(
397393
...phrases.phrases
398-
.map((phrases) => multiplePhrases({ ...options, phrases })),
394+
.map((phrases) => multiplePhrases(phrases)),
399395
)
400396
.filterMap((phrase): null | PhraseTranslation => {
401397
if (
@@ -458,7 +454,7 @@ export function multiplePhrases(
458454
}
459455
})
460456
.addErrorWhenNone(() =>
461-
new ExhaustedError(Composer.multiplePhrases(phrases, andParticle))
457+
new ExhaustedError(Composer.multiplePhrases(phrases, "(and)"))
462458
);
463459
}
464460
}

src/translator2/preposition.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ export function preposition(
3131
))
3232
: throwError(new FilteredError("adjectives modifying preposition"))
3333
),
34-
multiplePhrases({
35-
phrases: preposition.phrases,
36-
andParticle: null,
37-
})
34+
multiplePhrases(preposition.phrases)
3835
.filterMap((phrases) =>
3936
phrases.type === "noun"
4037
? adverbialIsNone(phrases.adverbialModifier) ? phrases.noun : null

0 commit comments

Comments
 (0)