arkcompiler_ets_runtime/ecmascript/jspandafile/js_pandafile_executor.h
changjiaxing ac226d6806 Refactoring ConcatFileNameWithMerge
issues:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I6BAYD

Signed-off-by: changjiaxing <changjiaxing2@huawei.com>
Change-Id: If11dc13131ef60d4760b31b68d2f7a6ce50c9597
2023-02-01 11:27:49 +08:00

42 lines
2.3 KiB
C++

/*
* Copyright (c) 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 ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H
#define ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H
#include "ecmascript/js_tagged_value.h"
#include "ecmascript/js_thread.h"
#include "ecmascript/jspandafile/js_pandafile.h"
#include "ecmascript/module/js_module_source_text.h"
namespace panda::ecmascript {
class JSPandaFileExecutor {
public:
static Expected<JSTaggedValue, bool> ExecuteFromFile(JSThread *thread, const CString &filename,
std::string_view entryPoint, bool needUpdate = false,
bool excuteFromJob = false);
static Expected<JSTaggedValue, bool> ExecuteFromBuffer(JSThread *thread, const void *buffer, size_t size,
std::string_view entryPoint, const CString &filename = "",
bool needUpdate = false);
static Expected<JSTaggedValue, bool> ExecuteModuleBuffer(JSThread *thread, const void *buffer, size_t size,
const CString &filename = "");
static Expected<JSTaggedValue, bool> CommonExecuteBuffer(JSThread *thread, bool isBundle, const CString &filename,
const CString &entry, const void *buffer, size_t size);
static Expected<JSTaggedValue, bool> Execute(JSThread *thread, const JSPandaFile *jsPandaFile,
std::string_view entryPoint, bool excuteFromJob = false);
};
} // namespace panda::ecmascript
#endif // ECMASCRIPT_JSPANDAFILE_JS_PANDAFILE_EXECUTOR_H