• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "plugins/ets/runtime/interop_js/interop_context.h"
17 #include "plugins/ets/runtime/interop_js/interop_common.h"
18 
19 namespace ark::ets::interop::js {
20 
InteropFatal(const char * message)21 [[noreturn]] void InteropFatal(const char *message)
22 {
23     InteropCtx::Fatal(message);
24     UNREACHABLE();
25 }
26 
InteropFatal(const std::string & message)27 [[noreturn]] void InteropFatal(const std::string &message)
28 {
29     InteropCtx::Fatal(message.c_str());
30     UNREACHABLE();
31 }
32 
InteropFatal(const char * message,napi_status status)33 [[noreturn]] void InteropFatal(const char *message, napi_status status)
34 {
35     InteropCtx::Fatal(std::string(message) + " status=" + std::to_string(status));
36     UNREACHABLE();
37 }
38 
InteropTrace(const char * func,const char * file,int line)39 void InteropTrace(const char *func, const char *file, int line)
40 {
41     INTEROP_LOG(DEBUG) << "trace: " << func << ":" << file << ":" << line;
42 }
43 
44 }  // namespace ark::ets::interop::js
45 
46 namespace ark::ets::ts2ets::GlobalCtx {  // NOLINT(readability-identifier-naming)
47 
Init()48 void Init()
49 {
50     interop::js::InteropCtx::Init(EtsCoroutine::GetCurrent(), nullptr);
51 }
52 
53 }  // namespace ark::ets::ts2ets::GlobalCtx
54