fix codex warning

Signed-off-by: hjzhangcm <zhanghaijun20@huawei.com>
This commit is contained in:
hjzhangcm 2022-07-07 16:14:16 +08:00
parent 81ca7a67d5
commit a5375d8bca
31 changed files with 85 additions and 85 deletions

View File

@ -214,7 +214,7 @@ public:
static int FromUtf8(int c, int l, const uint8_t *p, const uint8_t **pp)
{
int b;
uint32_t b;
c &= UTF8_FIRST_CODE[l - 1];
for (int i = 0; i < l; i++) {
b = *p++;

View File

@ -51,7 +51,7 @@ JSTaggedValue BuiltinsCjsModule::ResolveFilename(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t length = argv->GetArgsNumber();
int32_t length = argv->GetArgsNumber();
JSMutableHandle<JSTaggedValue> parent(thread, JSTaggedValue::Undefined());
JSMutableHandle<JSTaggedValue> dirname(thread, JSTaggedValue::Undefined());
const JSPandaFile *jsPandaFile = EcmaInterpreter::GetNativeCallPandafile(thread);

View File

@ -33,7 +33,7 @@ JSTaggedValue BuiltinsCjsRequire::CjsRequireConstructor(EcmaRuntimeCallInfo *arg
if (!newTarget->IsUndefined()) {
THROW_TYPE_ERROR_AND_RETURN(thread, "newTarget is undefined", JSTaggedValue::Exception());
}
uint32_t length = argv->GetArgsNumber();
int32_t length = argv->GetArgsNumber();
JSHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
if (length != 1) { // strange arg's number
LOG_ECMA(ERROR) << "BuiltinsCjsRequire::CjsRequireConstructor : can only accept one argument";

View File

@ -29,8 +29,8 @@ JSTaggedValue BuiltinsArkTools::ObjectDump(EcmaRuntimeCallInfo *info)
// The default log level of ace_engine and js_runtime is error
LOG_ECMA(ERROR) << ": " << base::StringHelper::ToStdString(*str);
uint32_t numArgs = info->GetArgsNumber();
for (uint32_t i = 1; i < numArgs; i++) {
int32_t numArgs = info->GetArgsNumber();
for (int32_t i = 1; i < numArgs; i++) {
JSHandle<JSTaggedValue> obj = GetCallArg(info, i);
std::ostringstream oss;
obj->Dump(oss);

View File

@ -48,7 +48,7 @@ JSTaggedValue BuiltinsArray::ArrayConstructor(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
// 1. Let numberOfArgs be the number of arguments passed to this function call.
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 3. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget.
JSHandle<JSTaggedValue> constructor = GetConstructor(argv);
@ -115,7 +115,7 @@ JSTaggedValue BuiltinsArray::ArrayConstructor(EcmaRuntimeCallInfo *argv)
// d. Assert: defineStatus is true.
// e. Increase k by 1.
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
for (uint32_t k = 0; k < argc; k++) {
for (int32_t k = 0; k < argc; k++) {
key.Update(JSTaggedValue(k));
JSHandle<JSTaggedValue> itemK = GetCallArg(argv, k);
JSObject::CreateDataProperty(thread, newArrayHandle, key, itemK);
@ -336,7 +336,7 @@ JSTaggedValue BuiltinsArray::Of(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> lengthKey = globalConst->GetHandledLengthString();
// 1. Let len be the actual number of arguments passed to this function.
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 3. Let C be the this value.
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
@ -372,7 +372,7 @@ JSTaggedValue BuiltinsArray::Of(EcmaRuntimeCallInfo *argv)
// d. ReturnIfAbrupt(defineStatus).
// e. Increase k by 1.
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
for (uint32_t k = 0; k < argc; k++) {
for (int32_t k = 0; k < argc; k++) {
key.Update(JSTaggedValue(k));
JSHandle<JSTaggedValue> kValue = GetCallArg(argv, k);
JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, key, kValue);
@ -401,7 +401,7 @@ JSTaggedValue BuiltinsArray::Concat(EcmaRuntimeCallInfo *argv)
BUILTINS_API_TRACE(argv->GetThread(), Array, Concat);
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
@ -453,7 +453,7 @@ JSTaggedValue BuiltinsArray::Concat(EcmaRuntimeCallInfo *argv)
n++;
}
// 7. Repeat, while items is not empty
for (uint32_t i = 0; i < argc; i++) {
for (int32_t i = 0; i < argc; i++) {
// a. Remove the first element from items and let E be the value of the element
JSHandle<JSTaggedValue> addHandle = GetCallArg(argv, i);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -1096,7 +1096,7 @@ JSTaggedValue BuiltinsArray::IndexOf(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
@ -1284,7 +1284,7 @@ JSTaggedValue BuiltinsArray::LastIndexOf(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
@ -1496,7 +1496,7 @@ JSTaggedValue BuiltinsArray::Push(EcmaRuntimeCallInfo *argv)
return JSStableArray::Push(JSHandle<JSArray>::Cast(thisHandle), argv);
}
// 6. Let argCount be the number of elements in items.
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
@ -1549,7 +1549,7 @@ JSTaggedValue BuiltinsArray::Reduce(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
@ -1654,7 +1654,7 @@ JSTaggedValue BuiltinsArray::ReduceRight(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
@ -2199,7 +2199,7 @@ JSTaggedValue BuiltinsArray::Splice(EcmaRuntimeCallInfo *argv)
BUILTINS_API_TRACE(argv->GetThread(), Array, Splice);
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
@ -2379,7 +2379,7 @@ JSTaggedValue BuiltinsArray::Splice(EcmaRuntimeCallInfo *argv)
k = start;
// 23. Repeat, while items is not empty
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
for (uint32_t i = 2; i < argc; i++) {
for (int32_t i = 2; i < argc; i++) {
JSHandle<JSTaggedValue> itemValue = GetCallArg(argv, i);
key.Update(JSTaggedValue(k));
JSArray::FastSetPropertyByValue(thread, thisObjVal, key, itemValue);
@ -2540,7 +2540,7 @@ JSTaggedValue BuiltinsArray::Unshift(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
// 5. Let argCount be the number of actual arguments.
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
// 1. Let O be ToObject(this value).
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);
@ -2697,7 +2697,7 @@ JSTaggedValue BuiltinsArray::Flat(EcmaRuntimeCallInfo *argv)
JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
JSHandle<JSTaggedValue> thisObjVal(thisObjHandle);
// 2. Let sourceLen be ? LengthOfArrayLike(O).
@ -2784,7 +2784,7 @@ JSTaggedValue BuiltinsArray::Includes(EcmaRuntimeCallInfo *argv)
JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
JSHandle<JSTaggedValue> thisObjVal(thisObjHandle);
JSHandle<JSTaggedValue> searchElement = GetCallArg(argv, 0);

View File

@ -308,7 +308,7 @@ JSTaggedValue BuiltinsAtomics::AtomicReadModifyWriteCase(JSThread *thread, JSTag
JSTaggedValue data = jsArrayBuffer->GetArrayBufferData();
void *pointer = JSNativePointer::Cast(data.GetTaggedObject())->GetExternalPointer();
auto *block = reinterpret_cast<uint8_t *>(pointer);
uint32_t size = argv->GetArgsNumber();
uint32_t size = static_cast<uint32_t>(argv->GetArgsNumber());
switch (type) {
case DataViewType::UINT8:
return HandleWithUint8(thread, size, block, indexedPosition, argv, op);

View File

@ -41,7 +41,7 @@ JSTaggedValue BuiltinsDate::DateConstructor(EcmaRuntimeCallInfo *argv)
}
JSTaggedValue timeValue(0.0);
uint32_t length = argv->GetArgsNumber();
uint32_t length = static_cast<uint32_t>(argv->GetArgsNumber());
if (length == 0) { // no value
timeValue = JSDate::Now();
} else if (length == 1) { // one value

View File

@ -115,14 +115,14 @@ JSTaggedValue BuiltinsFunction::FunctionPrototypeApply(EcmaRuntimeCallInfo *argv
JSObject::CreateListFromArrayLike(thread, arrayObj));
// 4. ReturnIfAbrupt(argList).
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
const int32_t argsLength = argList->GetLength();
const int32_t argsLength = static_cast<int32_t>(argList->GetLength());
EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, func, thisArg, undefined, argsLength);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
info->SetCallArg(argsLength, argList);
return JSFunction::Call(info);
}
// 6. Return Call(func, thisArg, argList).
const int32_t argsLength = argumentsList.second;
const int32_t argsLength = static_cast<int32_t>(argumentsList.second);
EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, func, thisArg, undefined, argsLength);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
info->SetCallArg(argsLength, argumentsList.first);
@ -146,7 +146,7 @@ JSTaggedValue BuiltinsFunction::FunctionPrototypeBind(EcmaRuntimeCallInfo *argv)
}
JSHandle<JSTaggedValue> thisArg = GetCallArg(argv, 0);
size_t argsLength = 0;
int32_t argsLength = 0;
if (argv->GetArgsNumber() > 1) {
argsLength = argv->GetArgsNumber() - 1;
}
@ -154,7 +154,7 @@ JSTaggedValue BuiltinsFunction::FunctionPrototypeBind(EcmaRuntimeCallInfo *argv)
// 3. Let args be a new (possibly empty) List consisting of all of the argument
// values provided after thisArg in order.
JSHandle<TaggedArray> argsArray = factory->NewTaggedArray(argsLength);
for (size_t index = 0; index < argsLength; ++index) {
for (int32_t index = 0; index < argsLength; ++index) {
argsArray->Set(thread, index, GetCallArg(argv, index + 1));
}
// 4. Let F be BoundFunctionCreate(Target, thisArg, args).
@ -236,7 +236,7 @@ JSTaggedValue BuiltinsFunction::FunctionPrototypeCall(EcmaRuntimeCallInfo *argv)
JSHandle<JSTaggedValue> func = GetThis(argv);
JSHandle<JSTaggedValue> thisArg = GetCallArg(argv, 0);
size_t argsLength = 0;
int32_t argsLength = 0;
if (argv->GetArgsNumber() > 1) {
argsLength = argv->GetArgsNumber() - 1;
}

View File

@ -479,8 +479,8 @@ JSTaggedValue BuiltinsGlobal::PrintEntrypoint(EcmaRuntimeCallInfo *msg)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
BUILTINS_API_TRACE(thread, Global, PrintEntryPoint);
uint32_t numArgs = msg->GetArgsNumber();
for (uint32_t i = 0; i < numArgs; i++) {
int32_t numArgs = msg->GetArgsNumber();
for (int32_t i = 0; i < numArgs; i++) {
JSHandle<EcmaString> stringContent = JSTaggedValue::ToString(thread, GetCallArg(msg, i));
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
PrintString(thread, *stringContent);

View File

@ -35,7 +35,7 @@ JSTaggedValue BuiltinsJson::Parse(EcmaRuntimeCallInfo *argv)
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc == 0) {
JSHandle<JSObject> syntaxError = factory->GetJSError(base::ErrorType::SYNTAX_ERROR, "arg is empty");
THROW_NEW_ERROR_AND_RETURN_VALUE(thread, syntaxError.GetTaggedValue(), JSTaggedValue::Exception());
@ -83,7 +83,7 @@ JSTaggedValue BuiltinsJson::Stringify(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
JSTaggedValue value = GetCallArg(argv, 0).GetTaggedValue();
JSTaggedValue replacer = JSTaggedValue::Undefined();
JSTaggedValue gap = JSTaggedValue::Undefined();

View File

@ -363,9 +363,9 @@ JSTaggedValue BuiltinsMath::Hypot(EcmaRuntimeCallInfo *argv)
[[maybe_unused]] EcmaHandleScope handleScope(thread);
double result = 0;
double value = 0;
uint32_t argLen = argv->GetArgsNumber();
int32_t argLen = argv->GetArgsNumber();
auto numberValue = JSTaggedNumber(0);
for (uint32_t i = 0; i < argLen; i++) {
for (int32_t i = 0; i < argLen; i++) {
JSHandle<JSTaggedValue> msg = GetCallArg(argv, i);
numberValue = JSTaggedValue::ToNumber(thread, msg);
value = numberValue.GetNumber();
@ -482,13 +482,13 @@ JSTaggedValue BuiltinsMath::Max(EcmaRuntimeCallInfo *argv)
BUILTINS_API_TRACE(argv->GetThread(), Math, Max);
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t argLen = argv->GetArgsNumber();
int32_t argLen = argv->GetArgsNumber();
auto numberValue = JSTaggedNumber(-base::POSITIVE_INFINITY);
// If no arguments are given, the result is -inf
auto result = JSTaggedNumber(-base::POSITIVE_INFINITY);
auto tmpMax = -base::POSITIVE_INFINITY;
auto value = -base::POSITIVE_INFINITY;
for (uint32_t i = 0; i < argLen; i++) {
for (int32_t i = 0; i < argLen; i++) {
JSHandle<JSTaggedValue> msg = GetCallArg(argv, i);
numberValue = JSTaggedValue::ToNumber(thread, msg);
value = numberValue.GetNumber();
@ -516,13 +516,13 @@ JSTaggedValue BuiltinsMath::Min(EcmaRuntimeCallInfo *argv)
BUILTINS_API_TRACE(argv->GetThread(), Math, Min);
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t argLen = argv->GetArgsNumber();
int32_t argLen = argv->GetArgsNumber();
auto numberValue = JSTaggedNumber(base::POSITIVE_INFINITY);
// If no arguments are given, the result is inf
auto result = JSTaggedNumber(base::POSITIVE_INFINITY);
auto tmpMin = base::POSITIVE_INFINITY;
auto value = base::POSITIVE_INFINITY;
for (uint32_t i = 0; i < argLen; i++) {
for (int32_t i = 0; i < argLen; i++) {
JSHandle<JSTaggedValue> msg = GetCallArg(argv, i);
numberValue = JSTaggedValue::ToNumber(thread, msg);
value = numberValue.GetNumber();

View File

@ -66,7 +66,7 @@ JSTaggedValue BuiltinsObject::Assign(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
uint32_t numArgs = argv->GetArgsNumber();
int32_t numArgs = argv->GetArgsNumber();
// 1.Let to be ToObject(target).
JSHandle<JSTaggedValue> target = GetCallArg(argv, 0);
JSHandle<JSObject> toAssign = JSTaggedValue::ToObject(thread, target);
@ -82,7 +82,7 @@ JSTaggedValue BuiltinsObject::Assign(EcmaRuntimeCallInfo *argv)
// ii.Let keys be from.[[OwnPropertyKeys]]().
// iii.ReturnIfAbrupt(keys).
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
for (uint32_t i = 1; i < numArgs; i++) {
for (int32_t i = 1; i < numArgs; i++) {
JSHandle<JSTaggedValue> source = GetCallArg(argv, i);
if (!source->IsNull() && !source->IsUndefined()) {
JSHandle<JSObject> from = JSTaggedValue::ToObject(thread, source);

View File

@ -39,7 +39,7 @@ JSTaggedValue BuiltinsReflect::ReflectApply(EcmaRuntimeCallInfo *argv)
// 3. Perform PrepareForTailCall().
// 4. Return ? Call(target, thisArgument, args).
const int32_t argsLength = args->GetLength();
const int32_t argsLength = static_cast<int32_t>(args->GetLength());
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, target, thisArgument, undefined, argsLength);
@ -74,7 +74,7 @@ JSTaggedValue BuiltinsReflect::ReflectConstruct(EcmaRuntimeCallInfo *argv)
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
JSHandle<TaggedArray> args = JSHandle<TaggedArray>::Cast(argOrAbrupt);
// 5. Return ? Construct(target, args, newTarget).
const int32_t argsLength = args->GetLength();
const int32_t argsLength = static_cast<int32_t>(args->GetLength());
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, target, undefined, newTarget, argsLength);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);

View File

@ -947,7 +947,7 @@ JSTaggedValue BuiltinsRegExp::Replace(EcmaRuntimeCallInfo *argv)
replacerArgs->Set(thread, index + 3, namedCaptures.GetTaggedValue()); // 3: position of groups
}
// iv. Let replValue be Call(replaceValue, undefined, replacerArgs).
const int32_t argsLength = replacerArgs->GetLength();
const int32_t argsLength = static_cast<int32_t>(replacerArgs->GetLength());
JSHandle<JSTaggedValue> undefined = globalConst->GetHandledUndefined();
EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, inputReplaceValue, undefined, undefined, argsLength);

View File

@ -86,7 +86,7 @@ JSTaggedValue BuiltinsString::FromCharCode(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
uint32_t argLength = argv->GetArgsNumber();
int32_t argLength = argv->GetArgsNumber();
if (argLength == 0) {
return factory->GetEmptyString().GetTaggedValue();
}
@ -100,7 +100,7 @@ JSTaggedValue BuiltinsString::FromCharCode(EcmaRuntimeCallInfo *argv)
std::u16string u16str = base::StringHelper::Utf16ToU16String(&codePointValue, 1);
CVector<uint16_t> valueTable;
valueTable.reserve(argLength - 1);
for (uint32_t i = 1; i < argLength; i++) {
for (int32_t i = 1; i < argLength; i++) {
JSHandle<JSTaggedValue> nextCp = BuiltinsString::GetCallArg(argv, i);
uint16_t nextCv = JSTaggedValue::ToUint16(thread, nextCp);
valueTable.emplace_back(nextCv);
@ -123,13 +123,13 @@ JSTaggedValue BuiltinsString::FromCodePoint(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
uint32_t argLength = argv->GetArgsNumber();
int32_t argLength = argv->GetArgsNumber();
if (argLength == 0) {
return factory->GetEmptyString().GetTaggedValue();
}
std::u16string u16str;
uint32_t u16strSize = argLength;
for (uint32_t i = 0; i < argLength; i++) {
int32_t u16strSize = argLength;
for (int32_t i = 0; i < argLength; i++) {
JSHandle<JSTaggedValue> nextCpTag = BuiltinsString::GetCallArg(argv, i);
JSTaggedNumber nextCpVal = JSTaggedValue::ToNumber(thread, nextCpTag);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
@ -198,7 +198,7 @@ JSTaggedValue BuiltinsString::Raw(EcmaRuntimeCallInfo *argv)
}
std::u16string u16str;
int argc = static_cast<int>(argv->GetArgsNumber()) - 1;
int argc = argv->GetArgsNumber() - 1;
bool canBeCompress = true;
for (int i = 0, argsI = 1; i < length; ++i, ++argsI) {
// Let nextSeg be ToString(Get(raw, nextKey)).
@ -331,7 +331,7 @@ JSTaggedValue BuiltinsString::Concat(EcmaRuntimeCallInfo *argv)
JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisTag);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
uint32_t thisLen = thisHandle->GetLength();
uint32_t argLength = argv->GetArgsNumber();
int32_t argLength = argv->GetArgsNumber();
if (argLength == 0) {
return thisHandle.GetTaggedValue();
}
@ -344,7 +344,7 @@ JSTaggedValue BuiltinsString::Concat(EcmaRuntimeCallInfo *argv)
} else {
u16strThis = base::StringHelper::Utf8ToU16String(thisHandle->GetDataUtf8(), thisLen);
}
for (uint32_t i = 0; i < argLength; i++) {
for (int32_t i = 0; i < argLength; i++) {
JSHandle<JSTaggedValue> nextTag = BuiltinsString::GetCallArg(argv, i);
JSHandle<EcmaString> nextHandle = JSTaggedValue::ToString(thread, nextTag);
uint32_t nextLen = nextHandle->GetLength();
@ -1106,7 +1106,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv)
// 7. Let searchLength be the length of searchString.
// 8. Let advanceBy be max(1, searchLength).
int32_t searchLength = searchString->GetLength();
int32_t searchLength = static_cast<int32_t>(searchString->GetLength());
int32_t advanceBy = std::max(1, searchLength);
// 9. Let matchPositions be a new empty List.
std::u16string stringBuilder;

View File

@ -288,7 +288,7 @@ JSTaggedValue BuiltinsTypedArray::Of(EcmaRuntimeCallInfo *argv)
JSThread *thread = argv->GetThread();
[[maybe_unused]] EcmaHandleScope handleScope(thread);
// 1. Let len be the actual number of arguments passed to this function.
uint32_t len = argv->GetArgsNumber();
int32_t len = argv->GetArgsNumber();
// 2. Let items be the List of arguments passed to this function.
// 3. Let C be the this value.
JSHandle<JSTaggedValue> thisHandle = GetThis(argv);

View File

@ -81,7 +81,7 @@ public:
static JSTaggedValue TestEveryFunc(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
if (GetCallArg(argv, 0)->GetInt() > 10) { // 10 : test case
return GetTaggedBoolean(true);
@ -120,7 +120,7 @@ public:
static JSTaggedValue TestFindFunc(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
// 10 : test case
if (GetCallArg(argv, 0)->GetInt() > 10) {
@ -132,7 +132,7 @@ public:
static JSTaggedValue TestFindIndexFunc(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
// 10 : test case
if (GetCallArg(argv, 0)->GetInt() > 10) {
@ -158,7 +158,7 @@ public:
static JSTaggedValue TestSomeFunc(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
if (GetCallArg(argv, 0)->GetInt() > 10) { // 10 : test case
return GetTaggedBoolean(true);

View File

@ -72,7 +72,7 @@ public:
public:
static JSTaggedValue TestForParse(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
}
JSTaggedValue key = GetCallArg(argv, 0).GetTaggedValue();
@ -89,7 +89,7 @@ public:
static JSTaggedValue TestForParse1(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
}
return JSTaggedValue::Undefined();
@ -97,7 +97,7 @@ public:
static JSTaggedValue TestForStringfy(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
JSTaggedValue key = GetCallArg(argv, 0).GetTaggedValue();
if (key.IsUndefined()) {

View File

@ -90,7 +90,7 @@ protected:
static JSTaggedValue TestEveryFunc(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
[[maybe_unused]] int aaa = GetCallArg(argv, 0)->GetInt();
// 10 : test case
@ -104,7 +104,7 @@ protected:
static JSTaggedValue TestFilterFunc(EcmaRuntimeCallInfo *argv)
{
ASSERT(argv);
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
// 10 : test case
if (GetCallArg(argv, 0)->GetInt() > 10) {
@ -123,7 +123,7 @@ protected:
static JSTaggedValue TestFindFunc(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
// 10 : test case
if (GetCallArg(argv, 0)->GetInt() > 10) {
@ -135,7 +135,7 @@ protected:
static JSTaggedValue TestFindIndexFunc(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
// 10 : test case
if (GetCallArg(argv, 0)->GetInt() > 10) {
@ -161,7 +161,7 @@ protected:
static JSTaggedValue TestSomeFunc(EcmaRuntimeCallInfo *argv)
{
uint32_t argc = argv->GetArgsNumber();
int32_t argc = argv->GetArgsNumber();
if (argc > 0) {
// 10 : test case
if (GetCallArg(argv, 0)->GetInt() > 10) {

View File

@ -1018,7 +1018,7 @@ struct BuiltinWithArgvFrame : public base::AlignedStruct<base::AlignedPointer::S
auto topAddress = ToUintPtr(this) +
(static_cast<int>(Index::StackArgsTopIndex) * sizeof(uintptr_t));
auto numberArgs = GetNumArgs() + NUM_MANDATORY_JSFUNC_ARGS;
return topAddress - numberArgs * sizeof(uintptr_t);
return topAddress - static_cast<uint32_t>(numberArgs) * sizeof(uintptr_t);
}
JSTaggedValue GetFunction()
{

View File

@ -302,7 +302,7 @@ HWTEST_F_L0(ICRuntimeStubTest, TryStoreICAndLoadIC_ByValue2)
JSTaggedValue TestSetter(EcmaRuntimeCallInfo *argv)
{
// 2 : 2 arg value
if (argv->GetArgsNumber() == 1U && argv->GetCallArg(0).GetTaggedValue() == JSTaggedValue(2)) {
if (argv->GetArgsNumber() == 1 && argv->GetCallArg(0).GetTaggedValue() == JSTaggedValue(2)) {
JSThread *thread = argv->GetThread();
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
JSHandle<JSObject> obj(BuiltinsBase::GetThis(argv));

View File

@ -34,7 +34,7 @@ JSTaggedValue SlowRuntimeHelper::CallBoundFunction(EcmaRuntimeCallInfo *info)
}
JSHandle<TaggedArray> boundArgs(thread, boundFunc->GetBoundArguments());
const int32_t boundLength = boundArgs->GetLength();
const int32_t boundLength = static_cast<int32_t>(boundArgs->GetLength());
const int32_t argsLength = info->GetArgsNumber() + boundLength;
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *runtimeInfo = EcmaInterpreter::NewRuntimeCallInfo(thread, JSHandle<JSTaggedValue>(targetFunc),

View File

@ -57,7 +57,7 @@ JSTaggedValue SlowRuntimeStub::CallSpreadDyn(JSThread *thread, JSTaggedValue fun
JSHandle<JSTaggedValue> taggedObj(thread, obj);
JSHandle<TaggedArray> coretypesArray(thread, GetCallSpreadArgs(thread, jsArray.GetTaggedValue()));
const int32_t argsLength = coretypesArray->GetLength();
const uint32_t argsLength = coretypesArray->GetLength();
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, JSHandle<JSTaggedValue>(jsFunc), taggedObj, undefined, argsLength);
@ -1900,7 +1900,7 @@ JSTaggedValue SlowRuntimeStub::SuperCallSpread(JSThread *thread, JSTaggedValue f
ASSERT(superFunc->IsJSFunction());
JSHandle<TaggedArray> argv(thread, GetCallSpreadArgs(thread, jsArray.GetTaggedValue()));
const int32_t argsLength = argv->GetLength();
const uint32_t argsLength = argv->GetLength();
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, superFunc, undefined, newTargetHandle, argsLength);

View File

@ -45,7 +45,7 @@ public:
JSHandle<JSTaggedValue> job(thread, pendingJob->GetJob());
ASSERT(job->IsCallable());
JSHandle<TaggedArray> argv(thread, pendingJob->GetArguments());
const int32_t argsLength = argv->GetLength();
const int32_t argsLength = static_cast<int32_t>(argv->GetLength());
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, job, undefined, undefined, argsLength);
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);

View File

@ -484,7 +484,7 @@ int32_t JSAPILightWeightMap::Hash(JSTaggedValue key)
return keyString->GetHashcode();
}
if (key.IsECMAObject()) {
int32_t hash = ECMAObject::Cast(key.GetTaggedObject())->GetHash();
uint32_t hash = ECMAObject::Cast(key.GetTaggedObject())->GetHash();
if (hash == 0) {
uint64_t keyValue = key.GetRawData();
hash = GetHash32(reinterpret_cast<uint8_t *>(&keyValue), sizeof(keyValue) / sizeof(uint8_t));
@ -508,12 +508,12 @@ int32_t JSAPILightWeightMap::BinarySearchHashes(JSHandle<TaggedArray> &array, in
uint32_t mid = static_cast<uint32_t>(low + high) >> 1U;
int32_t midHash = array->Get(mid).GetInt();
if (midHash < hash) {
low = static_cast<uint32_t>(mid) + 1;
low = static_cast<int32_t>(mid) + 1;
} else {
if (midHash == hash) {
return mid;
}
high = static_cast<uint32_t>(mid) - 1;
high = static_cast<int32_t>(mid) - 1;
}
}
return -(low + 1);

View File

@ -544,7 +544,7 @@ JSTaggedValue JSDate::UTC(EcmaRuntimeCallInfo *argv)
year = base::NAN_VALUE;
}
uint32_t index = 1;
uint32_t numArgs = argv->GetArgsNumber();
uint32_t numArgs = static_cast<uint32_t>(argv->GetArgsNumber());
JSTaggedValue res;
if (numArgs > index) {
JSHandle<JSTaggedValue> value = base::BuiltinsBase::GetCallArg(argv, index);
@ -966,7 +966,7 @@ JSTaggedValue JSDate::SetDateValue(EcmaRuntimeCallInfo *argv, uint32_t code, boo
double timeMs = this->GetTimeValue().GetDouble();
// get values from argv.
uint32_t argc = argv->GetArgsNumber();
uint32_t argc = static_cast<uint32_t>(argv->GetArgsNumber());
if (argc == 0) {
return JSTaggedValue(base::NAN_VALUE);
}

View File

@ -439,7 +439,7 @@ JSTaggedValue JSBoundFunction::ConstructInternal(EcmaRuntimeCallInfo *info)
}
JSHandle<TaggedArray> boundArgs(thread, func->GetBoundArguments());
const int32_t boundLength = boundArgs->GetLength();
const int32_t boundLength = static_cast<int32_t>(boundArgs->GetLength());
const int32_t argsLength = info->GetArgsNumber() + boundLength;
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *runtimeInfo =

View File

@ -27,7 +27,7 @@ namespace panda::ecmascript {
JSTaggedValue JSStableArray::Push(JSHandle<JSArray> receiver, EcmaRuntimeCallInfo *argv)
{
JSThread *thread = argv->GetThread();
uint32_t argc = argv->GetArgsNumber();
uint32_t argc = static_cast<uint32_t>(argv->GetArgsNumber());
uint32_t oldLength = receiver->GetArrayLength();
uint32_t newLength = argc + oldLength;
@ -72,7 +72,7 @@ JSTaggedValue JSStableArray::Splice(JSHandle<JSArray> receiver, EcmaRuntimeCallI
{
JSThread *thread = argv->GetThread();
uint32_t len = receiver->GetArrayLength();
uint32_t argc = argv->GetArgsNumber();
uint32_t argc = static_cast<uint32_t>(argv->GetArgsNumber());
JSHandle<JSObject> thisObjHandle(receiver);
JSTaggedValue newArray = JSArray::ArraySpeciesCreate(thread, thisObjHandle, JSTaggedNumber(actualDeleteCount));

View File

@ -764,7 +764,7 @@ void RegExpParser::ParseQuantifier(size_t atomBcStart, int captureStart, int cap
bool RegExpParser::ParseGroupSpecifier(const uint8_t **pp, CString &name)
{
const uint8_t *p = *pp;
uint32_t c ;
uint32_t c;
char buffer[CACHE_SIZE] = {0};
char *q = buffer;
while (true) {
@ -780,7 +780,7 @@ bool RegExpParser::ParseGroupSpecifier(const uint8_t **pp, CString &name)
} else if (c == '>') {
break;
} else if (c > CACHE_SIZE) {
c = base::StringHelper::UnicodeFromUtf8(p, UTF8_CHAR_LEN_MAX, &p);
c = static_cast<uint32_t>(base::StringHelper::UnicodeFromUtf8(p, UTF8_CHAR_LEN_MAX, &p));
} else {
p++;
}
@ -1408,7 +1408,7 @@ int RegExpParser::IsIdentFirst(uint32_t c)
if (c < CACHE_SIZE) {
return (ID_START_TABLE_ASCII[c >> 5] >> (c & 31)) & 1; // 5: Shift five bits 31: and operation binary of 31
} else {
return u_isIDStart(c);
return static_cast<int>(u_isIDStart(c));
}
}
} // namespace panda::ecmascript

View File

@ -188,7 +188,7 @@ JSTaggedValue RuntimeStubs::RuntimeSuperCallSpread(JSThread *thread, const JSHan
ASSERT(superFunc->IsJSFunction());
JSHandle<TaggedArray> argv(thread, RuntimeGetCallSpreadArgs(thread, array.GetTaggedValue()));
const int32_t argsLength = argv->GetLength();
const int32_t argsLength = static_cast<int32_t>(argv->GetLength());
JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
EcmaRuntimeCallInfo *info =
EcmaInterpreter::NewRuntimeCallInfo(thread, superFunc, undefined, newTarget, argsLength);

View File

@ -31,7 +31,7 @@ void DebuggerExecutor::Initialize(const EcmaVM *vm)
Local<JSValueRef> DebuggerExecutor::DebuggerGetValue(JsiRuntimeCallInfo *runtimeCallInfo)
{
EcmaVM *vm = runtimeCallInfo->GetVM();
size_t argc = runtimeCallInfo->GetArgsNumber();
int32_t argc = runtimeCallInfo->GetArgsNumber();
if (argc != NUM_ARGS) {
return JSValueRef::Undefined(vm);
}
@ -62,7 +62,7 @@ Local<JSValueRef> DebuggerExecutor::DebuggerGetValue(JsiRuntimeCallInfo *runtime
Local<JSValueRef> DebuggerExecutor::DebuggerSetValue(JsiRuntimeCallInfo *runtimeCallInfo)
{
EcmaVM *vm = runtimeCallInfo->GetVM();
size_t argc = runtimeCallInfo->GetArgsNumber();
int32_t argc = runtimeCallInfo->GetArgsNumber();
if (argc != NUM_ARGS) {
return JSValueRef::Undefined(vm);
}