ui5plugin-parser
Version:
33 lines (32 loc) • 1.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InterfaceMemberStrategy = void 0;
const CustomJSClass_1 = require("../../ui5class/js/CustomJSClass");
const FieldPropertyMethodGetterStrategy_1 = require("./abstraction/FieldPropertyMethodGetterStrategy");
class InterfaceMemberStrategy extends FieldPropertyMethodGetterStrategy_1.FieldPropertyMethodGetterStrategy {
getFieldsAndMethods(document, position) {
let fieldsAndMethods;
const className = this.parser.fileReader.getClassNameFromPath(document.fileName);
if (className) {
const UIClass = this.parser.classFactory.getUIClass(className);
if (UIClass instanceof CustomJSClass_1.CustomJSClass && UIClass.interfaces.length) {
const positionAtClassBodyPropertyName = this.parser.reusableMethods.getIfPositionIsInPropertyName(UIClass, position);
if (positionAtClassBodyPropertyName) {
const fields = UIClass.interfaces.flatMap(theInterface => this.parser.classFactory.getClassFields(theInterface, false));
const methods = UIClass.interfaces.flatMap(theInterface => this.parser.classFactory.getClassMethods(theInterface, false));
fieldsAndMethods = {
className: "__interface__",
fields: fields,
methods: methods
};
this._filterFieldsAndMethodsAccordingToAccessLevelModifiers(fieldsAndMethods, [
"public",
"protected"
]);
}
}
}
return fieldsAndMethods;
}
}
exports.InterfaceMemberStrategy = InterfaceMemberStrategy;