@@ -173,7 +173,8 @@ inline MUST_USE_RESULT bool ParseArrayIndex(Local<Value> arg,
173
173
return true ;
174
174
}
175
175
176
- int64_t tmp_i = arg->IntegerValue ();
176
+ CHECK (arg->IsNumber ());
177
+ int64_t tmp_i = arg.As <Integer>()->Value ();
177
178
178
179
if (tmp_i < 0 )
179
180
return false ;
@@ -769,7 +770,7 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) {
769
770
SPREAD_BUFFER_ARG (args[0 ], ts_obj);
770
771
771
772
Local<String> needle = args[1 ].As <String>();
772
- int64_t offset_i64 = args[2 ]-> IntegerValue ();
773
+ int64_t offset_i64 = args[2 ]. As <Integer>()-> Value ();
773
774
bool is_forward = args[4 ]->IsTrue ();
774
775
775
776
const char * haystack = ts_obj_data;
@@ -885,7 +886,7 @@ void IndexOfBuffer(const FunctionCallbackInfo<Value>& args) {
885
886
THROW_AND_RETURN_UNLESS_BUFFER (Environment::GetCurrent (args), args[1 ]);
886
887
SPREAD_BUFFER_ARG (args[0 ], ts_obj);
887
888
SPREAD_BUFFER_ARG (args[1 ], buf);
888
- int64_t offset_i64 = args[2 ]-> IntegerValue ();
889
+ int64_t offset_i64 = args[2 ]. As <Integer>()-> Value ();
889
890
bool is_forward = args[4 ]->IsTrue ();
890
891
891
892
const char * haystack = ts_obj_data;
@@ -955,7 +956,7 @@ void IndexOfNumber(const FunctionCallbackInfo<Value>& args) {
955
956
SPREAD_BUFFER_ARG (args[0 ], ts_obj);
956
957
957
958
uint32_t needle = args[1 ].As <Uint32>()->Value ();
958
- int64_t offset_i64 = args[2 ]-> IntegerValue ();
959
+ int64_t offset_i64 = args[2 ]. As <Integer>()-> Value ();
959
960
bool is_forward = args[3 ]->IsTrue ();
960
961
961
962
int64_t opt_offset = IndexOfOffset (ts_obj_length, offset_i64, 1 , is_forward);
0 commit comments