Skip to content

Commit 06a41fb

Browse files
committed
comments fixes part 2
1 parent 1a726b0 commit 06a41fb

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/parsers/InputFieldDeclarationParser.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,7 @@ export class InputFieldDeclarationParser {
6666
// template check:
6767
let useTemplate = isTruthy(templateName) && typeof templateName === 'string';
6868
if (useTemplate) {
69-
const template = InputFieldDeclarationParser.templates.filter(x => x.identifier === templateName).first()?.template;
70-
if (template) {
71-
fullDeclaration.bindTarget = fullDeclaration.bindTarget || template.bindTarget;
72-
fullDeclaration.isBound = fullDeclaration.isBound || template.isBound;
73-
fullDeclaration.inputFieldType =
74-
fullDeclaration.inputFieldType === InputFieldType.INVALID ? template.inputFieldType : fullDeclaration.inputFieldType || template.inputFieldType;
75-
fullDeclaration.argumentContainer = template.argumentContainer.mergeByOverride(fullDeclaration.argumentContainer);
76-
} else {
77-
throw new MetaBindParsingError(`unknown template name \'${templateName}\'`);
78-
}
69+
InputFieldDeclarationParser.applyTemplate(fullDeclaration, templateName);
7970
}
8071

8172
if (fullDeclaration.inputFieldType === InputFieldType.INVALID) {
@@ -156,18 +147,7 @@ export class InputFieldDeclarationParser {
156147
}
157148

158149
if (useTemplate) {
159-
// console.log(templateName);
160-
const template = InputFieldDeclarationParser.templates.filter(x => x.identifier === templateName).first()?.template;
161-
// console.log(template);
162-
if (template) {
163-
inputFieldDeclaration.bindTarget = inputFieldDeclaration.bindTarget || template.bindTarget;
164-
inputFieldDeclaration.isBound = inputFieldDeclaration.isBound || template.isBound;
165-
inputFieldDeclaration.inputFieldType =
166-
inputFieldDeclaration.inputFieldType === InputFieldType.INVALID ? template.inputFieldType : inputFieldDeclaration.inputFieldType || template.inputFieldType;
167-
inputFieldDeclaration.argumentContainer = template.argumentContainer.mergeByOverride(inputFieldDeclaration.argumentContainer);
168-
} else {
169-
throw new MetaBindParsingError(`unknown template name \'${templateName}\'`);
170-
}
150+
InputFieldDeclarationParser.applyTemplate(inputFieldDeclaration, templateName);
171151
}
172152

173153
if (inputFieldDeclaration.inputFieldType === InputFieldType.INVALID) {

0 commit comments

Comments
 (0)