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

rokucommunity / brs / #213

27 Jan 2025 05:30PM UTC coverage: 86.996% (-2.2%) from 89.205%
#213

push

web-flow
Implemented several improvements to SceneGraph (#87)

* Implemented several improvements to SceneGraph

* Fixed most test cases

* Reduced unnecessary code

* Fixed typo

* Added Warning when trying to create a non-existent Node

* Fixed parser

* Fixed unit tests

* Implemented support for `infoFields`

* Prettier fix

* Simplified execute callback code and matched behavior with Roku

* Adding comment to clarify the exception

2240 of 2807 branches covered (79.8%)

Branch coverage included in aggregate %.

139 of 304 new or added lines in 18 files covered. (45.72%)

2 existing lines in 1 file now uncovered.

6129 of 6813 relevant lines covered (89.96%)

27562.41 hits per line

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

76.92
/src/stdlib/index.ts
1
import {
135✔
2
    Callable,
3
    ValueKind,
4
    RoAssociativeArray,
5
    StdlibArgument,
6
    BrsType,
7
    Int32,
8
    RoMessagePort,
9
    BrsInvalid,
10
} from "../brsTypes";
11
import { isBoxable } from "../brsTypes/Boxing";
135✔
12
import {} from "../brsTypes/components/RoMessagePort";
13
import { Interpreter } from "../interpreter";
14

15
/**
16
 * Returns an object version of an intrinsic type, or pass through an object if given one.
17
 */
18
export const Box = new Callable("Box", {
135✔
19
    signature: {
20
        args: [new StdlibArgument("value", ValueKind.Dynamic)],
21
        returns: ValueKind.Object,
22
    },
23
    impl: (_: Interpreter, value: BrsType) => {
24
        if (isBoxable(value)) {
10✔
25
            return value.box();
10✔
26
        }
27
        return value;
×
28
    },
29
});
30

31
/**
32
 * Returns global M pointer (the m from the root Environment).
33
 */
34
export const GetGlobalAA = new Callable("GetGlobalAA", {
135✔
35
    signature: {
36
        args: [],
37
        returns: ValueKind.Dynamic,
38
    },
39
    impl: (interpreter: Interpreter): RoAssociativeArray => {
40
        return interpreter.environment.getRootM();
2✔
41
    },
42
});
43

44
/**
45
 * This function causes the script to pause for the specified time in milliseconds.
46
 */
47
export const Sleep = new Callable("Sleep", {
135✔
48
    signature: {
49
        args: [new StdlibArgument("timeout", ValueKind.Int32)],
50
        returns: ValueKind.Void,
51
    },
52
    impl: (_: Interpreter, timeout: Int32) => {
NEW
53
        let ms = timeout.getValue();
×
NEW
54
        ms += performance.now();
×
NEW
55
        while (performance.now() < ms) {}
×
NEW
56
        return BrsInvalid.Instance;
×
57
    },
58
});
59

60
/** Waits until an event object is available or timeout milliseconds have passed. */
61
export const Wait = new Callable("Wait", {
135✔
62
    signature: {
63
        args: [
64
            new StdlibArgument("timeout", ValueKind.Int32),
65
            new StdlibArgument("port", ValueKind.Object),
66
        ],
67
        returns: ValueKind.Dynamic,
68
    },
69
    impl: (interpreter: Interpreter, timeout: Int32, port: RoMessagePort) => {
NEW
70
        return port.wait(interpreter, timeout.getValue());
×
71
    },
72
});
73

74
export * from "./GlobalUtilities";
135✔
75
export * from "./CreateObject";
135✔
76
export * from "./File";
135✔
77
export * from "./Json";
135✔
78
export * from "./Localization";
135✔
79
export * from "./Math";
135✔
80
export * from "./Print";
135✔
81
export { Run } from "./Run";
992✔
82
export * from "./String";
135✔
83
export * from "./Type";
135✔
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