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

rokucommunity / brighterscript / #13117

01 Oct 2024 08:24AM UTC coverage: 86.842% (-1.4%) from 88.193%
#13117

push

web-flow
Merge abd960cd5 into 3a2dc7282

11537 of 14048 branches covered (82.13%)

Branch coverage included in aggregate %.

6991 of 7582 new or added lines in 100 files covered. (92.21%)

83 existing lines in 18 files now uncovered.

12692 of 13852 relevant lines covered (91.63%)

29478.96 hits per line

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

72.41
/src/FunctionScope.ts
1
import type { LabelDeclaration, VariableDeclaration } from './interfaces';
2
import type { FunctionExpression } from './parser/Expression';
3

4
//TODO I think this class can be eliminated in favor of moving some of these onto the FunctionExpression AST node
5
export class FunctionScope {
1✔
6
    constructor(
7
        public func: FunctionExpression
97✔
8
    ) {
9
    }
10

11
    /**
12
     * The full range of this function. Starts at the position of the `f` in function or `s` in sub,
13
     * and ends after the final `n` in `end function` or `b` in end sub.
14
     */
15
    public get range() {
16
        return this.func?.location?.range;
102!
17
    }
18
    /**
19
     * The scopes that are children of this scope
20
     */
21
    public childrenScopes = [] as FunctionScope[];
97✔
22
    /**
23
     * The parent scope of this scope
24
     */
25
    public parentScope: FunctionScope | undefined;
26
    public variableDeclarations = [] as VariableDeclaration[];
97✔
27
    public labelStatements = [] as LabelDeclaration[];
97✔
28

29
    /**
30
     * Find all variable declarations above the given line index
31
     * @param lineIndex the 0-based line number
32
     */
33
    public getVariablesAbove(lineIndex: number) {
34
        let results = [] as VariableDeclaration[];
5✔
35
        for (let variableDeclaration of this.variableDeclarations) {
5✔
36
            if (variableDeclaration.lineIndex < lineIndex) {
8✔
37
                results.push(variableDeclaration);
4✔
38
            } else {
39
                break;
4✔
40
            }
41
        }
42
        return results;
5✔
43
    }
44

45
    public getVariableByName(name: string) {
UNCOV
46
        name = name.toLowerCase();
×
UNCOV
47
        for (let variableDeclaration of this.variableDeclarations) {
×
UNCOV
48
            if (variableDeclaration.name.toLowerCase() === name) {
×
UNCOV
49
                return variableDeclaration;
×
50
            }
51
        }
52
    }
53

54
    get symbolTable() {
55
        return this.func.body.getSymbolTable();
37✔
56
    }
57
}
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