代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony-SIG/arkcompiler_ets_frontend 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/**
* Copyright (c) 2021 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_recordTable_RECORD_TABLE_H
#define ES2PANDA_recordTable_RECORD_TABLE_H
#include "macros.h"
#include "utils/arena_containers.h"
#include "plugins/ecmascript/es2panda/util/ustring.h"
#include "plugins/ecmascript/es2panda/util/enumbitops.h"
namespace panda::es2panda::parser {
class Program;
} // namespace panda::es2panda::parser
namespace panda::es2panda::checker {
class Signature;
} // namespace panda::es2panda::checker
namespace panda::es2panda::ir {
class ClassDefinition;
class TSInterfaceDeclaration;
class Identifier;
} // namespace panda::es2panda::ir
namespace panda::es2panda::binder {
class FunctionScope;
class BoundContext;
enum class RecordTableFlags : uint32_t {
NONE = 0U,
EXTERNAL = 1U << 0U,
};
DEFINE_BITOPS(RecordTableFlags)
class RecordTable {
public:
explicit RecordTable(ArenaAllocator *allocator, parser::Program *program, RecordTableFlags flags)
: class_definitions_(allocator->Adapter()),
interface_declarations_(allocator->Adapter()),
signatures_(allocator->Adapter()),
program_(program),
flags_(flags)
{
}
NO_COPY_SEMANTIC(RecordTable);
NO_MOVE_SEMANTIC(RecordTable);
~RecordTable() = default;
bool IsExternal() const
{
return (flags_ & RecordTableFlags::EXTERNAL) != 0;
}
ArenaUnorderedSet<ir::ClassDefinition *> &ClassDefinitions()
{
return class_definitions_;
}
const ArenaUnorderedSet<ir::ClassDefinition *> &ClassDefinitions() const
{
return class_definitions_;
}
ArenaUnorderedSet<ir::TSInterfaceDeclaration *> &InterfaceDeclarations()
{
return interface_declarations_;
}
const ArenaUnorderedSet<ir::TSInterfaceDeclaration *> &InterfaceDeclarations() const
{
return interface_declarations_;
}
ArenaVector<FunctionScope *> &Signatures()
{
return signatures_;
}
const ArenaVector<FunctionScope *> &Signatures() const
{
return signatures_;
}
void SetClassDefinition(ir::ClassDefinition *class_definition)
{
record_ = class_definition;
}
ir::ClassDefinition *ClassDefinition()
{
return std::holds_alternative<ir::ClassDefinition *>(record_) ? std::get<ir::ClassDefinition *>(record_)
: nullptr;
}
const ir::ClassDefinition *ClassDefinition() const
{
return std::holds_alternative<ir::ClassDefinition *>(record_) ? std::get<ir::ClassDefinition *>(record_)
: nullptr;
}
void SetInterfaceDeclaration(ir::TSInterfaceDeclaration *interface_declaration)
{
record_ = interface_declaration;
}
ir::TSInterfaceDeclaration *InterfaceDeclaration()
{
return std::holds_alternative<ir::TSInterfaceDeclaration *>(record_)
? std::get<ir::TSInterfaceDeclaration *>(record_)
: nullptr;
}
const ir::TSInterfaceDeclaration *InterfaceDeclaration() const
{
return std::holds_alternative<ir::TSInterfaceDeclaration *>(record_)
? std::get<ir::TSInterfaceDeclaration *>(record_)
: nullptr;
}
void SetProgram(parser::Program *program)
{
program_ = program;
}
parser::Program *Program()
{
return program_;
}
const parser::Program *Program() const
{
return program_;
}
util::StringView RecordName() const;
private:
friend class BoundContext;
using RecordHolder = std::variant<ir::ClassDefinition *, ir::TSInterfaceDeclaration *, std::nullptr_t>;
ArenaUnorderedSet<ir::ClassDefinition *> class_definitions_;
ArenaUnorderedSet<ir::TSInterfaceDeclaration *> interface_declarations_;
ArenaVector<binder::FunctionScope *> signatures_;
RecordHolder record_ {nullptr};
parser::Program *program_ {};
BoundContext *bound_ctx_ {};
RecordTableFlags flags_ {};
};
class BoundContext {
public:
explicit BoundContext(RecordTable *record_table, ir::ClassDefinition *class_def);
explicit BoundContext(RecordTable *record_table, ir::TSInterfaceDeclaration *interface_decl);
~BoundContext();
NO_COPY_SEMANTIC(BoundContext);
NO_MOVE_SEMANTIC(BoundContext);
void *operator new(size_t) = delete;
void *operator new[](size_t) = delete;
util::StringView FormRecordName() const;
private:
BoundContext *prev_;
RecordTable *record_table_;
RecordTable::RecordHolder saved_record_ {nullptr};
ir::Identifier *record_ident_;
};
} // namespace panda::es2panda::binder
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。