crypto
crypto copied to clipboard
Issue with uninitialised variable
This test:
m.it("Array has ifArray interface", sub()
' a = []
m.assert.notEqual(GetInterface(a, "ifArray"), invalid, "Object doesn't have ifArray interface")
end sub)
fails with a JS runtime error (multiple times):
Runtime error encountered in BRS implementation: TypeError: Cannot read property 'get' of undefined
at impl (/path/to/project/node_modules/brs/lib/stdlib/GlobalUtilities.js:28:34)
at interpreter.inSubEnv.subInterpreter (/path/to/project/node_modules/brs/lib/brsTypes/Callable.js:107:20)
at Interpreter.inSubEnv (/path/to/project/node_modules/brs/lib/interpreter/index.js:138:20)
at Callable.call (/path/to/project/node_modules/brs/lib/brsTypes/Callable.js:97:28)
at inSubEnv.subInterpreter (/path/to/project/node_modules/brs/lib/interpreter/index.js:812:35)
at Interpreter.inSubEnv (/path/to/project/node_modules/brs/lib/interpreter/index.js:138:20)
at Interpreter.visitCall (/path/to/project/node_modules/brs/lib/interpreter/index.js:810:29)
at Call.accept (/path/to/project/node_modules/brs/lib/parser/Expression.js:29:24)
at Interpreter.evaluate (/path/to/project/node_modules/brs/lib/interpreter/index.js:1231:27)
at Array.map (<anonymous>)
Hey @elsassph what is the expected behavior here? On a real Roku device this would crash with a type mismatch because a
is not initialized.

There would be a type mismatch error if the function has a as type
incompatible with "uninitialized"