代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony-SIG/arkcompiler_ets_frontend 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/**
* 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 ES2PANDA_AOT_OPTIONS_H
#define ES2PANDA_AOT_OPTIONS_H
#include "libpandabase/os/file.h"
#include "plugins/ecmascript/es2panda/es2panda.h"
#include <exception>
#include <fstream>
#include <iostream>
namespace panda {
class PandArgParser;
class PandaArg;
} // namespace panda
namespace panda::es2panda::aot {
enum class OptionFlags : uint32_t {
DEFAULT = 0U,
PARSE_ONLY = 1U << 0U,
PARSE_MODULE = 1U << 1U,
SIZE_STAT = 1U << 2U,
};
inline std::underlying_type_t<OptionFlags> operator&(OptionFlags a, OptionFlags b)
{
using Utype = std::underlying_type_t<OptionFlags>;
/* NOLINTNEXTLINE(hicpp-signed-bitwise) */
return static_cast<Utype>(static_cast<Utype>(a) & static_cast<Utype>(b));
}
inline OptionFlags &operator|=(OptionFlags &a, OptionFlags b)
{
using Utype = std::underlying_type_t<OptionFlags>;
/* NOLINTNEXTLINE(hicpp-signed-bitwise) */
return a = static_cast<OptionFlags>(static_cast<Utype>(a) | static_cast<Utype>(b));
}
template <class T>
T BaseName(T const &path)
{
return path.substr(path.find_last_of(panda::os::file::File::GetPathDelim()) + 1);
}
class Options {
public:
Options();
NO_COPY_SEMANTIC(Options);
NO_MOVE_SEMANTIC(Options);
~Options();
bool Parse(int argc, const char **argv);
es2panda::ScriptExtension Extension() const
{
return extension_;
}
const es2panda::CompilerOptions &CompilerOptions() const
{
return compiler_options_;
}
const std::string &ParserInput() const
{
return parser_input_;
}
const std::string &CompilerOutput() const
{
return compiler_output_;
}
void SetCompilerOutput(const std::string &compiler_output)
{
compiler_output_ = compiler_output;
}
const std::string &LogLevel() const
{
return log_level_;
}
const std::string &SourceFile() const
{
return source_file_;
}
const std::string &ErrorMsg() const
{
return error_msg_;
}
int OptLevel() const
{
return opt_level_;
}
int ThreadCount() const
{
return thread_count_;
}
bool ParseModule() const
{
return (options_ & OptionFlags::PARSE_MODULE) != 0;
}
bool ParseOnly() const
{
return (options_ & OptionFlags::PARSE_ONLY) != 0;
}
bool SizeStat() const
{
return (options_ & OptionFlags::SIZE_STAT) != 0;
}
bool IsDynamic() const
{
return extension_ != es2panda::ScriptExtension::ETS;
}
bool ListFiles() const
{
return list_files_;
}
private:
es2panda::ScriptExtension extension_ {es2panda::ScriptExtension::JS};
es2panda::CompilerOptions compiler_options_ {};
OptionFlags options_ {OptionFlags::DEFAULT};
panda::PandArgParser *argparser_;
std::string parser_input_;
std::string compiler_output_;
std::string log_level_;
std::string result_;
std::string source_file_;
std::string error_msg_;
int opt_level_ {0};
int thread_count_ {0};
bool list_files_ {false};
};
} // namespace panda::es2panda::aot
#endif // AOT_OPTIONS_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。