1/* 2 * Copyright (c) 2021 - 2023 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#ifndef ES2PANDA_COMPILER_CORE_JSCOMPILER_H 17#define ES2PANDA_COMPILER_CORE_JSCOMPILER_H 18 19#include "compiler/core/ASTCompiler.h" 20#include "util/bitset.h" 21 22namespace ark::es2panda::ir { 23class AstNode; 24} // namespace ark::es2panda::ir 25namespace ark::es2panda::compiler { 26 27class JSCompiler final : public AstCompiler { 28public: 29 JSCompiler() = default; 30 31// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) 32#define DECLARE_JSCOMPILER_COMPILE_METHOD(_, nodeType) void Compile(const ir::nodeType *node) const override; 33 AST_NODE_MAPPING(DECLARE_JSCOMPILER_COMPILE_METHOD) 34#undef DECLARE_JSCOMPILER_COMPILE_METHOD 35 36// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) 37#define DECLARE_JSCOMPILER_COMPILE_METHOD(_, __, nodeType, ___) void Compile(const ir::nodeType *node) const override; 38 AST_NODE_REINTERPRET_MAPPING(DECLARE_JSCOMPILER_COMPILE_METHOD) 39#undef DECLARE_JSCOMPILER_COMPILE_METHOD 40 void CompileStaticProperties(compiler::PandaGen *pg, util::BitSet *compiled, 41 const ir::ObjectExpression *expr) const; 42 void CompileRemainingProperties(compiler::PandaGen *pg, const util::BitSet *compiled, 43 const ir::ObjectExpression *expr) const; 44 45private: 46 PandaGen *GetPandaGen() const; 47}; 48 49} // namespace ark::es2panda::compiler 50 51#endif // ES2PANDA_COMPILER_CORE_JSCOMPILER_H 52