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

FontoXML / fontoxpath / 10652762231

01 Sep 2024 09:15AM UTC coverage: 91.567%. Remained the same
10652762231

Pull #648

github

web-flow
Bump karma from 6.4.2 to 6.4.4

Bumps [karma](https://github.com/karma-runner/karma) from 6.4.2 to 6.4.4.
- [Release notes](https://github.com/karma-runner/karma/releases)
- [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md)
- [Commits](https://github.com/karma-runner/karma/compare/v6.4.2...v6.4.4)

---
updated-dependencies:
- dependency-name: karma
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #648: Bump karma from 6.4.2 to 6.4.4

5002 of 5811 branches covered (86.08%)

Branch coverage included in aggregate %.

10775 of 11419 relevant lines covered (94.36%)

96665.35 hits per line

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

65.79
/src/typeInference/AnnotationContext.ts
1
import { SequenceType } from '../expressions/dataTypes/Value';
2
import StaticContext from '../expressions/StaticContext';
3

4
export class AnnotationContext {
15✔
5
        public staticContext?: StaticContext;
6

7
        private _namespaceScope: { [prefix: string]: string }[];
8
        private _scopeIndex: number = 0;
16,189✔
9
        private _variableScope: { [key: string]: SequenceType }[];
10

11
        constructor(staticContext?: StaticContext) {
12
                this.staticContext = staticContext;
16,189✔
13
                this._variableScope = [{}];
16,189✔
14
                this._namespaceScope = [{}];
16,189✔
15
        }
16

17
        public getVariable(varName: string): SequenceType {
18
                for (let i = this._scopeIndex; i >= 0; i--) {
18,333✔
19
                        const variableType = this._variableScope[i][varName];
28,668✔
20
                        if (variableType) {
28,668✔
21
                                return variableType;
6,123✔
22
                        }
23
                }
24
                // The variable is not found, indicate this to the caller by returning undefined.
25
                return undefined;
12,210✔
26
        }
27

28
        public insertVariable(varName: string, varType: SequenceType): void {
29
                if (this._variableScope[this._scopeIndex][varName]) {
5,487!
30
                        // TODO: change the error being thrown in here to adhere the "error code" code.
31
                        throw new Error(
×
32
                                `Another variable of in the scope ${this._scopeIndex} with the same name ${varName} already exists`,
33
                        );
34
                }
35

36
                this._variableScope[this._scopeIndex][varName] = varType;
5,487✔
37
        }
38

39
        public popScope(): void {
40
                if (this._scopeIndex > 0) {
×
41
                        this._scopeIndex--;
×
42
                        this._variableScope.pop();
×
43
                        this._namespaceScope.pop();
×
44
                        return;
×
45
                }
46

47
                throw new Error('Variable scope out of bound');
×
48
        }
49

50
        public pushScope(): void {
51
                this._scopeIndex++;
5,883✔
52
                this._variableScope.push({});
5,883✔
53
                this._namespaceScope.push({});
5,883✔
54
        }
55

56
        public registerNamespace(prefix: string, uri: string | null) {
57
                this._namespaceScope[this._scopeIndex][prefix] = uri;
×
58
        }
59

60
        public resolveNamespace(prefix: string): string | null {
61
                for (let i = this._scopeIndex; i >= 0; i--) {
36,663✔
62
                        const namespaceURI = this._namespaceScope[i][prefix];
66,258✔
63
                        if (namespaceURI !== undefined) {
66,258!
64
                                return namespaceURI;
×
65
                        }
66
                }
67
                // The namespace is not found. Look it up using the static context if we have it
68
                return this.staticContext ? this.staticContext.resolveNamespace(prefix) : undefined;
36,663✔
69
        }
70
}
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

© 2025 Coveralls, Inc