Skip to content

Commit 297814d

Browse files
committed
use nullable value instead
1 parent 5cdb9d4 commit 297814d

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/translator/ast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export type Adverb = Readonly<{
5353
export type AdverbVerb = {
5454
preAdverb: ReadonlyArray<Adverb>;
5555
verb: Word;
56-
postAdverb: ReadonlyArray<Adverb>;
56+
postAdverb: null | Adverb;
5757
};
5858
export type Verb = Readonly<{
5959
modal: null | AdverbVerb;

src/translator/composer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function adverbVerb(verbAdverb: English.AdverbVerb) {
7676
return [
7777
...preAdverb.map(({ adverb }) => adverb),
7878
verb,
79-
...postAdverb.map(({ adverb }) => adverb),
79+
...nullableAsArray(postAdverb).map(({ adverb }) => adverb),
8080
]
8181
.map(word).join(" ");
8282
}

src/translator/phrase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function verbPhrase(
174174
preposition,
175175
};
176176
} else if (verb.modal != null) {
177-
const postAdverb = negated ? [NOT] : [];
177+
const postAdverb = negated ? NOT : null;
178178
return {
179179
...verb,
180180
modal: {

src/translator/verb.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ function addModal(
6868
return {
6969
preAdverb,
7070
verb: word({ ...first, word: useVerb }),
71-
postAdverb: [],
71+
postAdverb: null,
7272
};
7373
});
7474
const postAdverb = takeNegative && (verb.first?.negated ?? false)
75-
? [NOT]
76-
: [];
75+
? NOT
76+
: null;
7777
return {
7878
...verb,
7979
modal: {
@@ -224,7 +224,7 @@ function fromVerbForms(
224224
doesNot: {
225225
preAdverb: [],
226226
verb: noEmphasis(`${does} not/did not/will not`),
227-
postAdverb: [],
227+
postAdverb: null,
228228
},
229229
verb: verbForms.presentPlural,
230230
postAdverb: null,
@@ -258,7 +258,7 @@ function fromVerbForms(
258258
modal: {
259259
preAdverb: [],
260260
verb: noEmphasis("will"),
261-
postAdverb: [NOT],
261+
postAdverb: NOT,
262262
},
263263
verb: "be",
264264
postAdverb: null,
@@ -272,22 +272,22 @@ function fromVerbForms(
272272
doesNot: {
273273
preAdverb: [],
274274
verb: noEmphasis(does),
275-
postAdverb: [NOT],
275+
postAdverb: NOT,
276276
},
277277
},
278278
{
279279
modal: null,
280280
doesNot: {
281281
preAdverb: [],
282282
verb: noEmphasis("did"),
283-
postAdverb: [NOT],
283+
postAdverb: NOT,
284284
},
285285
},
286286
{
287287
modal: {
288288
preAdverb: [],
289289
verb: noEmphasis("will"),
290-
postAdverb: [NOT],
290+
postAdverb: NOT,
291291
},
292292
doesNot: null,
293293
},
@@ -327,7 +327,7 @@ function fromVerbForms(
327327
doesNot: {
328328
preAdverb: [],
329329
verb: noEmphasis(does),
330-
postAdverb: [NOT],
330+
postAdverb: NOT,
331331
},
332332
verb: verbForms.presentPlural,
333333
postAdverb: null,
@@ -350,7 +350,7 @@ function fromVerbForms(
350350
{
351351
preAdverb: adverb,
352352
verb: word({ ...verbForms, word: verb }),
353-
postAdverb: nullableAsArray(postAdverb),
353+
postAdverb,
354354
},
355355
],
356356
}));
@@ -403,5 +403,5 @@ export function verb(
403403
}
404404
}
405405
export function noAdverbs(verb: English.Word): English.AdverbVerb {
406-
return { preAdverb: [], verb, postAdverb: [] };
406+
return { preAdverb: [], verb, postAdverb: null };
407407
}

src/translator/word_unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function defaultWordUnit(
8686
reduplicationCount,
8787
emphasis: emphasis != null,
8888
}),
89-
postAdverb: [],
89+
postAdverb: null,
9090
},
9191
first: null,
9292
rest: [],

0 commit comments

Comments
 (0)