|
1 | 1 | import { ArrayResult } from "../array_result.ts";
|
2 |
| -import { nullableAsArray } from "../misc.ts"; |
| 2 | +import { nullableAsArray, throwError } from "../misc.ts"; |
3 | 3 | import * as TokiPona from "../parser/ast.ts";
|
4 | 4 | import { AdjectiveWithInWay } from "./adjective.ts";
|
5 | 5 | import * as English from "./ast.ts";
|
@@ -116,14 +116,11 @@ function associatedPredicate(
|
116 | 116 | preposition: ReadonlyArray<English.Preposition>,
|
117 | 117 | ): ArrayResult<PartialCompoundVerb> {
|
118 | 118 | return ArrayResult.from(() => {
|
119 |
| - let verbObject: ArrayResult<PartialCompoundVerb>; |
120 |
| - if (object == null) { |
121 |
| - verbObject = new ArrayResult([phraseAsVerb(predicate)]); |
122 |
| - } else if (object.type === "noun") { |
123 |
| - verbObject = predicateVerb(predicate, object.noun); |
124 |
| - } else { |
125 |
| - throw new UntranslatableError(object.type, "object"); |
126 |
| - } |
| 119 | + const verbObject = object == null |
| 120 | + ? new ArrayResult([phraseAsVerb(predicate)]) |
| 121 | + : object.type === "noun" |
| 122 | + ? predicateVerb(predicate, object.noun) |
| 123 | + : throwError(new UntranslatableError(object.type, "object")); |
127 | 124 | return verbObject.map((verbObject) => ({
|
128 | 125 | ...verbObject,
|
129 | 126 | preposition: [...verbObject.preposition, ...preposition],
|
|
0 commit comments