1b1994897Sopenharmony_ci/** 2b1994897Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3b1994897Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4b1994897Sopenharmony_ci * you may not use this file except in compliance with the License. 5b1994897Sopenharmony_ci * You may obtain a copy of the License at 6b1994897Sopenharmony_ci * 7b1994897Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8b1994897Sopenharmony_ci * 9b1994897Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10b1994897Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11b1994897Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12b1994897Sopenharmony_ci * See the License for the specific language governing permissions and 13b1994897Sopenharmony_ci * limitations under the License. 14b1994897Sopenharmony_ci */ 15b1994897Sopenharmony_ci 16b1994897Sopenharmony_ci#ifndef PANDA_ASSEMBLER_EXTENSIONS_REGISTER_EXTENSIONS_H 17b1994897Sopenharmony_ci#define PANDA_ASSEMBLER_EXTENSIONS_REGISTER_EXTENSIONS_H 18b1994897Sopenharmony_ci 19b1994897Sopenharmony_ci#include "extensions/extensions.h" 20b1994897Sopenharmony_ci#include "extensions/ecmascript_meta.h" 21b1994897Sopenharmony_ci 22b1994897Sopenharmony_cinamespace panda::pandasm::extensions { 23b1994897Sopenharmony_cistd::unique_ptr<panda::pandasm::RecordMetadata> MetadataExtension::CreateRecordMetadata(panda::panda_file::SourceLang lang) 24b1994897Sopenharmony_ci{ 25b1994897Sopenharmony_ci switch (lang) { 26b1994897Sopenharmony_ci case Language::ECMASCRIPT: 27b1994897Sopenharmony_ci return std::make_unique<panda::pandasm::extensions::ecmascript::RecordMetadata>(); 28b1994897Sopenharmony_ci case Language::PANDA_ASSEMBLY: 29b1994897Sopenharmony_ci return std::make_unique<panda::pandasm::RecordMetadata>(); 30b1994897Sopenharmony_ci default: 31b1994897Sopenharmony_ci break; 32b1994897Sopenharmony_ci } 33b1994897Sopenharmony_ci 34b1994897Sopenharmony_ci UNREACHABLE(); 35b1994897Sopenharmony_ci return {}; 36b1994897Sopenharmony_ci} 37b1994897Sopenharmony_ci 38b1994897Sopenharmony_cistd::unique_ptr<panda::pandasm::FieldMetadata> MetadataExtension::CreateFieldMetadata(panda::panda_file::SourceLang lang) 39b1994897Sopenharmony_ci{ 40b1994897Sopenharmony_ci switch (lang) { 41b1994897Sopenharmony_ci case Language::ECMASCRIPT: 42b1994897Sopenharmony_ci return std::make_unique<panda::pandasm::FieldMetadata>(); 43b1994897Sopenharmony_ci case Language::PANDA_ASSEMBLY: 44b1994897Sopenharmony_ci return std::make_unique<panda::pandasm::FieldMetadata>(); 45b1994897Sopenharmony_ci default: 46b1994897Sopenharmony_ci break; 47b1994897Sopenharmony_ci } 48b1994897Sopenharmony_ci 49b1994897Sopenharmony_ci UNREACHABLE(); 50b1994897Sopenharmony_ci return {}; 51b1994897Sopenharmony_ci} 52b1994897Sopenharmony_ci 53b1994897Sopenharmony_cistd::unique_ptr<panda::pandasm::FunctionMetadata> MetadataExtension::CreateFunctionMetadata(panda::panda_file::SourceLang lang) 54b1994897Sopenharmony_ci{ 55b1994897Sopenharmony_ci switch (lang) { 56b1994897Sopenharmony_ci case Language::ECMASCRIPT: 57b1994897Sopenharmony_ci return std::make_unique<panda::pandasm::FunctionMetadata>(); 58b1994897Sopenharmony_ci case Language::PANDA_ASSEMBLY: 59b1994897Sopenharmony_ci return std::make_unique<panda::pandasm::FunctionMetadata>(); 60b1994897Sopenharmony_ci default: 61b1994897Sopenharmony_ci break; 62b1994897Sopenharmony_ci } 63b1994897Sopenharmony_ci 64b1994897Sopenharmony_ci UNREACHABLE(); 65b1994897Sopenharmony_ci return {}; 66b1994897Sopenharmony_ci} 67b1994897Sopenharmony_ci 68b1994897Sopenharmony_cistd::unique_ptr<panda::pandasm::ParamMetadata> MetadataExtension::CreateParamMetadata(panda::panda_file::SourceLang lang) 69b1994897Sopenharmony_ci{ 70b1994897Sopenharmony_ci switch (lang) { 71b1994897Sopenharmony_ci case Language::ECMASCRIPT: 72b1994897Sopenharmony_ci return std::make_unique<panda::pandasm::ParamMetadata>(); 73b1994897Sopenharmony_ci case Language::PANDA_ASSEMBLY: 74b1994897Sopenharmony_ci return std::make_unique<panda::pandasm::ParamMetadata>(); 75b1994897Sopenharmony_ci default: 76b1994897Sopenharmony_ci break; 77b1994897Sopenharmony_ci } 78b1994897Sopenharmony_ci 79b1994897Sopenharmony_ci UNREACHABLE(); 80b1994897Sopenharmony_ci return {}; 81b1994897Sopenharmony_ci} 82b1994897Sopenharmony_ci} // namespace panda::pandasm::extensions 83b1994897Sopenharmony_ci#endif // PANDA_ASSEMBLER_EXTENSIONS_REGISTER_EXTENSIONS_H 84