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

rokucommunity / brighterscript / #13125

01 Oct 2024 02:12PM UTC coverage: 86.842% (-1.4%) from 88.193%
#13125

push

web-flow
Merge d4a9e5fff into 3a2dc7282

11554 of 14068 branches covered (82.13%)

Branch coverage included in aggregate %.

7000 of 7592 new or added lines in 100 files covered. (92.2%)

83 existing lines in 18 files now uncovered.

12701 of 13862 relevant lines covered (91.62%)

29529.09 hits per line

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

92.96
/src/types/ComponentType.ts
1
import type { GetSymbolTypeOptions } from '../SymbolTable';
2
import type { SymbolTypeFlag } from '../SymbolTypeFlag';
3
import { SymbolTable } from '../SymbolTable';
1✔
4
import { isComponentType, isDynamicType, isObjectType } from '../astUtils/reflection';
1✔
5
import type { ExtraSymbolData, TypeCompatibilityData } from '../interfaces';
6
import type { BaseFunctionType } from './BaseFunctionType';
7
import type { BscType } from './BscType';
8
import { BscTypeKind } from './BscTypeKind';
1✔
9
import { BuiltInInterfaceAdder } from './BuiltInInterfaceAdder';
1✔
10
import { InheritableType } from './InheritableType';
1✔
11
import { isUnionTypeCompatible } from './helpers';
1✔
12
import util from '../util';
1✔
13

14
export class ComponentType extends InheritableType {
1✔
15

16
    constructor(public name: string, superComponent?: ComponentType) {
165,698✔
17
        super(name, superComponent);
165,698✔
18
        this.callFuncMemberTable = new SymbolTable(`${this.name}: CallFunc`, () => this.parentComponent?.callFuncMemberTable);
165,698✔
19
    }
20

21
    public readonly kind = BscTypeKind.ComponentType;
165,698✔
22

23
    public get parentComponent() {
24
        return this.parentType as ComponentType;
3✔
25
    }
26

27
    public isTypeCompatible(targetType: BscType, data?: TypeCompatibilityData) {
28
        if (this.isEqual(targetType)) {
29✔
29
            return true;
19✔
30
        } else if (isDynamicType(targetType) ||
10✔
31
            isObjectType(targetType) ||
32
            isUnionTypeCompatible(this, targetType, data)) {
33
            return true;
2✔
34
        } else if (isComponentType(targetType)) {
8!
35
            return this.isTypeDescendent(targetType);
8✔
36
        }
NEW
37
        return false;
×
38
    }
39

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

42
    isEqual(targetType: BscType): boolean {
43
        return isComponentType(targetType) && this.name.toLowerCase() === targetType.name.toLowerCase();
50✔
44
    }
45

46
    public toString() {
47
        return util.getSgNodeTypeName(this.name);
431✔
48
    }
49

50
    private builtInMemberTable: SymbolTable;
51

52
    getBuiltInMemberTable(): SymbolTable {
53
        if (!this.parentType) {
165,696✔
54
            if (this.builtInMemberTable) {
10,455!
NEW
55
                return this.builtInMemberTable;
×
56
            }
57
            this.builtInMemberTable = new SymbolTable(`${this.__identifier} Built-in Members`);
10,455✔
58
            this.pushMemberProvider(() => this.builtInMemberTable);
10,455✔
59
            return this.builtInMemberTable;
10,455✔
60
        }
61
    }
62

63

64
    addBuiltInInterfaces() {
65
        if (!this.hasAddedBuiltInInterfaces) {
321,019✔
66
            if (this.parentType) {
165,696✔
67
                this.parentType.addBuiltInInterfaces();
155,241✔
68
            }
69
            BuiltInInterfaceAdder.addBuiltInInterfacesToType(this);
165,696✔
70
        }
71
        this.hasAddedBuiltInInterfaces = true;
321,019✔
72
        this.addBuiltInFields();
321,019✔
73
    }
74

75
    private hasAddedBuiltInFields = false;
165,698✔
76

77
    addBuiltInFields() {
78
        if (!this.hasAddedBuiltInFields) {
476,241✔
79
            if (isComponentType(this.parentType)) {
165,696✔
80
                this.parentType.addBuiltInFields();
155,222✔
81
            }
82
            BuiltInInterfaceAdder.addBuiltInFieldsToNodeType(this);
165,696✔
83
        }
84
        this.hasAddedBuiltInFields = true;
476,241✔
85
    }
86

87
    public readonly callFuncMemberTable: SymbolTable;
88

89
    addCallFuncMember(name: string, data: ExtraSymbolData, type: BaseFunctionType, flags: SymbolTypeFlag) {
90
        this.callFuncMemberTable.addSymbol(name, data, type, flags);
30✔
91
    }
92

93
    getCallFuncTable() {
NEW
94
        return this.callFuncMemberTable;
×
95
    }
96

97
    getCallFuncType(name: string, options: GetSymbolTypeOptions) {
98
        return this.callFuncMemberTable.getSymbolType(name, options);
4✔
99
    }
100
}
101

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