• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / brighterscript / #15215

22 Feb 2026 02:08AM UTC coverage: 87.151% (-0.07%) from 87.225%
#15215

push

web-flow
Merge f6ff8a6fa into 1556715dd

14734 of 17873 branches covered (82.44%)

Branch coverage included in aggregate %.

104 of 115 new or added lines in 19 files covered. (90.43%)

2 existing lines in 1 file now uncovered.

15490 of 16807 relevant lines covered (92.16%)

25562.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.94
/src/types/ComponentType.ts
1
import { SymbolTypeFlag } from '../SymbolTypeFlag';
1✔
2
import { SymbolTable } from '../SymbolTable';
1✔
3
import { isComponentType, isDynamicType, isInvalidType, isObjectType, isReferenceType, isTypeStatementType } from '../astUtils/reflection';
1✔
4
import type { TypeCompatibilityData } from '../interfaces';
5
import type { BscType } from './BscType';
6
import { BscTypeKind } from './BscTypeKind';
1✔
7
import { BuiltInInterfaceAdder } from './BuiltInInterfaceAdder';
1✔
8
import { isUnionTypeCompatible } from './helpers';
1✔
9
import util from '../util';
1✔
10
import { CallFuncableType } from './CallFuncableType';
1✔
11

12
export class ComponentType extends CallFuncableType {
1✔
13

14
    constructor(public name: string, superComponent?: ComponentType) {
214,491✔
15
        super(name, superComponent);
214,491✔
16
    }
17

18
    public readonly kind = BscTypeKind.ComponentType;
214,491✔
19

20
    public get parentComponent() {
21
        return this.parentType as ComponentType;
×
22
    }
23

24
    public isTypeCompatible(targetType: BscType, data?: TypeCompatibilityData) {
25
        while (isTypeStatementType(targetType)) {
193✔
NEW
26
            targetType = targetType.wrappedType;
×
27
        }
28
        if (this.isEqual(targetType)) {
193✔
29
            return true;
183✔
30
        } else if (isInvalidType(targetType) ||
10✔
31
            isDynamicType(targetType) ||
32
            isObjectType(targetType) ||
33
            isUnionTypeCompatible(this, targetType, data)) {
34
            return true;
1✔
35
        } else if (isComponentType(targetType)) {
9!
36
            return this.isTypeDescendent(targetType);
9✔
37
        }
38
        return false;
×
39
    }
40

41
    public static instance = new ComponentType('Node');
1✔
42

43
    isEqual(targetType: BscType, data: TypeCompatibilityData = {}): boolean {
443✔
44
        if (isReferenceType(targetType) && targetType.isResolvable()) {
1,018✔
45
            targetType = targetType.getTarget?.() ?? targetType;
575!
46
        }
47
        if (this === targetType) {
1,018✔
48
            return true;
683✔
49
        }
50
        if (!isComponentType(targetType)) {
335✔
51
            return false;
1✔
52
        }
53

54
        const thisNameLower = this.name.toLowerCase();
334✔
55
        const targetNameLower = targetType.name.toLowerCase();
334✔
56
        if (thisNameLower !== targetNameLower) {
334✔
57
            return false;
320✔
58
        }
59
        if (this.isBuiltIn && targetType.isBuiltIn) {
14✔
60
            return true;
3✔
61
        }
62

63
        if (!this.isParentTypeEqual(targetType, data)) {
11!
64
            return false;
×
65
        }
66
        if (!this.checkCompatibilityBasedOnMembers(targetType, SymbolTypeFlag.runtime, data) ||
11✔
67
            !targetType.checkCompatibilityBasedOnMembers(this, SymbolTypeFlag.runtime, data)) {
68
            return false;
5✔
69
        }
70
        if (!this.checkCompatibilityBasedOnMembers(targetType, SymbolTypeFlag.runtime, data, this.callFuncMemberTable, targetType.callFuncMemberTable) ||
6✔
71
            !targetType.checkCompatibilityBasedOnMembers(this, SymbolTypeFlag.runtime, data, targetType.callFuncMemberTable, this.callFuncMemberTable)) {
72
            return false;
4✔
73
        }
74

75
        return true;
2✔
76
    }
77

78
    public toString() {
79
        return util.getSgNodeTypeName(this.name);
958✔
80
    }
81

82
    private builtInMemberTable: SymbolTable;
83

84
    getBuiltInMemberTable(): SymbolTable {
85
        if (!this.parentType) {
214,489✔
86
            if (this.builtInMemberTable) {
15,477!
87
                return this.builtInMemberTable;
×
88
            }
89
            this.builtInMemberTable = new SymbolTable(`${this.__identifier} Built-in Members`);
15,477✔
90
            this.pushMemberProvider(() => this.builtInMemberTable);
15,477✔
91
            return this.builtInMemberTable;
15,477✔
92
        }
93
    }
94

95
    private hasStartedAddingBuiltInInterfaces = false;
214,491✔
96

97
    addBuiltInInterfaces() {
98
        if (!this.hasAddedBuiltInInterfaces && !this.hasStartedAddingBuiltInInterfaces) {
413,757✔
99
            this.hasStartedAddingBuiltInInterfaces = true;
214,489✔
100
            if (this.parentType) {
214,489✔
101
                this.parentType.addBuiltInInterfaces();
199,012✔
102
            }
103
            BuiltInInterfaceAdder.addBuiltInInterfacesToType(this);
214,489✔
104
        }
105
        this.hasAddedBuiltInInterfaces = true;
413,757✔
106
        this.addBuiltInFields();
413,757✔
107
    }
108

109
    private hasAddedBuiltInFields = false;
214,491✔
110
    private hasStartedAddingBuiltInFields = false;
214,491✔
111

112

113
    addBuiltInFields() {
114
        if (!this.hasAddedBuiltInFields && !this.hasStartedAddingBuiltInFields) {
612,750✔
115
            this.hasStartedAddingBuiltInFields = true;
214,489✔
116
            if (isComponentType(this.parentType)) {
214,489✔
117
                this.parentType.addBuiltInFields();
198,993✔
118
            }
119
            BuiltInInterfaceAdder.addBuiltInFieldsToNodeType(this);
214,489✔
120
        }
121
        this.hasAddedBuiltInFields = true;
612,750✔
122
    }
123
}
124

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc