!1325 [RT] PR shuttle at 2024-03-04

Merge pull request !1325 from pivovarovatatiana/fe_dev_stable
This commit is contained in:
openharmony_ci 2024-03-09 23:09:23 +00:00 committed by Gitee
commit 9319bcab8c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
453 changed files with 5719 additions and 1350 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -1436,7 +1436,7 @@ void Disassembler::SerializeFields(const pandasm::Record &record, std::ostream &
}
}
if (printInformation && !recInf.fieldsInfo.empty()) {
if (printInformation) {
os << std::setw(INFO_OFFSET) << std::left << ss.str() << " # " << recInf.fieldsInfo.at(fieldIdx) << "\n";
} else {
os << ss.str() << "\n";

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -92,11 +92,6 @@ EtsClass *EtsClassLinker::GetObjectClass()
return EtsClass::FromRuntimeClass(ext_->GetObjectClass());
}
EtsClass *EtsClassLinker::GetVoidClass()
{
return EtsClass::FromRuntimeClass(ext_->GetVoidClass());
}
EtsClass *EtsClassLinker::GetPromiseClass()
{
return EtsClass::FromRuntimeClass(ext_->GetPromiseClass());

View File

@ -185,9 +185,6 @@ bool EtsClassLinkerExtension::InitializeImpl(bool compressedStringEnabled)
InitializeArrayClassRoot(ClassRoot::ARRAY_STRING, ClassRoot::STRING,
utf::Mutf8AsCString(langCtx_.GetStringArrayClassDescriptor()));
if (!CacheClass(&voidClass_, VOID.data())) {
return false;
}
if (!CacheClass(&boxBooleanClass_, BOX_BOOLEAN.data())) {
return false;
}
@ -215,6 +212,9 @@ bool EtsClassLinkerExtension::InitializeImpl(bool compressedStringEnabled)
if (!CacheClass(&promiseClass_, PROMISE.data())) {
return false;
}
if (!CacheClass(&internalUndefinedClass_, INTERNAL_UNDEFINED.data())) {
return false;
}
if (!CacheClass(&arraybufClass_, ARRAY_BUFFER.data())) {
return false;
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -85,6 +85,11 @@ public:
return objectClass_;
}
Class *GetUndefinedClass() const
{
return internalUndefinedClass_;
}
Class *GetPromiseClass()
{
return promiseClass_;
@ -115,11 +120,6 @@ public:
return typeapiParameterClass_;
}
Class *GetVoidClass()
{
return voidClass_;
}
Class *GetBoxBooleanClass()
{
return boxBooleanClass_;
@ -193,9 +193,6 @@ private:
LanguageContext langCtx_ {nullptr};
mem::HeapManager *heapManager_ {nullptr};
// void class
Class *voidClass_ = nullptr;
// Box classes
Class *boxBooleanClass_ = nullptr;
Class *boxByteClass_ = nullptr;
@ -208,6 +205,7 @@ private:
// Cached classes
Class *objectClass_ = nullptr;
Class *internalUndefinedClass_ = nullptr;
Class *promiseClass_ = nullptr;
Class *arraybufClass_ = nullptr;

View File

@ -18,9 +18,6 @@ coretypes:
- managed_class: std.core.Object
mirror_class: ark::ets::EtsObject
- managed_class: std.core.void
mirror_class: ark::ets::EtsVoid
- managed_class: std.core.String
mirror_class: ark::ets::EtsString
@ -542,7 +539,7 @@ intrinsics:
method_name: print
static: false
signature:
ret: std.core.void
ret: void
args: [ std.core.String ]
impl: ark::ets::intrinsics::StdConsolePrintString
@ -552,7 +549,7 @@ intrinsics:
method_name: print
static: false
signature:
ret: std.core.void
ret: void
args: [ u1 ]
impl: ark::ets::intrinsics::StdConsolePrintBool
@ -562,7 +559,7 @@ intrinsics:
method_name: print
static: false
signature:
ret: std.core.void
ret: void
args: [ i8 ]
impl: ark::ets::intrinsics::StdConsolePrintI8
@ -572,7 +569,7 @@ intrinsics:
method_name: print
static: false
signature:
ret: std.core.void
ret: void
args: [ i16 ]
impl: ark::ets::intrinsics::StdConsolePrintI16
@ -582,7 +579,7 @@ intrinsics:
method_name: print
static: false
signature:
ret: std.core.void
ret: void
args: [ u16 ]
impl: ark::ets::intrinsics::StdConsolePrintChar
@ -592,7 +589,7 @@ intrinsics:
method_name: print
static: false
signature:
ret: std.core.void
ret: void
args: [ i32 ]
impl: ark::ets::intrinsics::StdConsolePrintI32
@ -602,7 +599,7 @@ intrinsics:
method_name: print
static: false
signature:
ret: std.core.void
ret: void
args: [ i64 ]
impl: ark::ets::intrinsics::StdConsolePrintI64
@ -612,7 +609,7 @@ intrinsics:
method_name: println
static: false
signature:
ret: std.core.void
ret: void
args: []
impl: ark::ets::intrinsics::StdConsolePrintln
@ -622,7 +619,7 @@ intrinsics:
method_name: loadLibrary
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.String ]
impl: ark::ets::intrinsics::LoadLibrary
@ -1410,7 +1407,7 @@ intrinsics:
method_name: copyTo
static: true
signature:
ret: std.core.void
ret: void
args:
- u1\[
- u1\[
@ -1428,7 +1425,7 @@ intrinsics:
method_name: copyTo
static: true
signature:
ret: std.core.void
ret: void
args:
- u16\[
- u16\[
@ -1446,7 +1443,7 @@ intrinsics:
method_name: copyTo
static: true
signature:
ret: std.core.void
ret: void
args:
- i8\[
- i8\[
@ -1464,7 +1461,7 @@ intrinsics:
method_name: copyTo
static: true
signature:
ret: std.core.void
ret: void
args:
- i16\[
- i16\[
@ -1482,7 +1479,7 @@ intrinsics:
method_name: copyTo
static: true
signature:
ret: std.core.void
ret: void
args:
- i32\[
- i32\[
@ -1500,7 +1497,7 @@ intrinsics:
method_name: copyTo
static: true
signature:
ret: std.core.void
ret: void
args:
- i64\[
- i64\[
@ -1518,7 +1515,7 @@ intrinsics:
method_name: copyTo
static: true
signature:
ret: std.core.void
ret: void
args:
- f32\[
- f32\[
@ -1536,7 +1533,7 @@ intrinsics:
method_name: copyTo
static: true
signature:
ret: std.core.void
ret: void
args:
- f64\[
- f64\[
@ -1557,7 +1554,7 @@ intrinsics:
method_name: printStackTrace
static: true
signature:
ret: std.core.void
ret: void
args: []
impl: ark::ets::intrinsics::StdCorePrintStackTrace
@ -1578,7 +1575,7 @@ intrinsics:
method_name: exit
static: true
signature:
ret: std.core.void
ret: void
args: [i32]
impl: ark::intrinsics::SystemExit
clear_flags: [require_state, runtime_call, can_throw]
@ -1602,7 +1599,7 @@ intrinsics:
method_name: waitForFinishGC
static: true
signature:
ret: std.core.void
ret: void
args: [ i64 ]
impl: ark::ets::intrinsics::StdGCWaitForFinishGC
@ -1612,7 +1609,7 @@ intrinsics:
method_name: scheduleGcAfterNthAlloc
static: true
signature:
ret: std.core.void
ret: void
args: [ i32, i32 ]
impl: ark::ets::intrinsics::StdGCScheduleGCAfterNthAlloc
@ -1632,7 +1629,7 @@ intrinsics:
method_name: postponeGCStart
static: true
signature:
ret: std.core.void
ret: void
args: []
impl: ark::ets::intrinsics::StdGCPostponeGCStart
@ -1642,7 +1639,7 @@ intrinsics:
method_name: postponeGCEnd
static: true
signature:
ret: std.core.void
ret: void
args: []
impl: ark::ets::intrinsics::StdGCPostponeGCEnd
@ -1752,7 +1749,7 @@ intrinsics:
method_name: pinObject
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object ]
impl: ark::ets::intrinsics::StdGCPinObject
@ -1762,7 +1759,7 @@ intrinsics:
method_name: unpinObject
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object ]
impl: ark::ets::intrinsics::StdGCUnpinObject
@ -1802,7 +1799,7 @@ intrinsics:
method_name: registerNativeAllocation
static: true
signature:
ret: std.core.void
ret: void
args: [ i64 ]
impl: ark::ets::intrinsics::StdGCRegisterNativeAllocation
@ -1812,7 +1809,7 @@ intrinsics:
method_name: registerNativeFree
static: true
signature:
ret: std.core.void
ret: void
args: [ i64 ]
impl: ark::ets::intrinsics::StdGCRegisterNativeFree
@ -1825,7 +1822,7 @@ intrinsics:
method_name: registerInstance
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object ]
impl: ark::ets::intrinsics::StdFinalizationRegistryRegisterInstance
@ -1838,7 +1835,7 @@ intrinsics:
method_name: resolveImpl
static: false
signature:
ret: std.core.void
ret: void
args: [std.core.Object]
impl: ark::ets::intrinsics::EtsPromiseResolve
@ -1848,7 +1845,7 @@ intrinsics:
method_name: rejectImpl
static: false
signature:
ret: std.core.void
ret: void
args: [std.core.Object]
impl: ark::ets::intrinsics::EtsPromiseReject
@ -1858,7 +1855,7 @@ intrinsics:
method_name: addToJobQueue
static: true
signature:
ret: std.core.void
ret: void
args: [std.core.Object]
impl: ark::ets::intrinsics::EtsPromiseAddToJobQueue
@ -1881,7 +1878,7 @@ intrinsics:
method_name: Schedule
static: true
signature:
ret: std.core.void
ret: void
args: []
impl: ark::ets::intrinsics::StdSystemScheduleCoroutine
@ -2065,7 +2062,7 @@ intrinsics:
method_name: setSchedulingPolicy
static: true
signature:
ret: std.core.void
ret: void
args: [i32]
impl: ark::ets::intrinsics::StdSystemSetCoroutineSchedulingPolicy
@ -2075,7 +2072,7 @@ intrinsics:
method_name: set
static: false
signature:
ret: std.core.void
ret: void
args: [u1]
impl: ark::ets::intrinsics::StdSystemAtomicFlagSet
@ -2410,7 +2407,7 @@ intrinsics:
method_name: TypeAPISetStaticFieldValue
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.String, std.core.String, std.core.Object ]
impl: ark::ets::intrinsics::TypeAPISetStaticFieldValue
@ -2706,7 +2703,7 @@ intrinsics:
method_name: ValueAPISetFieldObject
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, std.core.Object ]
impl: ark::ets::intrinsics::ValueAPISetFieldObject
@ -2716,7 +2713,7 @@ intrinsics:
method_name: ValueAPISetFieldBoolean
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, u1 ]
impl: ark::ets::intrinsics::ValueAPISetFieldBoolean
@ -2726,7 +2723,7 @@ intrinsics:
method_name: ValueAPISetFieldByte
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, i8 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByte
@ -2736,7 +2733,7 @@ intrinsics:
method_name: ValueAPISetFieldChar
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, u16 ]
impl: ark::ets::intrinsics::ValueAPISetFieldChar
@ -2746,7 +2743,7 @@ intrinsics:
method_name: ValueAPISetFieldShort
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, i16 ]
impl: ark::ets::intrinsics::ValueAPISetFieldShort
@ -2756,7 +2753,7 @@ intrinsics:
method_name: ValueAPISetFieldInt
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, i32 ]
impl: ark::ets::intrinsics::ValueAPISetFieldInt
@ -2766,7 +2763,7 @@ intrinsics:
method_name: ValueAPISetFieldLong
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, i64 ]
impl: ark::ets::intrinsics::ValueAPISetFieldLong
@ -2776,7 +2773,7 @@ intrinsics:
method_name: ValueAPISetFieldFloat
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, f32 ]
impl: ark::ets::intrinsics::ValueAPISetFieldFloat
@ -2786,7 +2783,7 @@ intrinsics:
method_name: ValueAPISetFieldDouble
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, f64 ]
impl: ark::ets::intrinsics::ValueAPISetFieldDouble
@ -2798,7 +2795,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameObject
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, std.core.Object ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameObject
@ -2808,7 +2805,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameBoolean
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, u1 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameBoolean
@ -2818,7 +2815,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameByte
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, i8 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameByte
@ -2828,7 +2825,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameChar
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, u16 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameChar
@ -2838,7 +2835,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameShort
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, i16 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameShort
@ -2848,7 +2845,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameInt
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, i32 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameInt
@ -2858,7 +2855,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameLong
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, i64 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameLong
@ -2868,7 +2865,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameFloat
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, f32 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameFloat
@ -2878,7 +2875,7 @@ intrinsics:
method_name: ValueAPISetFieldByNameDouble
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, std.core.String, f64 ]
impl: ark::ets::intrinsics::ValueAPISetFieldByNameDouble
@ -2900,7 +2897,7 @@ intrinsics:
method_name: ValueAPISetElementObject
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, std.core.Object ]
impl: ark::ets::intrinsics::ValueAPISetElementObject
@ -2910,7 +2907,7 @@ intrinsics:
method_name: ValueAPISetElementBoolean
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, u1 ]
impl: ark::ets::intrinsics::ValueAPISetElementBoolean
@ -2920,7 +2917,7 @@ intrinsics:
method_name: ValueAPISetElementByte
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, i8 ]
impl: ark::ets::intrinsics::ValueAPISetElementByte
@ -2930,7 +2927,7 @@ intrinsics:
method_name: ValueAPISetElementChar
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, u16 ]
impl: ark::ets::intrinsics::ValueAPISetElementChar
@ -2940,7 +2937,7 @@ intrinsics:
method_name: ValueAPISetElementShort
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, i16 ]
impl: ark::ets::intrinsics::ValueAPISetElementShort
@ -2950,7 +2947,7 @@ intrinsics:
method_name: ValueAPISetElementInt
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, i32 ]
impl: ark::ets::intrinsics::ValueAPISetElementInt
@ -2960,7 +2957,7 @@ intrinsics:
method_name: ValueAPISetElementLong
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, i64 ]
impl: ark::ets::intrinsics::ValueAPISetElementLong
@ -2970,7 +2967,7 @@ intrinsics:
method_name: ValueAPISetElementFloat
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, f32 ]
impl: ark::ets::intrinsics::ValueAPISetElementFloat
@ -2980,7 +2977,7 @@ intrinsics:
method_name: ValueAPISetElementDouble
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object, i64, f64 ]
impl: ark::ets::intrinsics::ValueAPISetElementDouble
@ -3095,7 +3092,7 @@ intrinsics:
method_name: destroyCtx
static: true
signature:
ret: std.core.void
ret: void
args: [ i64 ]
impl: ark::ets::intrinsics::TypeAPITypeCreatorCtxDestroy

View File

@ -31,7 +31,6 @@ static constexpr std::string_view EXCEPTION = "Lstd/c
static constexpr std::string_view CLASS = "Lstd/core/Class;";
static constexpr std::string_view OBJECT = "Lstd/core/Object;";
static constexpr std::string_view PROMISE = "Lstd/core/Promise;";
static constexpr std::string_view VOID = "Lstd/core/void;";
static constexpr std::string_view INTERNAL_UNDEFINED = "Lstd/core/__internal_undefined;";
static constexpr std::string_view STRING = "Lstd/core/String;";
static constexpr std::string_view WEAK_REF = "Lstd/core/WeakRef;";

View File

@ -30,7 +30,6 @@
#include "plugins/ets/runtime/napi/ets_napi_invoke_interface.h"
#include "plugins/ets/runtime/types/ets_method.h"
#include "plugins/ets/runtime/types/ets_string.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "runtime/compiler.h"
#include "runtime/include/thread_scopes.h"
#include "runtime/init_icu.h"
@ -245,7 +244,6 @@ bool PandaEtsVM::Initialize()
if (Thread::GetCurrent() != nullptr) {
ASSERT(GetThreadManager()->GetMainThread() == Thread::GetCurrent());
EtsCoroutine::GetCurrent()->SetUndefinedObject(GetUndefinedObject());
EtsVoid::Initialize();
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -20,6 +20,7 @@
#include <utility>
#include "runtime/include/vtable_builder-inl.h"
#include "runtime/include/runtime.h"
namespace ark::ets {
@ -35,11 +36,41 @@ struct EtsVTableSearchBySignature {
if (info1.GetName() != info2.GetName()) {
return false;
}
if (((info1.IsAbstract() ^ info2.IsAbstract()) != 0) && (info1.GetReturnType() == info2.GetReturnType()) &&
(info1.GetSourceLang() == info2.GetSourceLang())) {
return true;
if ((info1.IsAbstract() == info2.IsAbstract()) || (info1.GetSourceLang() != info2.GetSourceLang())) {
return false;
}
return false;
auto classLinker = Runtime::GetCurrent()->GetClassLinker();
auto const getClass = [classLinker](const MethodInfo &info, panda_file::ProtoDataAccessor pda, size_t idx) {
return classLinker->GetClass(info.GetProtoId().GetPandaFile(), pda.GetReferenceType(idx),
info.GetLoadContext());
};
panda_file::ProtoDataAccessor pda1(info1.GetProtoId().GetPandaFile(), info1.GetProtoId().GetEntityId());
panda_file::ProtoDataAccessor pda2(info2.GetProtoId().GetPandaFile(), info2.GetProtoId().GetEntityId());
if (info1.GetReturnType().IsReference() && info2.GetReturnType().IsReference()) {
auto cls1 = getClass(info1, pda1, 0);
auto cls2 = getClass(info2, pda2, 0);
ASSERT(cls1 != nullptr && cls2 != nullptr);
if (!cls2->IsAssignableFrom(cls1)) {
return false;
}
}
if ((pda1.GetNumArgs() == pda2.GetNumArgs()) && pda1.GetNumArgs() > 0) {
for (size_t idx = 0; idx < pda1.GetNumArgs(); idx++) {
if (pda1.GetArgType(idx) != pda2.GetArgType(idx)) {
return false;
}
if (!pda1.GetArgType(idx).IsReference()) {
continue;
}
auto cls1 = getClass(info1, pda1, idx + 1);
auto cls2 = getClass(info2, pda2, idx + 1);
if (!cls1->IsAssignableFrom(cls2)) {
return false;
}
}
}
return true;
}
};

View File

@ -140,10 +140,9 @@ InteropCtx::InteropCtx(EtsCoroutine *coro, napi_env env)
jsvalueFregistryRef_ = Refstor()->Add(queue->GetCoreType(), mem::Reference::ObjectType::GLOBAL);
ASSERT(jsvalueFregistryRef_ != nullptr);
jsvalueFregistryRegister_ =
queue->GetClass()
->GetMethod("register", "Lstd/core/Object;Lstd/core/Object;Lstd/core/Object;:Lstd/core/void;")
->GetPandaMethod();
jsvalueFregistryRegister_ = queue->GetClass()
->GetMethod("register", "Lstd/core/Object;Lstd/core/Object;Lstd/core/Object;:V")
->GetPandaMethod();
ASSERT(jsvalueFregistryRegister_ != nullptr);
}
@ -162,7 +161,6 @@ void InteropCtx::CacheClasses(EtsClassLinker *etsClassLinker)
jsErrorClass_ = CacheClass(etsClassLinker, descriptors::JS_ERROR);
objectClass_ = CacheClass(etsClassLinker, descriptors::OBJECT);
stringClass_ = CacheClass(etsClassLinker, descriptors::STRING);
voidClass_ = CacheClass(etsClassLinker, descriptors::VOID);
undefinedClass_ = CacheClass(etsClassLinker, descriptors::INTERNAL_UNDEFINED);
promiseClass_ = CacheClass(etsClassLinker, descriptors::PROMISE);
errorClass_ = CacheClass(etsClassLinker, descriptors::ERROR);

View File

@ -345,11 +345,6 @@ public:
return stringClass_;
}
Class *GetVoidClass() const
{
return voidClass_;
}
Class *GetUndefinedClass() const
{
return undefinedClass_;
@ -515,7 +510,6 @@ private:
Class *jsErrorClass_ {};
Class *objectClass_ {};
Class *stringClass_ {};
Class *voidClass_ {};
Class *undefinedClass_ {};
Class *promiseClass_ {};
Class *errorClass_ {};

View File

@ -16,7 +16,6 @@
#include "intrinsics.h"
#include "plugins/ets/runtime/interop_js/intrinsics_api.h"
#include "plugins/ets/runtime/types/ets_string.h"
#include "plugins/ets/runtime/types/ets_void.h"
namespace ark::ets::interop::js {
@ -110,18 +109,16 @@ static const IntrinsicsAPI S_INTRINSICS_API = {
static const IntrinsicsAPI *S_INTRINSICS_API = &notimpl::S_INTRINSICS_API;
PANDA_PUBLIC_API EtsVoid *JSRuntimeIntrinsicsSetIntrinsicsAPI(const IntrinsicsAPI *intrinsicsApi)
PANDA_PUBLIC_API void JSRuntimeIntrinsicsSetIntrinsicsAPI(const IntrinsicsAPI *intrinsicsApi)
{
S_INTRINSICS_API = intrinsicsApi;
return EtsVoid::GetInstance();
}
namespace intrinsics {
EtsVoid *JSRuntimeFinalizationRegistryCallbackIntrinsic(EtsObject *obj)
void JSRuntimeFinalizationRegistryCallbackIntrinsic(EtsObject *obj)
{
S_INTRINSICS_API->JSRuntimeFinalizationRegistryCallback(obj);
return EtsVoid::GetInstance();
}
JSValue *JSRuntimeNewJSValueDoubleIntrinsic(double v)
@ -184,28 +181,24 @@ uint8_t JSRuntimeGetPropertyBooleanIntrinsic(JSValue *etsJsValue, EtsString *ets
return static_cast<uint8_t>(S_INTRINSICS_API->JSRuntimeGetPropertyBoolean(etsJsValue, etsPropName));
}
EtsVoid *JSRuntimeSetPropertyJSValueIntrinsic(JSValue *etsJsValue, EtsString *etsPropName, JSValue *value)
void JSRuntimeSetPropertyJSValueIntrinsic(JSValue *etsJsValue, EtsString *etsPropName, JSValue *value)
{
S_INTRINSICS_API->JSRuntimeSetPropertyJSValue(etsJsValue, etsPropName, value);
return EtsVoid::GetInstance();
}
EtsVoid *JSRuntimeSetPropertyDoubleIntrinsic(JSValue *etsJsValue, EtsString *etsPropName, double value)
void JSRuntimeSetPropertyDoubleIntrinsic(JSValue *etsJsValue, EtsString *etsPropName, double value)
{
S_INTRINSICS_API->JSRuntimeSetPropertyDouble(etsJsValue, etsPropName, value);
return EtsVoid::GetInstance();
}
EtsVoid *JSRuntimeSetPropertyStringIntrinsic(JSValue *etsJsValue, EtsString *etsPropName, EtsString *value)
void JSRuntimeSetPropertyStringIntrinsic(JSValue *etsJsValue, EtsString *etsPropName, EtsString *value)
{
S_INTRINSICS_API->JSRuntimeSetPropertyString(etsJsValue, etsPropName, value);
return EtsVoid::GetInstance();
}
EtsVoid *JSRuntimeSetPropertyBooleanIntrinsic(JSValue *etsJsValue, EtsString *etsPropName, uint8_t value)
void JSRuntimeSetPropertyBooleanIntrinsic(JSValue *etsJsValue, EtsString *etsPropName, uint8_t value)
{
S_INTRINSICS_API->JSRuntimeSetPropertyBoolean(etsJsValue, etsPropName, static_cast<bool>(value));
return EtsVoid::GetInstance();
}
JSValue *JSRuntimeGetElementJSValueIntrinsic(JSValue *etsJsValue, int32_t index)

View File

@ -15,9 +15,6 @@ coretypes:
- managed_class: std.core.Object
mirror_class: ark::ets::EtsObject
- managed_class: std.core.void
mirror_class: ark::ets::EtsVoid
- managed_class: std.core.String
mirror_class: ark::ets::EtsString
@ -41,7 +38,7 @@ intrinsics:
method_name: finalizationRegistryCallback
static: true
signature:
ret: std.core.void
ret: void
args: [ std.core.Object ]
impl: ark::ets::interop::js::intrinsics::JSRuntimeFinalizationRegistryCallbackIntrinsic
clear_flags: [can_throw, heap_inv]
@ -190,7 +187,7 @@ intrinsics:
method_name: setPropertyJSValue
static: true
signature:
ret: std.core.void
ret: void
args: [ std.interop.js.JSValue, std.core.String, std.interop.js.JSValue ]
impl: ark::ets::interop::js::intrinsics::JSRuntimeSetPropertyJSValueIntrinsic
clear_flags: [can_throw, heap_inv]
@ -201,7 +198,7 @@ intrinsics:
method_name: setPropertyDouble
static: true
signature:
ret: std.core.void
ret: void
args: [ std.interop.js.JSValue, std.core.String, f64 ]
impl: ark::ets::interop::js::intrinsics::JSRuntimeSetPropertyDoubleIntrinsic
clear_flags: [can_throw, heap_inv]
@ -212,7 +209,7 @@ intrinsics:
method_name: setPropertyString
static: true
signature:
ret: std.core.void
ret: void
args: [ std.interop.js.JSValue, std.core.String, std.core.String ]
impl: ark::ets::interop::js::intrinsics::JSRuntimeSetPropertyStringIntrinsic
clear_flags: [can_throw, heap_inv]
@ -223,7 +220,7 @@ intrinsics:
method_name: setPropertyBoolean
static: true
signature:
ret: std.core.void
ret: void
args: [ std.interop.js.JSValue, std.core.String, u1 ]
impl: ark::ets::interop::js::intrinsics::JSRuntimeSetPropertyBooleanIntrinsic
clear_flags: [can_throw, heap_inv]
@ -748,7 +745,7 @@ intrinsics:
impl: ark::ets::interop::js::intrinsics::CompilerConvertLocalToJSValueIntrinsic
interop_intrinsic_kind: unwrap
clear_flags: [no_dce, can_throw, heap_inv]
- name: CompilerConvertLocalToString
space: ets
compiler_only: true

View File

@ -20,7 +20,6 @@
#include "plugins/ets/runtime/interop_js/intrinsics_api_impl.h"
#include "plugins/ets/runtime/interop_js/napi_env_scope.h"
#include "plugins/ets/runtime/types/ets_string.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "runtime/include/class_linker-inl.h"
namespace ark::ets::interop::js {
@ -132,9 +131,6 @@ static EtsObject *JSRuntimeGetValueObject(JSValue *etsJsValue, EtsObject *clsObj
// NOTE(kprokopenko): awful solution, see #14765
if (etsJsValue->AsObject() == ctx->GetUndefinedObject()) {
if (Class::FromClassObject(clsObj->GetCoreType()) == ctx->GetVoidClass()) {
return reinterpret_cast<EtsObject *>(EtsVoid::GetInstance());
}
return etsJsValue->AsObject();
}

View File

@ -295,18 +295,6 @@ JSCONVERT_UNWRAP(String)
return EtsString::CreateFromUtf8(value.data(), value.length());
}
JSCONVERT_DEFINE_TYPE(Void, EtsVoid *);
JSCONVERT_WRAP(Void)
{
napi_value jsVal;
NAPI_CHECK_FATAL(napi_get_undefined(env, &jsVal));
return jsVal;
}
JSCONVERT_UNWRAP(Void)
{
return EtsVoid::GetInstance();
}
JSCONVERT_DEFINE_TYPE(JSValue, JSValue *);
JSCONVERT_WRAP(JSValue)
{
@ -429,16 +417,6 @@ JSCONVERT_UNWRAP(ArrayBuffer)
return buf.GetPtr();
}
JSCONVERT_DEFINE_TYPE(EtsVoid, EtsVoid *);
JSCONVERT_WRAP(EtsVoid)
{
return GetUndefined(env);
}
JSCONVERT_UNWRAP(EtsVoid)
{
return EtsVoid::GetInstance();
}
JSCONVERT_DEFINE_TYPE(EtsUndefined, EtsObject *);
JSCONVERT_WRAP(EtsUndefined)
{

View File

@ -25,11 +25,9 @@
#include "plugins/ets/runtime/types/ets_arraybuffer.h"
#include "plugins/ets/runtime/types/ets_string.h"
#include "plugins/ets/runtime/types/ets_promise.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "plugins/ets/runtime/types/ets_box_primitive-inl.h"
#include "plugins/ets/runtime/interop_js/pending_promise_listener.h"
#include "plugins/ets/runtime/types/ets_method.h"
#include "types/ets_void.h"
namespace ark::ets::interop::js {

View File

@ -178,10 +178,10 @@ private:
static const ets_proxy::EtsClassWrapper::OverloadsMap W_ARRAY_OVERLOADS = {
{utf::CStringAsMutf8("at"), "I:Lstd/core/Object;"},
{utf::CStringAsMutf8("$_get"), "D:Lstd/core/Object;"},
{utf::CStringAsMutf8("$_set"), "DLstd/core/Object;:Lstd/core/void;"},
{utf::CStringAsMutf8("$_set"), "DLstd/core/Object;:V"},
{utf::CStringAsMutf8("with"), "DLstd/core/Object;:Lescompat/Array;"},
{utf::CStringAsMutf8("map"), "Lstd/core/Function1;:Lescompat/Array;"},
{utf::CStringAsMutf8("forEach"), "Lstd/core/Function1;:Lstd/core/void;"},
{utf::CStringAsMutf8("forEach"), "Lstd/core/Function1;:V"},
{utf::CStringAsMutf8("pop"), ":Lstd/core/Object;"},
{utf::CStringAsMutf8("fill"), "Lstd/core/Object;Lstd/core/Object;Lstd/core/Object;:Lescompat/Array;"},
{utf::CStringAsMutf8("flat"), ":Lescompat/Array;"},
@ -408,7 +408,6 @@ void RegisterBuiltinJSRefConvertors(InteropCtx *ctx)
RegisterBuiltinRefConvertor<JSConvertString>(cache, ctx->GetStringClass());
RegisterBuiltinRefConvertor<JSConvertPromise>(cache, ctx->GetPromiseClass());
RegisterBuiltinRefConvertor<JSConvertArrayBuffer>(cache, ctx->GetArrayBufferClass());
RegisterBuiltinRefConvertor<JSConvertEtsVoid>(cache, ctx->GetVoidClass());
RegisterBuiltinRefConvertor<JSConvertEtsUndefined>(cache, ctx->GetUndefinedClass());
RegisterBuiltinRefConvertor<JSConvertStdlibBoolean>(cache, linkerExt->GetBoxBooleanClass());

View File

@ -44,9 +44,6 @@ template <typename FUnwrapVal, typename FClsResolv, typename FStoreRef>
auto klass = resolveRefCls();
// start fastpath
if (klass == ctx->GetVoidClass()) {
return unwrapVal(helpers::TypeIdentity<JSConvertEtsVoid>());
}
if (klass == ctx->GetJSValueClass()) {
return unwrapVal(helpers::TypeIdentity<JSConvertJSValue>());
}
@ -161,9 +158,6 @@ template <typename FClsResolv, typename FStore, typename FRead>
ASSERT(resolveRefCls()->IsAssignableFrom(klass));
// start fastpath
if (klass == ctx->GetVoidClass()) {
return wrapRef(helpers::TypeIdentity<JSConvertEtsVoid>(), ref);
}
if (klass == ctx->GetJSValueClass()) {
return wrapRef(helpers::TypeIdentity<JSConvertJSValue>(), ref);
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -27,7 +27,6 @@
#include "plugins/ets/runtime/types/ets_array.h"
#include "plugins/ets/runtime/types/ets_shared_memory.h"
#include "plugins/ets/runtime/types/ets_shared_memory-inl.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "plugins/ets/runtime/ets_coroutine.h"
namespace ark::ets::intrinsics {
@ -42,10 +41,9 @@ extern "C" int8_t SharedMemoryAt(EtsSharedMemory *mem, int32_t index)
return mem->GetElement(index);
}
extern "C" EtsVoid *SharedMemorySet(EtsSharedMemory *mem, int32_t index, int8_t value)
extern "C" void SharedMemorySet(EtsSharedMemory *mem, int32_t index, int8_t value)
{
mem->SetElement(index, value);
return EtsVoid::GetInstance();
}
extern "C" int32_t SharedMemoryGetByteLength(EtsSharedMemory *mem)

View File

@ -23,7 +23,6 @@
#include "plugins/ets/runtime/types/ets_array.h"
#include "plugins/ets/runtime/types/ets_string.h"
#include "plugins/ets/runtime/types/ets_field.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "runtime/regexp/ecmascript/regexp_parser.h"
#include "runtime/include/mem/panda_string.h"
#include "runtime/handle_scope-inl.h"

View File

@ -27,7 +27,6 @@
#include "runtime/interpreter/runtime_interface.h"
#include "runtime/handle_scope.h"
#include "runtime/handle_scope-inl.h"
#include "plugins/ets/runtime/types/ets_void.h"
namespace ark::ets::intrinsics {
@ -74,10 +73,9 @@ extern "C" EtsArray *StdCoreStackTraceLines()
return reinterpret_cast<EtsArray *>(arrayHandle.GetPtr());
}
extern "C" EtsVoid *StdCorePrintStackTrace()
extern "C" void StdCorePrintStackTrace()
{
ark::PrintStackTrace();
return EtsVoid::GetInstance();
}
static PandaString ResolveLibraryName(const PandaString &name)
@ -90,13 +88,13 @@ static PandaString ResolveLibraryName(const PandaString &name)
#endif // PANDA_TARGET_UNIX
}
extern "C" EtsVoid *LoadLibrary(ark::ets::EtsString *name)
extern "C" void LoadLibrary(ark::ets::EtsString *name)
{
ASSERT(name->AsObject()->IsStringClass());
if (name->IsUtf16()) {
LOG(FATAL, RUNTIME) << "UTF-16 native library pathes are not supported";
return EtsVoid::GetInstance();
return;
}
auto coroutine = EtsCoroutine::GetCurrent();
@ -104,7 +102,7 @@ extern "C" EtsVoid *LoadLibrary(ark::ets::EtsString *name)
if (nameStr.empty()) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::FILE_NOT_FOUND_EXCEPTION,
"The native library path is empty");
return EtsVoid::GetInstance();
return;
}
ScopedNativeCodeThread snct(coroutine);
@ -118,17 +116,15 @@ extern "C" EtsVoid *LoadLibrary(ark::ets::EtsString *name)
ThrowEtsException(coroutine, panda_file_items::class_descriptors::EXCEPTION_IN_INITIALIZER_ERROR, ss.str());
}
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdSystemScheduleCoroutine()
extern "C" void StdSystemScheduleCoroutine()
{
auto *cm = static_cast<CoroutineManager *>(Coroutine::GetCurrent()->GetVM()->GetThreadManager());
cm->Schedule();
return ets::EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdSystemSetCoroutineSchedulingPolicy(int32_t policy)
extern "C" void StdSystemSetCoroutineSchedulingPolicy(int32_t policy)
{
constexpr auto POLICIES_MAPPING =
std::array {CoroutineSchedulingPolicy::DEFAULT, CoroutineSchedulingPolicy::NON_MAIN_WORKER};
@ -137,14 +133,11 @@ extern "C" EtsVoid *StdSystemSetCoroutineSchedulingPolicy(int32_t policy)
auto *cm = static_cast<CoroutineManager *>(Coroutine::GetCurrent()->GetVM()->GetThreadManager());
cm->SetSchedulingPolicy(newPolicy);
return ets::EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdSystemAtomicFlagSet(EtsAtomicFlag *instance, EtsBoolean v)
extern "C" void StdSystemAtomicFlagSet(EtsAtomicFlag *instance, EtsBoolean v)
{
instance->SetValue(v);
return ets::EtsVoid::GetInstance();
}
extern "C" EtsBoolean StdSystemAtomicFlagGet(EtsAtomicFlag *instance)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -23,8 +23,8 @@
namespace ark::ets::intrinsics {
template <typename T>
static EtsVoid *StdCoreCopyTo(coretypes::Array *src, coretypes::Array *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
static void StdCoreCopyTo(coretypes::Array *src, coretypes::Array *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
auto srcLen = static_cast<int32_t>(src->GetLength());
auto dstLen = static_cast<int32_t>(dst->GetLength());
@ -53,8 +53,6 @@ static EtsVoid *StdCoreCopyTo(coretypes::Array *src, coretypes::Array *dst, int3
auto *coroutine = EtsCoroutine::GetCurrent();
ThrowEtsException(coroutine, panda_file_items::class_descriptors::ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION, errmsg);
}
return static_cast<EtsVoid *>(nullptr);
}
extern "C" ObjectHeader *StdCoreAllocGenericArray(ets_int len)
@ -63,52 +61,52 @@ extern "C" ObjectHeader *StdCoreAllocGenericArray(ets_int len)
return EtsObjectArray::Create(klass, len)->GetCoreType();
}
extern "C" EtsVoid *StdCoreBoolCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
extern "C" void StdCoreBoolCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
return StdCoreCopyTo<uint8_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
StdCoreCopyTo<uint8_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
}
extern "C" EtsVoid *StdCoreCharCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
extern "C" void StdCoreCharCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
return StdCoreCopyTo<uint16_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
StdCoreCopyTo<uint16_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
}
extern "C" EtsVoid *StdCoreShortCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
extern "C" void StdCoreShortCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
return StdCoreCopyTo<uint16_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
StdCoreCopyTo<uint16_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
}
extern "C" EtsVoid *StdCoreByteCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
extern "C" void StdCoreByteCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
return StdCoreCopyTo<uint8_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
StdCoreCopyTo<uint8_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
}
extern "C" EtsVoid *StdCoreIntCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
extern "C" void StdCoreIntCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
return StdCoreCopyTo<uint32_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
StdCoreCopyTo<uint32_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
}
extern "C" EtsVoid *StdCoreLongCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
extern "C" void StdCoreLongCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
return StdCoreCopyTo<uint64_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
StdCoreCopyTo<uint64_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
}
extern "C" EtsVoid *StdCoreFloatCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
extern "C" void StdCoreFloatCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
return StdCoreCopyTo<uint32_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
StdCoreCopyTo<uint32_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
}
extern "C" EtsVoid *StdCoreDoubleCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
extern "C" void StdCoreDoubleCopyTo(EtsCharArray *src, EtsCharArray *dst, int32_t dstStart, int32_t srcStart,
int32_t srcEnd)
{
return StdCoreCopyTo<uint64_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
StdCoreCopyTo<uint64_t>(src->GetCoreType(), dst->GetCoreType(), dstStart, srcStart, srcEnd);
}
} // namespace ark::ets::intrinsics

View File

@ -17,7 +17,6 @@
#include <string_view>
#include "plugins/ets/runtime/ets_vm.h"
#include "plugins/ets/runtime/types/ets_string.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "libpandabase/utils/utf.h"
#include "intrinsics.h"
@ -30,60 +29,52 @@ constexpr const char *INF_LITERAL = "Infinity";
constexpr const char *NEGINF_LITERAL = "-Infinity";
} // namespace
extern "C" EtsVoid *StdConsolePrintln(ObjectHeader *header [[maybe_unused]])
extern "C" void StdConsolePrintln(ObjectHeader *header [[maybe_unused]])
{
std::cout << std::endl;
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintBool([[maybe_unused]] ObjectHeader *header, uint8_t b)
extern "C" void StdConsolePrintBool([[maybe_unused]] ObjectHeader *header, uint8_t b)
{
if (b != 0U) {
std::cout << "true";
} else {
std::cout << "false";
}
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintChar([[maybe_unused]] ObjectHeader *header, uint16_t c)
extern "C" void StdConsolePrintChar([[maybe_unused]] ObjectHeader *header, uint16_t c)
{
const utf::Utf8Char utf8Ch = utf::ConvertUtf16ToUtf8(c, 0, false);
std::cout << std::string_view(reinterpret_cast<const char *>(utf8Ch.ch.data()), utf8Ch.n);
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintString([[maybe_unused]] ObjectHeader *header, EtsString *str)
extern "C" void StdConsolePrintString([[maybe_unused]] ObjectHeader *header, EtsString *str)
{
ark::intrinsics::PrintString(str->GetCoreType());
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintI32([[maybe_unused]] ObjectHeader *header, int32_t v)
extern "C" void StdConsolePrintI32([[maybe_unused]] ObjectHeader *header, int32_t v)
{
ark::intrinsics::PrintI32(v);
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintI16([[maybe_unused]] ObjectHeader *header, int16_t v)
extern "C" void StdConsolePrintI16([[maybe_unused]] ObjectHeader *header, int16_t v)
{
ark::intrinsics::PrintI32(v);
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintI8([[maybe_unused]] ObjectHeader *header, int8_t v)
extern "C" void StdConsolePrintI8([[maybe_unused]] ObjectHeader *header, int8_t v)
{
ark::intrinsics::PrintI32(v);
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintI64([[maybe_unused]] ObjectHeader *header, int64_t v)
extern "C" void StdConsolePrintI64([[maybe_unused]] ObjectHeader *header, int64_t v)
{
ark::intrinsics::PrintI64(v);
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintF32([[maybe_unused]] ObjectHeader *header, float v)
extern "C" void StdConsolePrintF32([[maybe_unused]] ObjectHeader *header, float v)
{
auto coroutine = EtsCoroutine::GetCurrent();
[[maybe_unused]] EtsHandleScope scope(coroutine);
@ -101,10 +92,9 @@ extern "C" EtsVoid *StdConsolePrintF32([[maybe_unused]] ObjectHeader *header, fl
} else {
ark::intrinsics::PrintF32(v);
}
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdConsolePrintF64([[maybe_unused]] ObjectHeader *header, double v)
extern "C" void StdConsolePrintF64([[maybe_unused]] ObjectHeader *header, double v)
{
auto coroutine = EtsCoroutine::GetCurrent();
[[maybe_unused]] EtsHandleScope scope(coroutine);
@ -122,7 +112,6 @@ extern "C" EtsVoid *StdConsolePrintF64([[maybe_unused]] ObjectHeader *header, do
} else {
ark::intrinsics::PrintF64(v);
}
return EtsVoid::GetInstance();
}
} // namespace ark::ets::intrinsics

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -31,7 +31,6 @@
#include "types/ets_type_comptime_traits.h"
#include "types/ets_typeapi_create_panda_constants.h"
#include "types/ets_typeapi_method.h"
#include "types/ets_void.h"
#include "runtime/include/value-inl.h"
namespace ark::ets::intrinsics {
@ -78,9 +77,10 @@ EtsObject *TypeAPIMethodInvokeImplementation(EtsCoroutine *coro, EtsMethod *meth
if (res.IsReference()) {
return EtsObject::FromCoreType(res.GetAs<ObjectHeader *>());
}
if (meth->GetReturnValueType() == EtsType::VOID) {
// NOTE(kprokopenko): remove reinterpret_cast when void is synced with runtime
return reinterpret_cast<EtsObject *>(EtsVoid::GetInstance());
return reinterpret_cast<EtsObject *>(EtsCoroutine::GetCurrent()->GetUndefinedObject());
}
ASSERT(res.IsPrimitive());

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -21,9 +21,6 @@
#include "plugins/ets/runtime/types/ets_promise.h"
#include "plugins/ets/runtime/ets_handle_scope.h"
#include "plugins/ets/runtime/ets_handle.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "runtime/handle_scope-inl.h"
#include "runtime/handle_scope.h"
#include "plugins/ets/runtime/job_queue.h"
namespace ark::ets::intrinsics {
@ -53,51 +50,48 @@ static void OnPromiseCompletion(EtsCoroutine *coro, EtsHandle<EtsPromise> &promi
coro->GetPandaVM()->FirePromiseStateChanged(promise);
}
EtsVoid *EtsPromiseResolve(EtsPromise *promise, EtsObject *value)
void EtsPromiseResolve(EtsPromise *promise, EtsObject *value)
{
EtsCoroutine *coro = EtsCoroutine::GetCurrent();
if (promise == nullptr) {
LanguageContext ctx = Runtime::GetCurrent()->GetLanguageContext(panda_file::SourceLang::ETS);
ThrowNullPointerException(ctx, coro);
return EtsVoid::GetInstance();
return;
}
if (promise->GetState() != EtsPromise::STATE_PENDING) {
return EtsVoid::GetInstance();
return;
}
[[maybe_unused]] EtsHandleScope scope(coro);
EtsHandle<EtsPromise> hpromise(coro, promise);
EtsHandle<EtsObjectArray> thenQueue(coro, hpromise->GetThenQueue(coro));
hpromise->Resolve(coro, value);
OnPromiseCompletion(coro, hpromise, thenQueue, hpromise->GetThenQueueSize());
return EtsVoid::GetInstance();
}
EtsVoid *EtsPromiseReject(EtsPromise *promise, EtsObject *error)
void EtsPromiseReject(EtsPromise *promise, EtsObject *error)
{
EtsCoroutine *coro = EtsCoroutine::GetCurrent();
if (promise == nullptr) {
LanguageContext ctx = Runtime::GetCurrent()->GetLanguageContext(panda_file::SourceLang::ETS);
ThrowNullPointerException(ctx, coro);
return EtsVoid::GetInstance();
return;
}
if (promise->GetState() != EtsPromise::STATE_PENDING) {
return EtsVoid::GetInstance();
return;
}
[[maybe_unused]] EtsHandleScope scope(coro);
EtsHandle<EtsPromise> hpromise(coro, promise);
EtsHandle<EtsObjectArray> catchQueue(coro, hpromise->GetCatchQueue(coro));
hpromise->Reject(coro, error);
OnPromiseCompletion(coro, hpromise, catchQueue, hpromise->GetCatchQueueSize());
return EtsVoid::GetInstance();
}
EtsVoid *EtsPromiseAddToJobQueue(EtsObject *callback)
void EtsPromiseAddToJobQueue(EtsObject *callback)
{
auto *jobQueue = EtsCoroutine::GetCurrent()->GetPandaVM()->GetJobQueue();
if (jobQueue != nullptr) {
jobQueue->AddJob(callback);
}
return EtsVoid::GetInstance();
}
void EtsPromiseCreateLink(EtsObject *source, EtsPromise *target)

View File

@ -36,7 +36,6 @@
#include "types/ets_class.h"
#include "types/ets_method.h"
#include "types/ets_primitives.h"
#include "types/ets_void.h"
#include "types/ets_type.h"
#include "types/ets_type_comptime_traits.h"
#include "types/ets_typeapi.h"
@ -88,8 +87,6 @@ static EtsByte GetRefTypeKind(const PandaString &td, const EtsClass *refType)
result = static_cast<EtsByte>(EtsTypeAPIKind::UNION);
} else if (refType->IsUndefined()) {
result = static_cast<EtsByte>(EtsTypeAPIKind::UNDEFINED);
} else if (td == ark::ets::panda_file_items::class_descriptors::VOID) {
result = static_cast<EtsByte>(EtsTypeAPIKind::VOID);
} else {
result = static_cast<EtsByte>(EtsTypeAPIKind::CLASS);
}
@ -313,7 +310,7 @@ EtsObject *TypeAPIGetStaticFieldValue(EtsString *ownerTd, EtsString *name)
return EtsObject::FromCoreType(ownerType->GetRuntimeClass()->GetFieldObject(*field->GetCoreType()));
}
EtsVoid *TypeAPISetStaticFieldValue(EtsString *ownerTd, EtsString *name, EtsObject *v)
void TypeAPISetStaticFieldValue(EtsString *ownerTd, EtsString *name, EtsObject *v)
{
auto coroutine = EtsCoroutine::GetCurrent();
[[maybe_unused]] HandleScope<ObjectHeader *> scope(coroutine);
@ -345,7 +342,6 @@ EtsVoid *TypeAPISetStaticFieldValue(EtsString *ownerTd, EtsString *name, EtsObje
} else {
ownerType->GetRuntimeClass()->SetFieldObject(*field->GetCoreType(), valuePtr.GetPtr()->GetCoreType());
}
return EtsVoid::GetInstance();
}
EtsLong TypeAPIGetMethodsNum(EtsString *td)

View File

@ -35,7 +35,6 @@
#include "types/ets_primitives.h"
#include "types/ets_string.h"
#include "types/ets_typeapi_create_panda_constants.h"
#include "types/ets_void.h"
#include "types/ets_type.h"
#include "types/ets_typeapi.h"
#include "types/ets_typeapi_create.h"
@ -160,10 +159,9 @@ EtsLong TypeAPITypeCreatorCtxCreate()
return reinterpret_cast<ssize_t>(ret);
}
EtsVoid *TypeAPITypeCreatorCtxDestroy(EtsLong ctx)
void TypeAPITypeCreatorCtxDestroy(EtsLong ctx)
{
Runtime::GetCurrent()->GetInternalAllocator()->Delete(PtrFromLong<TypeCreatorCtx>(ctx));
return EtsVoid::GetInstance();
}
EtsString *TypeAPITypeCreatorCtxCommit(EtsLong ctxPtr, EtsArray *objects)
@ -502,11 +500,7 @@ EtsString *TypeAPITypeCreatorCtxMethodAddBodyDefault(EtsLong methodPtr)
if (ret.IsVoid()) {
fn.AddInstruction(pandasm::Create_RETURN_VOID());
} else if (ret.IsObject()) {
if (ret.GetDescriptor() == panda_file_items::class_descriptors::VOID) {
fn.AddInstruction(pandasm::Create_LDSTATIC_OBJ(m->Ctx()->GetRefVoidInstanceName()));
} else {
fn.AddInstruction(pandasm::Create_LDA_NULL());
}
fn.AddInstruction(pandasm::Create_LDA_NULL());
fn.AddInstruction(pandasm::Create_RETURN_OBJ());
// return EtsString::CreateFromMUtf8("can't make default return for object type");
} else if (ret.IsFloat32()) {

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -20,7 +20,6 @@
#include "plugins/ets/runtime/types/ets_object.h"
#include "plugins/ets/runtime/types/ets_string.h"
#include "plugins/ets/runtime/types/ets_box_primitive-inl.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "plugins/ets/runtime/ets_panda_file_items.h"
#include "types/ets_array.h"
#include "types/ets_box_primitive.h"
@ -34,7 +33,7 @@
namespace ark::ets::intrinsics {
EtsVoid *ValueAPISetFieldObject(EtsObject *obj, EtsLong i, EtsObject *val)
void ValueAPISetFieldObject(EtsObject *obj, EtsLong i, EtsObject *val)
{
auto coroutine = EtsCoroutine::GetCurrent();
[[maybe_unused]] HandleScope<ObjectHeader *> scope(coroutine);
@ -44,7 +43,6 @@ EtsVoid *ValueAPISetFieldObject(EtsObject *obj, EtsLong i, EtsObject *val)
auto typeClass = objHandle.GetPtr()->GetClass();
auto fieldObject = typeClass->GetFieldByIndex(i);
objHandle.GetPtr()->SetFieldObject(fieldObject, valHandle.GetPtr());
return EtsVoid::GetInstance();
}
template <typename T>
@ -63,55 +61,47 @@ void SetFieldValue(EtsObject *obj, EtsLong i, T val)
objHandle.GetPtr()->SetFieldPrimitive<T>(fieldObject, val);
}
EtsVoid *ValueAPISetFieldBoolean(EtsObject *obj, EtsLong i, EtsBoolean val)
void ValueAPISetFieldBoolean(EtsObject *obj, EtsLong i, EtsBoolean val)
{
SetFieldValue(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByte(EtsObject *obj, EtsLong i, EtsByte val)
void ValueAPISetFieldByte(EtsObject *obj, EtsLong i, EtsByte val)
{
SetFieldValue(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldShort(EtsObject *obj, EtsLong i, EtsShort val)
void ValueAPISetFieldShort(EtsObject *obj, EtsLong i, EtsShort val)
{
SetFieldValue(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldChar(EtsObject *obj, EtsLong i, EtsChar val)
void ValueAPISetFieldChar(EtsObject *obj, EtsLong i, EtsChar val)
{
SetFieldValue(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldInt(EtsObject *obj, EtsLong i, EtsInt val)
void ValueAPISetFieldInt(EtsObject *obj, EtsLong i, EtsInt val)
{
SetFieldValue(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldLong(EtsObject *obj, EtsLong i, EtsLong val)
void ValueAPISetFieldLong(EtsObject *obj, EtsLong i, EtsLong val)
{
SetFieldValue(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldFloat(EtsObject *obj, EtsLong i, EtsFloat val)
void ValueAPISetFieldFloat(EtsObject *obj, EtsLong i, EtsFloat val)
{
SetFieldValue(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldDouble(EtsObject *obj, EtsLong i, EtsDouble val)
void ValueAPISetFieldDouble(EtsObject *obj, EtsLong i, EtsDouble val)
{
SetFieldValue(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByNameObject(EtsObject *obj, EtsString *name, EtsObject *val)
void ValueAPISetFieldByNameObject(EtsObject *obj, EtsString *name, EtsObject *val)
{
auto coroutine = EtsCoroutine::GetCurrent();
[[maybe_unused]] HandleScope<ObjectHeader *> scope(coroutine);
@ -122,7 +112,6 @@ EtsVoid *ValueAPISetFieldByNameObject(EtsObject *obj, EtsString *name, EtsObject
auto typeClass = objHandle.GetPtr()->GetClass();
auto fieldObject = typeClass->GetFieldIDByName(nameHandle.GetPtr()->GetMutf8().c_str());
objHandle.GetPtr()->SetFieldObject(fieldObject, valHandle.GetPtr());
return EtsVoid::GetInstance();
}
template <typename T>
@ -142,52 +131,44 @@ void SetFieldByNameValue(EtsObject *obj, EtsString *name, T val)
objHandle.GetPtr()->SetFieldPrimitive<T>(fieldObject, val);
}
EtsVoid *ValueAPISetFieldByNameBoolean(EtsObject *obj, EtsString *name, EtsBoolean val)
void ValueAPISetFieldByNameBoolean(EtsObject *obj, EtsString *name, EtsBoolean val)
{
SetFieldByNameValue(obj, name, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByNameByte(EtsObject *obj, EtsString *name, EtsByte val)
void ValueAPISetFieldByNameByte(EtsObject *obj, EtsString *name, EtsByte val)
{
SetFieldByNameValue(obj, name, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByNameShort(EtsObject *obj, EtsString *name, EtsShort val)
void ValueAPISetFieldByNameShort(EtsObject *obj, EtsString *name, EtsShort val)
{
SetFieldByNameValue(obj, name, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByNameChar(EtsObject *obj, EtsString *name, EtsChar val)
void ValueAPISetFieldByNameChar(EtsObject *obj, EtsString *name, EtsChar val)
{
SetFieldByNameValue(obj, name, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByNameInt(EtsObject *obj, EtsString *name, EtsInt val)
void ValueAPISetFieldByNameInt(EtsObject *obj, EtsString *name, EtsInt val)
{
SetFieldByNameValue(obj, name, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByNameLong(EtsObject *obj, EtsString *name, EtsLong val)
void ValueAPISetFieldByNameLong(EtsObject *obj, EtsString *name, EtsLong val)
{
SetFieldByNameValue(obj, name, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByNameFloat(EtsObject *obj, EtsString *name, EtsFloat val)
void ValueAPISetFieldByNameFloat(EtsObject *obj, EtsString *name, EtsFloat val)
{
SetFieldByNameValue(obj, name, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetFieldByNameDouble(EtsObject *obj, EtsString *name, EtsDouble val)
void ValueAPISetFieldByNameDouble(EtsObject *obj, EtsString *name, EtsDouble val)
{
SetFieldByNameValue(obj, name, val);
return EtsVoid::GetInstance();
}
EtsObject *ValueAPIGetFieldObject(EtsObject *obj, EtsLong i)
@ -331,7 +312,7 @@ EtsLong ValueAPIGetArrayLength(EtsObject *obj)
return arrHandle->GetLength();
}
EtsVoid *ValueAPISetElementObject(EtsObject *obj, EtsLong i, EtsObject *val)
void ValueAPISetElementObject(EtsObject *obj, EtsLong i, EtsObject *val)
{
auto coroutine = EtsCoroutine::GetCurrent();
[[maybe_unused]] HandleScope<ObjectHeader *> scope(coroutine);
@ -339,7 +320,6 @@ EtsVoid *ValueAPISetElementObject(EtsObject *obj, EtsLong i, EtsObject *val)
VMHandle<EtsObject> valHandle(coroutine, val->GetCoreType());
arrHandle.GetPtr()->Set(i, valHandle.GetPtr());
return EtsVoid::GetInstance();
}
template <typename P, typename T>
@ -357,52 +337,44 @@ void SetElement(EtsObject *obj, EtsLong i, T val)
}
}
EtsVoid *ValueAPISetElementBoolean(EtsObject *obj, EtsLong i, EtsBoolean val)
void ValueAPISetElementBoolean(EtsObject *obj, EtsLong i, EtsBoolean val)
{
SetElement<EtsBooleanArray>(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetElementByte(EtsObject *obj, EtsLong i, EtsByte val)
void ValueAPISetElementByte(EtsObject *obj, EtsLong i, EtsByte val)
{
SetElement<EtsByteArray>(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetElementShort(EtsObject *obj, EtsLong i, EtsShort val)
void ValueAPISetElementShort(EtsObject *obj, EtsLong i, EtsShort val)
{
SetElement<EtsShortArray>(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetElementChar(EtsObject *obj, EtsLong i, EtsChar val)
void ValueAPISetElementChar(EtsObject *obj, EtsLong i, EtsChar val)
{
SetElement<EtsCharArray>(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetElementInt(EtsObject *obj, EtsLong i, EtsInt val)
void ValueAPISetElementInt(EtsObject *obj, EtsLong i, EtsInt val)
{
SetElement<EtsIntArray>(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetElementLong(EtsObject *obj, EtsLong i, EtsLong val)
void ValueAPISetElementLong(EtsObject *obj, EtsLong i, EtsLong val)
{
SetElement<EtsLongArray>(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetElementFloat(EtsObject *obj, EtsLong i, EtsFloat val)
void ValueAPISetElementFloat(EtsObject *obj, EtsLong i, EtsFloat val)
{
SetElement<EtsFloatArray>(obj, i, val);
return EtsVoid::GetInstance();
}
EtsVoid *ValueAPISetElementDouble(EtsObject *obj, EtsLong i, EtsDouble val)
void ValueAPISetElementDouble(EtsObject *obj, EtsLong i, EtsDouble val)
{
SetElement<EtsDoubleArray>(obj, i, val);
return EtsVoid::GetInstance();
}
EtsObject *ValueAPIGetElementObject(EtsObject *obj, EtsLong i)

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -15,7 +15,6 @@
#include "plugins/ets/runtime/ets_vm.h"
#include "runtime/include/thread.h"
#include "plugins/ets/runtime/types/ets_void.h"
namespace ark::ets::intrinsics {
@ -23,12 +22,11 @@ namespace ark::ets::intrinsics {
* The function register FinalizationRegistry instance in ETS VM.
* @param instance - FinalizationRegistry class instance needed to register for managing by GC.
*/
extern "C" EtsVoid *StdFinalizationRegistryRegisterInstance(EtsObject *instance)
extern "C" void StdFinalizationRegistryRegisterInstance(EtsObject *instance)
{
ManagedThread *thread = ManagedThread::GetCurrent();
ASSERT(thread != nullptr);
static_cast<PandaEtsVM *>(thread->GetVM())->RegisterFinalizationRegistryInstance(instance);
return EtsVoid::GetInstance();
}
} // namespace ark::ets::intrinsics

View File

@ -19,7 +19,6 @@
#include "plugins/ets/runtime/lambda_utils.h"
#include "plugins/ets/runtime/types/ets_method.h"
#include "plugins/ets/runtime/types/ets_object.h"
#include "plugins/ets/runtime/types/ets_void.h"
#include "plugins/ets/runtime/types/ets_string.h"
#include "runtime/include/thread.h"
#include "runtime/include/thread_scopes.h"
@ -221,12 +220,12 @@ extern "C" EtsLong StdGCStartGC(EtsInt cause, EtsObject *callback)
* @param gc_id - id of the GC which is returned by startGc.
* If gc_id is 0 or -1 the function returns immediately.
*/
extern "C" EtsVoid *StdGCWaitForFinishGC(EtsLong gcId)
extern "C" void StdGCWaitForFinishGC(EtsLong gcId)
{
ManagedThread *thread = ManagedThread::GetCurrent();
ASSERT(thread != nullptr);
if (gcId <= 0) {
return EtsVoid::GetInstance();
return;
}
auto id = static_cast<uint64_t>(gcId);
ASSERT(g_gGctaskTracker.IsInitialized());
@ -235,7 +234,6 @@ extern "C" EtsVoid *StdGCWaitForFinishGC(EtsLong gcId)
constexpr uint64_t WAIT_TIME_MS = 10;
os::thread::NativeSleep(WAIT_TIME_MS);
}
return EtsVoid::GetInstance();
}
extern "C" EtsBoolean StdGCIsScheduledGCTriggered()
@ -252,7 +250,7 @@ extern "C" EtsBoolean StdGCIsScheduledGCTriggered()
return ToEtsBoolean(schedTrigger->IsTriggered());
}
extern "C" EtsVoid *StdGCPostponeGCStart()
extern "C" void StdGCPostponeGCStart()
{
auto coroutine = EtsCoroutine::GetCurrent();
ASSERT(coroutine != nullptr);
@ -260,18 +258,17 @@ extern "C" EtsVoid *StdGCPostponeGCStart()
if (!gc->IsPostponeGCSupported()) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::UNSUPPORTED_OPERATION_EXCEPTION,
"GC postpone is not supported for this GC type");
return EtsVoid::GetInstance();
return;
}
if (gc->IsPostponeEnabled()) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::ILLEGAL_STATE_EXCEPTION,
"Calling postponeGCStart without calling postponeGCEnd");
return EtsVoid::GetInstance();
return;
}
gc->PostponeGCStart();
return EtsVoid::GetInstance();
}
extern "C" EtsVoid *StdGCPostponeGCEnd()
extern "C" void StdGCPostponeGCEnd()
{
auto coroutine = EtsCoroutine::GetCurrent();
ASSERT(coroutine != nullptr);
@ -279,15 +276,14 @@ extern "C" EtsVoid *StdGCPostponeGCEnd()
if (!gc->IsPostponeGCSupported()) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::UNSUPPORTED_OPERATION_EXCEPTION,
"GC postpone is not supported for this GC type");
return EtsVoid::GetInstance();
return;
}
if (!gc->IsPostponeEnabled()) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::ILLEGAL_STATE_EXCEPTION,
"Calling postponeGCEnd without calling postponeGCStart");
return EtsVoid::GetInstance();
return;
}
gc->PostponeGCEnd();
return EtsVoid::GetInstance();
}
template <class ResArrayType>
@ -384,14 +380,14 @@ extern "C" EtsInt StdGCGetObjectSpaceType(EtsObject *obj)
return SpaceTypeToIndex(objSpaceType);
}
extern "C" EtsVoid *StdGCPinObject(EtsObject *obj)
extern "C" void StdGCPinObject(EtsObject *obj)
{
auto *coroutine = EtsCoroutine::GetCurrent();
ASSERT(coroutine != nullptr);
if (obj == nullptr) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::NULL_POINTER_EXCEPTION,
"The value must be an object");
return EtsVoid::GetInstance();
return;
}
auto *vm = coroutine->GetVM();
@ -399,10 +395,9 @@ extern "C" EtsVoid *StdGCPinObject(EtsObject *obj)
if (!gc->IsPinningSupported()) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::UNSUPPORTED_OPERATION_EXCEPTION,
"Object pinning does not support with current gc");
return EtsVoid::GetInstance();
return;
}
vm->GetHeapManager()->PinObject(obj->GetCoreType());
return EtsVoid::GetInstance();
}
extern "C" void StdGCUnpinObject(EtsObject *obj)
@ -426,7 +421,7 @@ extern "C" EtsLong StdGCGetObjectAddress(EtsObject *obj)
// Function schedules GC before n-th allocation by setting counter to the specific GC trigger.
// Another call may reset the counter. In this case the last counter will be used to trigger the GC.
extern "C" EtsVoid *StdGCScheduleGCAfterNthAlloc(EtsInt counter, EtsInt cause)
extern "C" void StdGCScheduleGCAfterNthAlloc(EtsInt counter, EtsInt cause)
{
auto *coroutine = EtsCoroutine::GetCurrent();
ASSERT(coroutine != nullptr);
@ -434,13 +429,13 @@ extern "C" EtsVoid *StdGCScheduleGCAfterNthAlloc(EtsInt counter, EtsInt cause)
if (counter < 0) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::ILLEGAL_ARGUMENT_EXCEPTION,
"counter for allocation is negative");
return EtsVoid::GetInstance();
return;
}
GCTaskCause reason = GCCauseFromInt(cause);
if (reason == GCTaskCause::INVALID_CAUSE) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::ILLEGAL_ARGUMENT_EXCEPTION,
"Invalid GC cause");
return EtsVoid::GetInstance();
return;
}
auto *vm = coroutine->GetVM();
@ -449,18 +444,16 @@ extern "C" EtsVoid *StdGCScheduleGCAfterNthAlloc(EtsInt counter, EtsInt cause)
PandaStringStream eMsg;
eMsg << mem::GCStringFromType(gc->GetType()) << " does not support " << reason << " cause";
ThrowEtsException(coroutine, panda_file_items::class_descriptors::ILLEGAL_ARGUMENT_EXCEPTION, eMsg.str());
return EtsVoid::GetInstance();
return;
}
mem::GCTrigger *trigger = vm->GetGCTrigger();
if (trigger->GetType() != mem::GCTriggerType::ON_NTH_ALLOC) {
ThrowEtsException(coroutine, panda_file_items::class_descriptors::UNSUPPORTED_OPERATION_EXCEPTION,
"VM is running with unsupported GC trigger");
return EtsVoid::GetInstance();
return;
}
EtsVoid *voidInstance = EtsVoid::GetInstance();
auto schedTrigger = reinterpret_cast<mem::SchedGCOnNthAllocTrigger *>(trigger);
schedTrigger->ScheduleGc(reason, counter);
return voidInstance;
}
extern "C" EtsLong StdGetFreeHeapSize()

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -63,7 +63,6 @@ typedef ets_int ets_size;
// Reference Types
#ifdef __cplusplus
class __ets_object {};
class __ets_void : public __ets_object {};
class __ets_class : public __ets_object {};
class __ets_string : public __ets_object {};
class __ets_array : public __ets_object {};
@ -79,7 +78,6 @@ class __ets_doubleArray : public __ets_array {};
class __ets_error : public __ets_object {};
typedef __ets_object *ets_object;
typedef __ets_void *ets_void;
typedef __ets_class *ets_class;
typedef __ets_string *ets_string;
typedef __ets_array *ets_array;

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -238,8 +238,7 @@ static NapiType GeneralMethodCall(EtsEnv *env, ets_object obj, ets_method method
static void CheckMethodReturnType(ets_method methodId, EtsType type)
{
EtsMethod *method = ToInternalType(methodId);
if (method->GetReturnValueType() != type &&
(type != EtsType::VOID || method->GetReturnValueType() != EtsType::OBJECT)) {
if (method->GetReturnValueType() != type) {
LOG(FATAL, ETS_NAPI) << "Return type mismatch";
}
}
@ -577,7 +576,7 @@ NO_UB_SANITIZE static void ErrorDescribe(EtsEnv *env)
ETS_NAPI_ABORT_IF_NULL(consoleField);
auto consoleObj = env->GetStaticObjectField(coreGlobalClass, consoleField);
auto printlnMethod = env->Getp_method(consoleKlass, "println", "Lstd/core/String;:Lstd/core/void;");
auto printlnMethod = env->Getp_method(consoleKlass, "println", "Lstd/core/String;:V");
env->CallVoidMethod(consoleObj, printlnMethod, errorString);
env->ThrowError(error);
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -35,7 +35,6 @@ enum class AccessLevel { PUBLIC, PROTECTED, DEFAULT, PRIVATE };
class EtsMethod;
class EtsObject;
class EtsVoid;
class EtsString;
class EtsArray;
class EtsPromise;

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -20,6 +20,7 @@
namespace ark::ets {
// Primitive types association got from runtime/class_linker.cpp:InitializeFields()
using EtsVoid = void;
using EtsBoolean = uint8_t;
using EtsByte = int8_t;
using EtsChar = uint16_t;

View File

@ -146,24 +146,6 @@ pandasm::Record &TypeCreatorCtx::AddRefTypeAsExternal(const std::string &name)
return prog_.recordTable.emplace(objectRec.name, std::move(objectRec)).first->second;
}
std::string TypeCreatorCtx::GetRefVoidInstanceName()
{
pandasm::Record objectRec {typeapi_create_consts::TYPE_VOID.data(), SourceLanguage::ETS};
objectRec.metadata->SetAttribute(typeapi_create_consts::ATTR_EXTERNAL);
auto &voidRecord = prog_.recordTable.emplace(objectRec.name, std::move(objectRec)).first->second;
if (voidRecord.fieldList.empty()) {
pandasm::Field voidField {panda_file::SourceLang::ETS};
voidField.type = pandasm::Type {voidRecord.name, 0, true};
voidField.name = typeapi_create_consts::TYPE_VOID_FIELD;
voidField.metadata->SetAttribute(typeapi_create_consts::ATTR_STATIC);
voidField.metadata->SetAttribute(typeapi_create_consts::ATTR_EXTERNAL);
voidRecord.fieldList.emplace_back(std::move(voidField));
}
return voidRecord.name + '.' + voidRecord.fieldList.front().name;
}
const std::pair<std::string, std::string> &TypeCreatorCtx::DeclarePrimitive(const std::string &primTypeName)
{
if (auto found = primitiveTypesCtorDtor_.find(primTypeName); found != primitiveTypesCtorDtor_.end()) {

View File

@ -86,8 +86,6 @@ public:
pandasm::Record &AddRefTypeAsExternal(const std::string &name);
std::string GetRefVoidInstanceName();
/**
* Lazily declares primitive reference wrapper
* @returns pair of constructor and unwrapper

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -42,8 +42,6 @@ inline constexpr std::array<std::string_view, 2> ATTR_ABSTRACT_METHOD = {ATTR_AB
inline constexpr std::string_view TYPE_OBJECT = "std.core.Object";
inline constexpr std::string_view TYPE_BOXED_PREFIX = "std.core.";
inline constexpr std::string_view TYPE_VOID = "std.core.void";
inline constexpr std::string_view TYPE_VOID_FIELD = "void_instance";
inline constexpr std::string_view FUNCTION_GET_OBJECTS_FOR_CCTOR = "std.core.TypeCreatorCtx.getObjectsArrayForCCtor";
inline constexpr std::string_view TYPE_TYPE_CREATOR_CTX =

View File

@ -1,64 +0,0 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PANDA_RUNTIME_ETS_FFI_CLASSES_ETS_VOID_H_
#define PANDA_RUNTIME_ETS_FFI_CLASSES_ETS_VOID_H_
#include "plugins/ets/runtime/ets_panda_file_items.h"
#include "plugins/ets/runtime/ets_vm.h"
namespace ark::ets {
class EtsVoid : EtsObject {
public:
EtsVoid() = delete;
~EtsVoid() = delete;
// NOTE: vpukhov. replace with undefined or move to TLS
static EtsVoid *GetInstance()
{
EtsCoroutine *coro = EtsCoroutine::GetCurrent();
EtsClassLinker *classLinker = coro->GetPandaVM()->GetClassLinker();
EtsClass *voidClass = classLinker->GetVoidClass();
ASSERT(voidClass->IsInitialized()); // do not trigger gc!
EtsField *instanceField = voidClass->GetStaticFieldIDByName("void_instance");
return reinterpret_cast<EtsVoid *>(voidClass->GetStaticFieldObject(instanceField));
}
static void Initialize()
{
EtsCoroutine *coro = EtsCoroutine::GetCurrent();
EtsClassLinker *classLinker = coro->GetPandaVM()->GetClassLinker();
EtsClass *voidClass = classLinker->GetVoidClass();
if (!voidClass->IsInitialized()) {
classLinker->InitializeClass(coro, voidClass);
}
}
static EtsVoid *FromEtsObject(EtsObject *obj)
{
ASSERT(obj->GetClass() == EtsCoroutine::GetCurrent()->GetPandaVM()->GetClassLinker()->GetVoidClass());
return static_cast<EtsVoid *>(obj);
}
private:
NO_COPY_SEMANTIC(EtsVoid);
NO_MOVE_SEMANTIC(EtsVoid);
};
} // namespace ark::ets
#endif // PANDA_RUNTIME_ETS_FFI_CLASSES_ETS_VOID_H_

View File

@ -161,7 +161,7 @@ export final class Promise<out T> {
static resolve(): Promise<void> {
let p = new Promise<void>();
p.resolveImpl(Void);
p.resolveImpl(undefined);
return p;
}

View File

@ -178,9 +178,6 @@ export abstract class Type extends Object {
switch (kind) {
case TypeKind.NONE:
return null
case TypeKind.VOID:
return VoidType.REF
case TypeKind.CHAR:
return TypeAPIIsValueType(td) ? CharType.VAL : CharType.REF
case TypeKind.BOOLEAN:
@ -533,7 +530,7 @@ export abstract class Type extends Object {
return true
} else if (other.equals(ObjectType)) {
let isNullish = (this) instanceof UndefinedType || (this) instanceof NullType
return this.isReference() && !isNullish && !((this) instanceof VoidType)
return this.isReference() && !isNullish
}
return false
}
@ -725,85 +722,6 @@ export final class UndefinedType extends Type {
}
}
/**
* Represents void type
*/
export final class VoidType extends Type {
public static readonly REF: VoidType = new VoidType()
private constructor() {
this.td = TypeAPIGetTypeDescriptor(Void)
}
/**
* Checks whether type is primitive or composite
*
* @returns true if type is primitive and false otherwise
*/
public override isPrimitive(): boolean {
return true
}
/**
* Checks whether type is reference or composite
*
* @returns true if type is reference and false otherwise
*/
public override isReference(): boolean {
return true
}
/**
* Checks whether type has name
*
* @returns true if type has name
*/
public override hasName(): boolean {
return true
}
/**
* Returns name of type if exists and empty string otherwise
*
* @returns type name
*/
public override getName(): string {
return "void"
}
/**
* Returns literal of type if exists
*
* @returns type literal
*/
public override getLiteral(): string {
return "void"
}
/**
* Checks for equality this instance with provided object, treated as a VoidType
*
* @param to object to be checked against
*
* @returns true if object also has VoidType
*/
public override equals(to: NullishType): boolean {
return to instanceof VoidType
}
internal override convertObject(obj: NullishType): NullishType {
if (!this.assignableFrom(Type.of(obj))) {
throw new Error("invalid conversion")
}
return Void
}
}
/**
* Represents char type
*
* @note Boxed Char and primitive char both have CharType
*/
export final class CharType extends Type {
public static readonly VAL: CharType = new CharType(ValueTypeDesc.CHAR, true)
public static readonly REF: CharType = new CharType(TypeAPIGetTypeDescriptor(new Char()), false)

View File

@ -261,7 +261,7 @@ final class TypeCreatorCtx {
const pushToArr: (creator: Object) => void = (creator: Object): void => {
asArr.push(creator as TypeCreator)
}
const arr = all.forEach(Set.__asGeneric<TypeCreator>(pushToArr as Object))
all.forEach(Set.__asGeneric<TypeCreator>(pushToArr as Object))
for (let i = 0; i < asArr.length; i++) {
const el = asArr.$_get(i)
if (!visited.has(el)) {
@ -589,7 +589,7 @@ export final class InterfaceTypeCreator extends TypeCreator {
*/
export final class LambdaTypeCreator extends TypeCreator {
internal params: Array<ParameterCreator> = new Array<ParameterCreator>();
internal result: TypeOrCreator = TypeOrCreator.from(VoidType.REF)
internal result: TypeOrCreator;
private attrs: HasAttributes = new HasAttributes(new FreezableCreator(this), AllowedAttributes.LAMBDA)
/** default constructor */
@ -954,7 +954,7 @@ export final class ParameterCreator {
export final class MethodCreator {
internal name: string
internal params: Array<ParameterCreator> = new Array<ParameterCreator>();
internal result: TypeOrCreator = TypeOrCreator.from(VoidType.REF)
internal result: TypeOrCreator;
internal body: CallableBody | null = null
internal frozen: FreezableImpl = new FreezableImpl()
internal attrs: HasAttributes = new HasAttributes(this.frozen, AllowedAttributes.METHOD)

View File

@ -15,13 +15,6 @@
package std.core;
export final class void {
static readonly void_instance = new void();
private constructor() { }
}
export const Void = void.void_instance;
final class __internal_undefined {
private constructor() { };
@ -30,4 +23,4 @@ final class __internal_undefined {
public override equals(to: NullishType): boolean {
throw new Error("Internal error: undefined.equals was called!")
}
}
}

View File

@ -237,8 +237,6 @@ export abstract class Value extends Object {
return NullValue.INSTANCE
} else if (t instanceof UndefinedType) {
return UndefinedValue.INSTANCE
} else if (t instanceof VoidType) {
return VoidValue.INSTANCE
} else if (t instanceof ClassType) {
return new ClassValue(t as ClassType, o!)
} else if (t instanceof ArrayType) {
@ -969,21 +967,3 @@ export final class UndefinedValue extends Value {
return UndefinedType.REF.toString()
}
}
export final class VoidValue extends Value {
public static readonly INSTANCE = new VoidValue()
public override getType(): Type {
return VoidType.REF as Type
}
public override getData(): NullishType {
return Void
}
internal constructor() {}
public override toString(): string {
return VoidType.REF.toString()
}
}

View File

@ -158,7 +158,7 @@ if (PANDA_TARGET_AMD64 OR NOT PANDA_ARM64_TESTS_WITH_SANITIZER)
panda_add_checked_test_ets(FILE ${CMAKE_CURRENT_SOURCE_DIR}/ets_trunc.ets)
panda_add_checked_test_ets(FILE ${CMAKE_CURRENT_SOURCE_DIR}/ets_ceil.ets)
panda_add_checked_test_ets(FILE ${CMAKE_CURRENT_SOURCE_DIR}/checks_elimination_osr.ets)
#panda_add_checked_test_ets(FILE ${CMAKE_CURRENT_SOURCE_DIR}/cleanup_call_inlined.ets) #15642
panda_add_checked_test_ets(FILE ${CMAKE_CURRENT_SOURCE_DIR}/cleanup_call_inlined.ets)
panda_add_checked_test_ets(FILE ${CMAKE_CURRENT_SOURCE_DIR}/ets_isinteger.ets)
panda_add_checked_test_ets(FILE ${CMAKE_CURRENT_SOURCE_DIR}/hoist_loop_inv_bounds_check.ets)
panda_add_checked_test_ets(FILE ${CMAKE_CURRENT_SOURCE_DIR}/ets_string_length.ets)

View File

@ -26,7 +26,7 @@
//! METHOD "ETSGLOBAL::test_after_escape"
//! PASS_AFTER "Inline"
//! INST_COUNT /Call.*Inlined/, 9
//! INST_COUNT /ReturnInlined/, 9
//! INST_COUNT /ReturnInlined/, 13
//! PASS_AFTER "EscapeAnalysis"
//! PASS_AFTER_NEXT "Cleanup"
//! INST_NOT /Inlined/

View File

@ -1,5 +1,5 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -160,106 +160,88 @@ extern "C" ets_int SkoalaCanvas1nSave([[maybe_unused]] EtsEnv *env, [[maybe_unus
{
return 1;
}
extern "C" ets_void SkoalaDrawPicture([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long picture /*KNativePointer*/,
[[maybe_unused]] ets_long data /*KNativePointer*/,
[[maybe_unused]] ets_object cb /*any*/, [[maybe_unused]] ets_boolean sync)
extern "C" void SkoalaDrawPicture([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long picture /*KNativePointer*/,
[[maybe_unused]] ets_long data /*KNativePointer*/,
[[maybe_unused]] ets_object cb /*any*/, [[maybe_unused]] ets_boolean sync)
{
return ets_void();
}
extern "C" ets_void SkoalaProvidePeerFactory([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long func /*KNativePointer*/,
[[maybe_unused]] ets_long arg /*KNativePointer*/)
extern "C" void SkoalaProvidePeerFactory([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long func /*KNativePointer*/,
[[maybe_unused]] ets_long arg /*KNativePointer*/)
{
return ets_void();
}
extern "C" ets_void SkoalaSetPlatformApi([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_object api /*any*/)
extern "C" void SkoalaSetPlatformApi([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_object api /*any*/)
{
return ets_void();
}
extern "C" ets_void SkoalaCanvas1nDrawDrawable([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long drawablePtr /*KNativePointer*/,
[[maybe_unused]] ets_long matrixArr /*KFloatPtr*/)
extern "C" void SkoalaCanvas1nDrawDrawable([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long drawablePtr /*KNativePointer*/,
[[maybe_unused]] ets_long matrixArr /*KFloatPtr*/)
{
return ets_void();
}
extern "C" ets_void SkoalaCanvas1nRestore([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/)
extern "C" void SkoalaCanvas1nRestore([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/)
{
return ets_void();
}
extern "C" ets_void SkoalaPaint1nSetColor([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_int color)
extern "C" void SkoalaPaint1nSetColor([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/, [[maybe_unused]] ets_int color)
{
return ets_void();
}
extern "C" ets_void SkoalaCanvas1nDrawOval([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long canvasPtr /*KNativePointer*/,
[[maybe_unused]] ets_float left, [[maybe_unused]] ets_float top,
[[maybe_unused]] ets_float right, [[maybe_unused]] ets_float bottom,
[[maybe_unused]] ets_long paintPtr /*KNativePointer*/)
extern "C" void SkoalaCanvas1nDrawOval([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long canvasPtr /*KNativePointer*/,
[[maybe_unused]] ets_float left, [[maybe_unused]] ets_float top,
[[maybe_unused]] ets_float right, [[maybe_unused]] ets_float bottom,
[[maybe_unused]] ets_long paintPtr /*KNativePointer*/)
{
return ets_void();
}
extern "C" ets_void SkoalaParagraphParagraphBuilder1nPushStyle(
[[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass, [[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long textStylePtr /*KNativePointer*/)
extern "C" void SkoalaParagraphParagraphBuilder1nPushStyle([[maybe_unused]] EtsEnv *env,
[[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long textStylePtr /*KNativePointer*/)
{
return ets_void();
}
extern "C" ets_void SkoalaParagraphParagraphBuilder1nAddText([[maybe_unused]] EtsEnv *env,
[[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long textString /*KStringPtr*/)
extern "C" void SkoalaParagraphParagraphBuilder1nAddText([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long textString /*KStringPtr*/)
{
return ets_void();
}
extern "C" ets_void SkoalaParagraphFontCollection1nSetDefaultFontManager(
extern "C" void SkoalaParagraphFontCollection1nSetDefaultFontManager(
[[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass, [[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long fontManagerPtr /*KNativePointer*/,
[[maybe_unused]] ets_long defaultFamilyNameStr /*KStringPtr*/)
{
return ets_void();
}
extern "C" ets_void SkoalaParagraphParagraph1nLayout([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_float width)
extern "C" void SkoalaParagraphParagraph1nLayout([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_float width)
{
return ets_void();
}
extern "C" ets_void SkoalaParagraphParagraph1nPaint([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long canvasPtr /*KNativePointer*/,
[[maybe_unused]] ets_float x, [[maybe_unused]] ets_float y)
extern "C" void SkoalaParagraphParagraph1nPaint([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_long canvasPtr /*KNativePointer*/,
[[maybe_unused]] ets_float x, [[maybe_unused]] ets_float y)
{
return ets_void();
}
extern "C" ets_void SkoalaParagraphTextStyle1nSetColor([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_int color)
extern "C" void SkoalaParagraphTextStyle1nSetColor([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_int color)
{
return ets_void();
}
extern "C" ets_void SkoalaParagraphTextStyle1nSetFontSize([[maybe_unused]] EtsEnv *env,
[[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_float size)
extern "C" void SkoalaParagraphTextStyle1nSetFontSize([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long ptr /*KNativePointer*/,
[[maybe_unused]] ets_float size)
{
return ets_void();
}
extern "C" ets_void SkoalaImplManagedInvokeFinalizer([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long finalizer /*KNativePointer*/,
[[maybe_unused]] ets_long obj /*KNativePointer*/)
extern "C" void SkoalaImplManagedInvokeFinalizer([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long finalizer /*KNativePointer*/,
[[maybe_unused]] ets_long obj /*KNativePointer*/)
{
return ets_void();
}
extern "C" ets_void SkoalaEnqueueRun([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long redrawerPeerPtr /*KNativePointer*/)
extern "C" void SkoalaEnqueueRun([[maybe_unused]] EtsEnv *env, [[maybe_unused]] ets_class klass,
[[maybe_unused]] ets_long redrawerPeerPtr /*KNativePointer*/)
{
return ets_void();
}
// NOLINTEND(google-runtime-int)

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -0,0 +1,31 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is equal to null or undefined, then NullPointerError is thrown.
---*/
function main(): void {
let i: Int|undefined|null = 5;
let ii: Int|undefined|null = null;
try {
(1 ? ii : i)!;
assert 0;
} catch(npe: NullPointerException) {
assert 1;
} catch(e) {
assert 0;
}
}

View File

@ -0,0 +1,31 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is equal to null or undefined, then NullPointerError is thrown.
---*/
function main(): void {
let i: Int|undefined = 5;
let ii: Int|undefined = undefined;
try {
(1 ? ii : i)!;
assert 0;
} catch(npe: NullPointerException) {
assert 1;
} catch(e) {
assert 0;
}
}

View File

@ -0,0 +1,31 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is equal to null or undefined, then NullPointerError is thrown.
---*/
function main(): void {
let i: Int|null = 5;
let ii: Int|null = null;
try {
(1 ? ii : i)!;
assert 0;
} catch(npe: NullPointerException) {
assert 1;
} catch(e) {
assert 0;
}
}

View File

@ -0,0 +1,30 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: The type of ensure-not-nullish expression is the non-nullish variant of the type of e.
---*/
function main(): void {
let i: Int|undefined = undefined;
try {
let ii = i!;
assert 0;
} catch(npe: NullPointerException) {
assert 1;
} catch(e) {
assert 0;
}
}

View File

@ -0,0 +1,26 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: The type of ensure-not-nullish expression is the non-nullish variant of the type of e. A compile-time error occurs if e is not a nullable type.
tags: [negative, compile-only]
---*/
function main(): void {
let i: Int|undefined = 4;
let ii = i!;
i = undefined;
ii = undefined;
}

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -19,7 +19,7 @@ desc: nullable Cast T | null -> T with ensure not-null expression. not-null valu
function main(): void {
let a: Int | null = new Int(1);
let b: Int = a!;
let b: Int = a! as Int;
assert b == 1;
}

View File

@ -22,7 +22,7 @@ function main(): void {
let res: int = 0;
try {
let b: Int = a!;
let b: Int = a! as Int;
res = 0;
} catch (e: NullPointerException) {
res = 1;

View File

@ -0,0 +1,23 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is not equal to null or undefined, then the result of e! is the outcome of the evaluation of e.
---*/
function main(): void {
let a: Int | undefined = 5;
assert a! == 5;
}

View File

@ -0,0 +1,24 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is not equal to null or undefined, then the result of e! is the outcome of the evaluation of e.
---*/
function main(): void {
let i: Int|undefined = 5;
let ii: Int|undefined = undefined;
assert (0 ? ii : i)!;
}

View File

@ -0,0 +1,24 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is not equal to null or undefined, then the result of e! is the outcome of the evaluation of e.
---*/
function main(): void {
let i: Int|null = 5;
let ii: Int|null = null;
assert (0 ? ii : i)!;
}

View File

@ -0,0 +1,24 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is not equal to null or undefined, then the result of e! is the outcome of the evaluation of e.
---*/
function main(): void {
let i: Int|null|undefined = 5;
let ii: Int|null|undefined = undefined;
assert (0 ? ii : i)!;
}

View File

@ -0,0 +1,24 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is not equal to null or undefined, then the result of e! is the outcome of the evaluation of e.
---*/
function main(): void {
let i: Int|undefined|null = 5;
let ii: Int|undefined|null = null;
assert (0 ? ii : i)!;
}

View File

@ -0,0 +1,25 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: If the result of the evaluation of e is not equal to null or undefined, then the result of e! is the outcome of the evaluation of e.
---*/
class A {}
function main(): void {
let i: A|undefined|null = new A();
assert i! instanceof A;
}

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -0,0 +1,27 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: null safety -> Null-Coalescing Operator.
tags: [negative, compile-only]
---*/
function main(): void {
let a: int = 0;
let b: int = 0;
let c: Int = 0;
let d: Int = 0;
let res = ((a ?? b) ?? (c ?? d));
}

View File

@ -0,0 +1,37 @@
/*---
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---*/
/*---
desc: The type of a nullish-coalescing expression is the least upper bound (see Least Upper Bound) of the non-nullish variant of the types of the left-hand-side and right-hand-side expressions.
---*/
abstract class ACA {}
abstract class ACB {}
class CAA extends ACA {}
class CAB extends ACA {}
class CAAA extends CAA {}
class CAAB extends CAA {}
class CBA extends ACB {}
class CBB extends ACB {}
class CBBA extends CBB {}
class CBBB extends CBB {}
function main(): void {
let a: CAAA | null = null;
let b: CBBB = new CBBB();
let c = a ?? b;
assert c instanceof ACB;
}

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@ -20,13 +20,9 @@ assert: The type of null-coalescing expression is the least upper bound of the n
class A {}
function foo(p: A): int {
return 2;
}
function main(): void {
let a : A = new A();
let b : A = new A();
let c = a ?? b;
assert(foo(c) == 2);
assert c instanceof A;
}

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@ -20,13 +20,9 @@ assert: The type of null-coalescing expression is the least upper bound of the n
class A {}
function foo(p: Object): int {
return 1;
}
function main(): void {
let a : A = new A();
let b : Int = 2;
let c = a ?? b;
assert(foo(c) == 1);
assert a instanceof A;
}

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@ -22,29 +22,17 @@ class BA extends A {}
class CBA extends BA {}
class DA extends A {}
function foo(p: Object): int {
return 1;
}
function foo(p: A): int {
return 2;
}
function foo(p: BA): int {
return 3;
}
function main(): void {
let a: CBA = new CBA();
let b: DA = new DA();
let c = a ?? b;
assert(foo(c) == 2);
assert c instanceof CBA;
let d: A = new A();
let e = a ?? d;
assert(foo(e) == 2);
assert e instanceof CBA;
let f: BA = new BA();
let g = a ?? f;
assert(foo(g) == 3);
assert e instanceof BA;
}

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/*---
Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Copyright (c) 2021-2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

Some files were not shown because too many files have changed in this diff Show More