Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 13181x 13181x 1x 1x 290x 290x 49x 49x 241x 241x 290x 24x 24x 24x 241x 241x 241x 241x 241x 290x 27x 9x 9x 18x 18x 18x 18x 241x 241x 1x 1x 1912x 26x 26x 26x 25x 25x 7x 7x 25x 26x 1912x 1912x 307x 307x 306x 306x 307x 1912x 1x 1x 1912x 26x 26x 26x 25x 25x 4x 4x 25x 26x 1912x 1912x 307x 307x 306x 306x 307x 1912x 1x 1x 77x 77x 77x 77x 74x 74x 73x 73x 1x 1x 3x 3x 1x 1x 234x 234x 234x 16x 14x 14x 14x 13x 13x 14x 16x 221x 221x 1x 1x 576x 576x 50x 50x 50x 50x 50x 526x 576x 576x 576x 576x 1x 1x 1609x 1609x 1609x 1609x 1609x 1609x 1x 1x 3290x 3290x 3290x 181x 181x 177x 177x 181x 3290x 3290x 3290x 91x 91x 91x 91x 3290x 3290x 3290x 1x 1x 1x 1x 1x 621x 621x 621x 621x 621x 621x 568x 621x 53x 53x 621x 621x 27x 27x 26x 26x 26x 621x 621x 30x 30x 10x 10x 20x 30x 30x 16x 621x 7x 7x 7x 5x 5x 5x 5x 5x 2x 2x 9x 9x 9x 1x 1x 1x 560x 560x 560x 560x 560x 560x 553x 553x 7x 560x 1x 1x 6x 6x 1x 1x 1x 1x 29x 29x 29x 29x 29x 29x 29x 21x 21x 8x 8x 8x 29x 29x 1x 1x 7x 7x 29x 2x 2x 5x 5x 1x 1x 1x 106x 106x 106x 106x 106x 106x 94x 94x 94x 94x 83x 83x 11x 94x 94x 23x 23x 1x 1x 35x 35x 35x 35x 35x 11x 11x 24x 24x 35x 24x 35x 2x 2x 22x 22x 35x 12x 2x 2x 12x 12x 20x 20x 20x 1x 1x 28x 28x 28x 28x 14x 14x 14x 14x 28x 12x 12x 2x 28x 1x 1x 1x 1x 1x 28x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 166x 166x 166x 166x 166x 166x 166x 166x 165x 185x 108x 108x 185x 57x 58x 166x 4x 4x 4x 4x 2x 2x 4x 4x 56x 166x 7x 7x 7x 7x 7x 49x 49x 166x 5x 5x 44x 44x 44x 1x 1x 1x 79x 79x 79x 79x 79x 79x 79x 76x 76x 3x 79x 1x 1x 1x 1x 1x 1x 1x 1x 2x 79x 2x 2x 79x 1x 1x 1x 1x 1x 1x 1x 1x 51x 51x 51x 51x 51x 51x 51x 22x 22x 22x 22x 29x 51x 2x 2x 2x 2x 1x 1x 2x 2x 28x 51x 2x 2x 2x 2x 2x 26x 26x 51x 26x 26x 26x 1x 1x 1x 4109x 4109x 4109x 4109x 187x 187x 3922x 3922x 4109x 3625x 3625x 297x 297x 4109x 64x 64x 1x 1x 64x 296x 296x 4109x 63x 63x 63x 61x 61x 4109x 233x 233x 12x 12x 233x 223x 223x 4109x 52x 52x 171x 171x 171x 1x 1x 3953x 3953x 1x 1x 3952x 3952x 3953x 296x 296x 3656x 3953x 31x 31x 3625x 3625x 3625x 1x 1x 31x 31x 31x 31x 31x 19x 19x 12x 12x 12x 12x 1x 1x 1100x 1100x 98x 98x 1002x 1002x 1x 1x 3864x 3864x 3864x 1x 1x 1x 3864x 3864x 3864x 3864x 916x 916x 42x 32x 32x 32x 42x 916x 6x 2x 2x 6x 916x 26x 24x 24x 26x 820x 820x 820x 3768x 3768x 3768x 1x 1x 1x 16x 16x 9x 9x 9x 9x 9x 9x 9x 9x 16x 16x 16x 1x 1x 4938x 4938x 272x 272x 4938x 4938x 1x 1x | import * as Statements from "../2_statements/statements";
import * as Expressions from "../2_statements/expressions";
import {StatementNode} from "../nodes";
import {CurrentScope} from "./_current_scope";
import {IClassDefinition} from "../types/_class_definition";
import {IMethodDefinition} from "../types/_method_definition";
import {IInterfaceDefinition} from "../types/_interface_definition";
import {ClassAttribute} from "../types/class_attribute";
import {ClassConstant} from "../types/class_constant";
import {IEventDefinition} from "../types/_event_definition";
import {TypedIdentifier} from "../types/_typed_identifier";
import {Visibility} from "../4_file_information/visibility";
import {IReferenceExtras} from "./_reference";
import {ClassDefinition} from "../types";
// todo, think some of the public methods can be made private
// todo: changet this class to static? for performance
export class ObjectOriented {
private readonly scope: CurrentScope;
public constructor(scope: CurrentScope) {
this.scope = scope;
}
private fromInterfaceByName(name: string, ignore: string[]): string[] {
const idef = this.scope.findInterfaceDefinition(name);
if (idef === undefined || ignore.includes(name.toUpperCase())) {
return [];
}
const ret: string[] = [name.toUpperCase()];
for (const t of idef.getTypeDefinitions().getAll()) {
const n = name + "~" + t.type.getName();
this.scope.addTypeNamed(n, t.type);
}
this.scope.addListPrefix(idef.getAttributes().getConstants(), name + "~");
this.scope.addListPrefix(idef.getAttributes().getStatic(), name + "~");
this.scope.addListPrefix(idef.getAttributes().getInstance(), name + "~");
for (const i of idef.getImplementing()) {
if (ignore.includes(i.name.toUpperCase())) {
continue;
}
ret.push(...this.fromInterfaceByName(i.name, ignore));
ignore.push(i.name.toUpperCase());
ret.push(i.name.toUpperCase());
}
return ret;
}
public addAliasedAttributes(classDefinition: IClassDefinition): void {
for (const alias of classDefinition.getAliases() || []) {
const comp = alias.getComponent();
const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
if (idef) {
const found = idef.getAttributes()!.findByName(comp.split("~")[1]);
if (found) {
this.scope.addNamedIdentifier(alias.getName(), found);
}
}
}
const superName = classDefinition.getSuperClass();
if (superName !== undefined) {
const def = this.scope.findClassDefinition(superName);
if (def) {
this.addAliasedAttributes(def);
}
}
}
public addAliasedTypes(classDefinition: IClassDefinition): void {
for (const alias of classDefinition.getAliases() || []) {
const comp = alias.getComponent();
const idef = this.scope.findInterfaceDefinition(comp.split("~")[0]);
if (idef) {
const found = idef.getTypeDefinitions()!.getByName(comp.split("~")[1]);
if (found) {
this.scope.addType(found);
}
}
}
const superName = classDefinition.getSuperClass();
if (superName !== undefined) {
const def = this.scope.findClassDefinition(superName);
if (def) {
this.addAliasedTypes(def);
}
}
}
private findMethodInInterface(interfaceName: string, methodName: string):
{method: IMethodDefinition, def: IInterfaceDefinition} | undefined {
const idef = this.scope.findInterfaceDefinition(interfaceName);
if (idef) {
const method = idef.getMethodDefinitions().getByName(methodName);
if (method) {
return {method, def: idef};
}
return this.findMethodViaAlias(methodName, idef);
}
return undefined;
}
private findMethodViaAlias(methodName: string, def: IClassDefinition | IInterfaceDefinition):
{method: IMethodDefinition, def: IInterfaceDefinition} | undefined {
for (const a of def.getAliases() || []) {
if (a.getName().toUpperCase() === methodName.toUpperCase()) {
const comp = a.getComponent();
const res = this.findMethodInInterface(comp.split("~")[0], comp.split("~")[1]);
if (res) {
return res;
}
}
}
return undefined;
}
public methodReferenceExtras(foundDef: IInterfaceDefinition | IClassDefinition | undefined,
ooName: string | undefined): IReferenceExtras {
if (foundDef === undefined) {
return {
ooName: ooName,
ooType: undefined,
};
}
return {
ooName: foundDef?.getName(),
ooType: foundDef instanceof ClassDefinition ? "CLAS" : "INTF",
};
}
public findClassName(node: StatementNode): string {
if (!(node.get() instanceof Statements.ClassImplementation
|| node.get() instanceof Statements.ClassDefinition)) {
throw new Error("findClassName, unexpected node type");
}
const className = node.findFirstExpression(Expressions.ClassName);
if (className === undefined) {
throw new Error("findClassName, unexpected node type");
}
return className.getFirstToken().getStr();
}
public findInterfaces(cd: IClassDefinition | IInterfaceDefinition): readonly {name: string, partial: boolean}[] {
const ret = [...cd.getImplementing()];
for (const r of ret) {
const nested = this.scope.findInterfaceDefinition(r.name)?.getImplementing();
if (nested) {
ret.push(...nested);
}
}
const sup = cd.getSuperClass();
if (sup) {
try {
ret.push(...this.findInterfaces(this.findSuperDefinition(sup)));
} catch {
// ignore errors, they will show up as variable not found anyhow
}
}
return ret;
}
// does the supplied class have friendship with "friendName"?
// note that interfaces of the friend, and subclasses of the friend also have friendship
// returns the visibility as text if a member declared in foundDef, reached via def, cannot be accessed from enclosing
public memberNotVisible(
visibility: Visibility,
def: IClassDefinition | IInterfaceDefinition | undefined,
foundDef: IClassDefinition | IInterfaceDefinition | undefined,
enclosing: string | undefined): string | undefined {
if (visibility === Visibility.Public || foundDef === undefined) {
return undefined;
} else if (!(foundDef instanceof ClassDefinition)) {
// interface members are always public
return undefined;
}
const name = foundDef.getName().toUpperCase();
enclosing = enclosing?.toUpperCase();
if (enclosing === undefined || enclosing === name) {
return undefined;
}
// friendship with the class used at the call site also gives access to inherited members
const visited: string[] = [];
let current: IClassDefinition | undefined = def instanceof ClassDefinition ? def : foundDef;
while (current !== undefined && visited.includes(current.getName().toUpperCase()) === false) {
visited.push(current.getName().toUpperCase());
if (this.hasFriendship(current, enclosing)) {
return undefined;
}
const sup: string | undefined = current.getSuperClass();
current = sup === undefined ? undefined : this.scope.findClassDefinition(sup);
}
if (visibility === Visibility.Protected) {
// subclasses can access protected members
let sup = this.scope.findClassDefinition(enclosing)?.getSuperClass();
while (sup !== undefined) {
if (sup.toUpperCase() === name) {
return undefined;
}
sup = this.scope.findClassDefinition(sup)?.getSuperClass();
}
return "protected";
}
return "private";
}
// the fixture methods of a test class are called by ABAP Unit only, returns the message otherwise
public checkSpecialTestMethodCall(
method: IMethodDefinition | undefined,
foundDef: IClassDefinition | IInterfaceDefinition | undefined): string | undefined {
if (method === undefined
|| !(foundDef instanceof ClassDefinition)
|| foundDef.isForTesting() === false) {
return undefined;
}
const name = method.getName().toUpperCase();
if (["SETUP", "TEARDOWN", "CLASS_SETUP", "CLASS_TEARDOWN"].includes(name) === false) {
return undefined;
}
return `The special method "${name}" cannot be called directly`;
}
// SUPER-> can only call the previous implementation of the method it is used in, returns the message otherwise
// both names are resolved in the super class, so an alias and the method it stands for are the same
public checkSuperCall(
superDef: IClassDefinition | IInterfaceDefinition | undefined,
methodName: string | undefined): string | undefined {
const enclosing = this.scope.getEnclosingMethodName();
if (methodName === undefined
|| enclosing === undefined
|| methodName.toUpperCase() === enclosing.toUpperCase()) {
return undefined;
}
const message = "SUPER-> can only be used to call the previous implementation of the same method";
// a method that is not a redefinition has no previous implementation
const enclosingClass = this.scope.findClassDefinition(this.scope.getEnclosingClassName());
const ownDefinition = enclosingClass?.getMethodDefinitions().getByName(enclosing);
if (ownDefinition !== undefined && ownDefinition.isRedefinition() === false) {
return message;
}
const called = this.searchMethodName(superDef, methodName).method;
const own = this.searchMethodName(superDef, enclosing).method;
if (called === undefined || own === undefined || called === own) {
return undefined;
}
return message;
}
// the class declaring the attribute or constant, searched from def up through the super classes
public findAttributeOwner(
def: IClassDefinition | IInterfaceDefinition | undefined,
found: ClassAttribute | ClassConstant): IClassDefinition | undefined {
const visited: string[] = [];
let current: IClassDefinition | IInterfaceDefinition | undefined = def;
while (current instanceof ClassDefinition && visited.includes(current.getName().toUpperCase()) === false) {
visited.push(current.getName().toUpperCase());
const attributes = current.getAttributes();
if (attributes.getAll().includes(found as ClassAttribute)
|| attributes.getConstants().includes(found as ClassConstant)) {
return current;
}
const sup: string | undefined = current.getSuperClass();
current = sup === undefined ? undefined : this.findSuperDefinition(sup);
}
return undefined;
}
public hasFriendship(cd: IClassDefinition, friendName: string): boolean {
const friends = cd.getFriends().map(f => f.toUpperCase());
const isFriend = (name: string) =>
friends.includes(name.toUpperCase()) || this.scope.isLocalFriend(cd.getName(), name);
if (isFriend(friendName)) {
return true;
}
const friendDefinition = this.scope.findClassDefinition(friendName);
if (friendDefinition === undefined) {
return false;
}
if (this.findInterfaces(friendDefinition).some(i => friends.includes(i.name.toUpperCase()))) {
return true;
}
let sup = friendDefinition.getSuperClass();
while (sup !== undefined) {
if (isFriend(sup)) {
return true;
}
sup = this.scope.findClassDefinition(sup)?.getSuperClass();
}
return false;
}
public searchEvent(
def: IClassDefinition | IInterfaceDefinition | undefined,
name: string | undefined): IEventDefinition | undefined {
if (def === undefined || name === undefined) {
return undefined;
}
const found = def.getEvents().find(e => e.getName().toUpperCase() === name?.toUpperCase());
if (found) {
return found;
}
if (name.includes("~")) {
// event of an implemented interface, ie. "if_name~event_name"
const [interfaceName, eventName] = name.split("~");
return this.searchEvent(this.scope.findInterfaceDefinition(interfaceName), eventName);
}
for (const a of def.getAliases() || []) {
if (a.getName().toUpperCase() === name.toUpperCase()) {
const comp = a.getComponent();
const res = this.searchEvent(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
if (res) {
return res;
}
}
}
const sup = def.getSuperClass();
if (sup) {
return this.searchEvent(this.findSuperDefinition(sup), name);
}
return undefined;
}
// search in via super class, interfaces and aliases
public searchAttributeName(
def: IClassDefinition | IInterfaceDefinition | undefined,
name: string | undefined): ClassAttribute | undefined {
if (def === undefined || name === undefined) {
return undefined;
}
const upper = name.toUpperCase();
const attr = def.getAttributes();
if (attr) {
for (const a of attr.getAll()) {
if (a.getName().toUpperCase() === upper) {
return a;
}
}
}
for (const a of def.getAliases() || []) {
if (a.getName().toUpperCase() === upper) {
const comp = a.getComponent();
const res = this.searchAttributeName(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
if (res) {
return res;
}
}
}
if (name.includes("~")) {
const interfaceName = upper.split("~")[0];
if (this.listInterfacesRecursive(def).includes(interfaceName)) {
return this.searchAttributeName(this.scope.findInterfaceDefinition(interfaceName), name.split("~")[1]);
}
}
const sup = def.getSuperClass();
if (sup) {
return this.searchAttributeName(this.findSuperDefinition(sup), name);
}
return undefined;
}
// search in via super class, interfaces and aliases
public searchTypeName(
def: IClassDefinition | IInterfaceDefinition | undefined,
name: string | undefined): TypedIdentifier | undefined {
if (def === undefined || name === undefined) {
return undefined;
}
const search = def.getTypeDefinitions().getByName(name);
if (search) {
return search;
}
for (const a of def.getAliases()) {
if (a.getName().toUpperCase() === name.toUpperCase()) {
const comp = a.getComponent();
const res = this.searchTypeName(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
if (res) {
return res;
}
}
}
if (name.includes("~")) {
const interfaceName = name.split("~")[0];
if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName.toUpperCase())) {
return this.searchTypeName(this.scope.findInterfaceDefinition(interfaceName), name.split("~")[1]);
}
}
const sup = def.getSuperClass();
if (sup) {
return this.searchTypeName(this.findSuperDefinition(sup), name);
}
return undefined;
}
// search in via super class, interfaces and aliases
public searchConstantName(
def: IClassDefinition | IInterfaceDefinition | undefined,
name: string | undefined): ClassConstant | undefined {
if (def === undefined || name === undefined) {
return undefined;
}
const upper = name.toUpperCase();
for (const a of def.getAttributes().getConstants()) {
if (a.getName().toUpperCase() === upper) {
return a;
}
}
for (const a of def.getAliases()) {
if (a.getName().toUpperCase() === upper) {
const comp = a.getComponent();
const res = this.searchConstantName(this.scope.findObjectDefinition(comp.split("~")[0]), comp.split("~")[1]);
if (res) {
return res;
}
}
}
if (name.includes("~")) {
const interfaceName = upper.split("~")[0];
if (def.getImplementing().some((a) => a.name.toUpperCase() === interfaceName)) {
return this.searchConstantName(this.scope.findInterfaceDefinition(interfaceName), name.split("~")[1]);
}
}
const sup = def.getSuperClass();
if (sup) {
return this.searchConstantName(this.findSuperDefinition(sup), name);
}
return undefined;
}
// search in via super class, interfaces and aliases
public searchMethodName(
def: IClassDefinition | IInterfaceDefinition | undefined,
name: string | undefined): {method: IMethodDefinition | undefined, def: IClassDefinition | IInterfaceDefinition | undefined} {
if (def === undefined || name === undefined) {
return {method: undefined, def: undefined};
}
const methodDefinition = this.findMethod(def, name);
if (methodDefinition) {
return {method: methodDefinition, def};
}
let interfaceName: string | undefined = undefined;
if (name.includes("~")) {
interfaceName = name.split("~")[0];
if (interfaceName && this.findInterfaces(def).some(i => i.name.toUpperCase() === interfaceName?.toUpperCase()) === false) {
return {method: undefined, def: undefined};
}
}
// todo, this is not completely correct? hmm, why? visibility?
if (methodDefinition === undefined && interfaceName) {
name = name.split("~")[1];
const found = this.findMethodInInterface(interfaceName, name);
if (found) {
return found;
}
} else if (methodDefinition === undefined) {
const found = this.findMethodViaAlias(name, def);
if (found) {
return found;
}
}
const sup = def.getSuperClass();
if (methodDefinition === undefined && sup) {
return this.searchMethodName(this.findSuperDefinition(sup), name);
}
return {method: undefined, def: undefined};
}
public findMethod(def: IClassDefinition | IInterfaceDefinition, methodName: string): IMethodDefinition | undefined {
const defs = def.getMethodDefinitions();
if (defs === undefined) {
return undefined;
}
const method = defs.getByName(methodName);
if (method === undefined) {
return undefined;
}
if (method.isRedefinition()) {
return this.findMethodInSuper(def, methodName);
}
return method;
}
private findMethodInSuper(child: IClassDefinition | IInterfaceDefinition, methodName: string): IMethodDefinition | undefined {
let sup = child.getSuperClass();
while (sup !== undefined) {
const cdef = this.findSuperDefinition(sup);
const found = this.findMethod(cdef, methodName);
if (found) {
return found;
}
sup = cdef.getSuperClass();
}
return undefined;
}
private findSuperDefinition(name: string): IClassDefinition {
const csup = this.scope.findClassDefinition(name);
if (csup === undefined) {
throw new Error("Super class \"" + name + "\" not found or contains errors");
}
return csup;
}
public fromSuperClassesAndInterfaces(child: IClassDefinition) {
const implemented = this.fromSuperClasses(child);
this.fromInterfaces(child, implemented);
}
// returns list of interfaces implemented
private fromSuperClasses(child: IClassDefinition): string[] {
let sup = child.getSuperClass();
const ignore: string[] = [];
while (sup !== undefined) {
const cdef = this.findSuperDefinition(sup);
for (const a of cdef.getAttributes().getAll()) {
if (a.getVisibility() !== Visibility.Private) {
this.scope.addIdentifier(a);
// todo, handle scope and instance vs static
}
}
for (const c of cdef.getAttributes().getConstants()) {
if (c.getVisibility() !== Visibility.Private) {
this.scope.addIdentifier(c);
}
}
for (const t of cdef.getTypeDefinitions().getAll()) {
if (t.visibility !== Visibility.Private) {
this.scope.addType(t.type);
}
}
ignore.push(...this.fromInterfaces(cdef, ignore));
sup = cdef.getSuperClass();
}
return ignore;
}
/** returns list of interfaces implemented, recursive */
public listInterfacesRecursive(definition: IInterfaceDefinition): string[] {
const list: string[] = [];
for (const i of definition.getImplementing()) {
const upper = i.name.toUpperCase();
list.push(upper);
const def = this.scope.findInterfaceDefinition(upper);
if (def) {
list.push(...this.listInterfacesRecursive(def));
}
}
return [...new Set(list)];
}
public fromInterfaces(definition: IInterfaceDefinition, skip?: string[]): string[] {
const ignore: string[] = [];
for (const i of definition.getImplementing()) {
ignore.push(...this.fromInterfaceByName(i.name, ignore.concat(skip || [])));
}
return ignore;
}
}
|