Skip to content

Commit 1a726b0

Browse files
committed
comments fixes part 2
1 parent 5e03f1f commit 1a726b0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/parsers/InputFieldDeclarationParser.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,4 +253,16 @@ export class InputFieldDeclarationParser {
253253

254254
return InputFieldType.INVALID;
255255
}
256+
257+
static applyTemplate(fullDeclaration: InputFieldDeclaration, templateName: string | null | undefined) {
258+
const template = InputFieldDeclarationParser.templates.filter(x => x.identifier === templateName).first()?.template;
259+
if (template) {
260+
fullDeclaration.bindTarget = fullDeclaration.bindTarget || template.bindTarget;
261+
fullDeclaration.isBound = fullDeclaration.isBound || template.isBound;
262+
fullDeclaration.inputFieldType = fullDeclaration.inputFieldType === InputFieldType.INVALID ? template.inputFieldType : fullDeclaration.inputFieldType || template.inputFieldType;
263+
fullDeclaration.argumentContainer = template.argumentContainer.mergeByOverride(fullDeclaration.argumentContainer);
264+
} else {
265+
throw new MetaBindParsingError(`unknown template name \'${templateName}\'`);
266+
}
267+
}
256268
}

0 commit comments

Comments
 (0)