@@ -16,7 +16,7 @@ export const UCase = new Callable("UCase", {
16
16
args : [ new StdlibArgument ( "s" , ValueKind . String ) ] ,
17
17
returns : ValueKind . String ,
18
18
} ,
19
- impl : ( interpreter : Interpreter , s : BrsString ) => new BrsString ( s . value . toUpperCase ( ) ) ,
19
+ impl : ( _ : Interpreter , s : BrsString ) => new BrsString ( s . value . toUpperCase ( ) ) ,
20
20
} ) ;
21
21
22
22
/** Converts the string to all lowercase. */
@@ -25,7 +25,7 @@ export const LCase = new Callable("LCase", {
25
25
args : [ new StdlibArgument ( "s" , ValueKind . String ) ] ,
26
26
returns : ValueKind . String ,
27
27
} ,
28
- impl : ( interpreter : Interpreter , s : BrsString ) => new BrsString ( s . value . toLowerCase ( ) ) ,
28
+ impl : ( _ : Interpreter , s : BrsString ) => new BrsString ( s . value . toLowerCase ( ) ) ,
29
29
} ) ;
30
30
31
31
/**
@@ -37,7 +37,7 @@ export const Asc = new Callable("Asc", {
37
37
args : [ new StdlibArgument ( "letter" , ValueKind . String ) ] ,
38
38
returns : ValueKind . String ,
39
39
} ,
40
- impl : ( interpreter : Interpreter , str : BrsString ) => new Int32 ( str . value . charCodeAt ( 0 ) || 0 ) ,
40
+ impl : ( _ : Interpreter , str : BrsString ) => new Int32 ( str . value . charCodeAt ( 0 ) || 0 ) ,
41
41
} ) ;
42
42
43
43
/**
@@ -51,7 +51,7 @@ export const Chr = new Callable("Chr", {
51
51
args : [ new StdlibArgument ( "ch" , ValueKind . Int32 ) ] ,
52
52
returns : ValueKind . String ,
53
53
} ,
54
- impl : ( interpreter : Interpreter , ch : Int32 ) => {
54
+ impl : ( _ : Interpreter , ch : Int32 ) => {
55
55
const num = ch . getValue ( ) ;
56
56
if ( num <= 0 ) return new BrsString ( "" ) ;
57
57
else return new BrsString ( String . fromCharCode ( num ) ) ;
@@ -66,8 +66,7 @@ export const Left = new Callable("Left", {
66
66
args : [ new StdlibArgument ( "s" , ValueKind . String ) , new StdlibArgument ( "n" , ValueKind . Int32 ) ] ,
67
67
returns : ValueKind . String ,
68
68
} ,
69
- impl : ( interpreter : Interpreter , s : BrsString , n : Int32 ) =>
70
- new BrsString ( s . value . slice ( 0 , n . getValue ( ) ) ) ,
69
+ impl : ( _ : Interpreter , s : BrsString , n : Int32 ) => new BrsString ( s . value . slice ( 0 , n . getValue ( ) ) ) ,
71
70
} ) ;
72
71
73
72
/**
@@ -78,7 +77,7 @@ export const Right = new Callable("Right", {
78
77
args : [ new StdlibArgument ( "s" , ValueKind . String ) , new StdlibArgument ( "n" , ValueKind . Int32 ) ] ,
79
78
returns : ValueKind . String ,
80
79
} ,
81
- impl : ( interpreter : Interpreter , s : BrsString , n : Int32 ) => {
80
+ impl : ( _ : Interpreter , s : BrsString , n : Int32 ) => {
82
81
if ( n . getValue ( ) <= 0 ) return new BrsString ( "" ) ;
83
82
return new BrsString ( s . value . slice ( - n . getValue ( ) ) ) ;
84
83
} ,
@@ -96,7 +95,7 @@ export const Instr = new Callable("Instr", {
96
95
] ,
97
96
returns : ValueKind . String ,
98
97
} ,
99
- impl : ( interpreter : Interpreter , start : Int32 , str : BrsString , search : BrsString ) =>
98
+ impl : ( _ : Interpreter , start : Int32 , str : BrsString , search : BrsString ) =>
100
99
new Int32 ( str . value . indexOf ( search . value , start . getValue ( ) - 1 ) + 1 ) ,
101
100
} ) ;
102
101
@@ -108,7 +107,7 @@ export const Len = new Callable("Len", {
108
107
args : [ new StdlibArgument ( "s" , ValueKind . String ) ] ,
109
108
returns : ValueKind . Int32 ,
110
109
} ,
111
- impl : ( interpreter : Interpreter , s : BrsString ) => new Int32 ( s . value . length ) ,
110
+ impl : ( _ : Interpreter , s : BrsString ) => new Int32 ( s . value . length ) ,
112
111
} ) ;
113
112
114
113
/**
@@ -124,7 +123,7 @@ export const Mid = new Callable(
124
123
] ,
125
124
returns : ValueKind . String ,
126
125
} ,
127
- impl : ( interpreter : Interpreter , s : BrsString , p : Int32 ) : BrsString => {
126
+ impl : ( _ : Interpreter , s : BrsString , p : Int32 ) : BrsString => {
128
127
let start = p . getValue ( ) - 1 ;
129
128
return new BrsString ( s . value . substring ( start ) ) ;
130
129
} ,
@@ -138,7 +137,7 @@ export const Mid = new Callable(
138
137
] ,
139
138
returns : ValueKind . String ,
140
139
} ,
141
- impl : ( interpreter : Interpreter , s : BrsString , p : Int32 , n : Int32 ) : BrsString => {
140
+ impl : ( _ : Interpreter , s : BrsString , p : Int32 , n : Int32 ) : BrsString => {
142
141
let start = p . getValue ( ) - 1 ;
143
142
return new BrsString ( s . value . substring ( start , start + n . getValue ( ) ) ) ;
144
143
} ,
@@ -153,7 +152,7 @@ export const Str = new Callable("Str", {
153
152
args : [ new StdlibArgument ( "value" , ValueKind . Float ) ] ,
154
153
returns : ValueKind . String ,
155
154
} ,
156
- impl : ( interpreter : Interpreter , value : Float ) : BrsString => {
155
+ impl : ( _ : Interpreter , value : Float ) : BrsString => {
157
156
const floatValue = value . getValue ( ) ;
158
157
const prefix = floatValue >= 0.0 ? " " : "" ;
159
158
return new BrsString ( prefix + String ( floatValue ) ) ;
@@ -171,7 +170,7 @@ export const StrI = new Callable("StrI", {
171
170
] ,
172
171
returns : ValueKind . String ,
173
172
} ,
174
- impl : ( interpreter : Interpreter , value : Int32 , brsRadix : Int32 ) : BrsString => {
173
+ impl : ( _ : Interpreter , value : Int32 , brsRadix : Int32 ) : BrsString => {
175
174
let radix = brsRadix . getValue ( ) ;
176
175
if ( radix < 2 || radix > 36 ) {
177
176
return new BrsString ( "" ) ;
@@ -196,7 +195,7 @@ export const STRING = new Callable("String", {
196
195
] ,
197
196
returns : ValueKind . String ,
198
197
} ,
199
- impl : ( interpreter : Interpreter , n : Int32 , str : BrsString ) : BrsString => {
198
+ impl : ( _ : Interpreter , n : Int32 , str : BrsString ) : BrsString => {
200
199
return new BrsString ( str . value . repeat ( n . getValue ( ) ) ) ;
201
200
} ,
202
201
} ) ;
@@ -209,7 +208,7 @@ export const StringI = new Callable("StringI", {
209
208
args : [ new StdlibArgument ( "n" , ValueKind . Int32 ) , new StdlibArgument ( "ch" , ValueKind . Int32 ) ] ,
210
209
returns : ValueKind . String ,
211
210
} ,
212
- impl : ( interpreter : Interpreter , n : Int32 , ch : Int32 ) : BrsString => {
211
+ impl : ( _ : Interpreter , n : Int32 , ch : Int32 ) : BrsString => {
213
212
return new BrsString ( String . fromCharCode ( ch . getValue ( ) ) . repeat ( n . getValue ( ) ) ) ;
214
213
} ,
215
214
} ) ;
@@ -230,7 +229,7 @@ export const Substitute = new Callable("Substitute", {
230
229
returns : ValueKind . String ,
231
230
} ,
232
231
impl : (
233
- interpreter : Interpreter ,
232
+ _ : Interpreter ,
234
233
str : BrsString ,
235
234
arg0 : BrsString ,
236
235
arg1 : BrsString ,
@@ -257,21 +256,21 @@ export const Val = new Callable("Val", {
257
256
] ,
258
257
returns : ValueKind . Dynamic ,
259
258
} ,
260
- impl : ( interpreter : Interpreter , s : BrsString , brsRadix : Int32 | BrsInvalid ) : BrsNumber => {
259
+ impl : ( _ : Interpreter , s : BrsString , brsRadix : Int32 | BrsInvalid ) : BrsNumber => {
261
260
const isFloat = s . value . includes ( "." ) ;
262
-
263
- let retNumber = 0 ;
264
261
if ( isFloat || brsRadix instanceof BrsInvalid ) {
265
- retNumber = Number ( s . value ) ;
262
+ const retNumber = Number ( s . value ) ;
263
+ if ( Number . isNaN ( retNumber ) ) {
264
+ return new Float ( 0 ) ;
265
+ }
266
+ return new Float ( retNumber ) ;
266
267
} else {
267
- retNumber = parseInt ( s . value , brsRadix . getValue ( ) ) ;
268
+ const retNumber = parseInt ( s . value , brsRadix . getValue ( ) ) ;
269
+ if ( Number . isNaN ( retNumber ) ) {
270
+ return new Int32 ( 0 ) ;
271
+ }
272
+ return new Int32 ( retNumber ) ;
268
273
}
269
-
270
- if ( Number . isNaN ( retNumber ) ) {
271
- return new Int32 ( 0 ) ;
272
- }
273
-
274
- return isFloat ? new Float ( retNumber ) : new Int32 ( retNumber ) ;
275
274
} ,
276
275
} ) ;
277
276
@@ -283,7 +282,7 @@ export const StrToI = new Callable("StrToI", {
283
282
args : [ new StdlibArgument ( "s" , ValueKind . String ) ] ,
284
283
returns : ValueKind . Int32 ,
285
284
} ,
286
- impl : ( interpreter : Interpreter , s : BrsString ) : BrsNumber => {
285
+ impl : ( _ : Interpreter , s : BrsString ) : BrsNumber => {
287
286
let integerValue = parseInt ( s . value ) ;
288
287
289
288
if ( Number . isNaN ( integerValue ) ) {
0 commit comments