• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 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 #include "etsStructDeclaration.h"
17 
18 #include "checker/TSchecker.h"
19 #include "compiler/core/pandagen.h"
20 #include "compiler/core/ETSGen.h"
21 
22 namespace ark::es2panda::ir {
Dump(ir::AstDumper * dumper) const23 void ETSStructDeclaration::Dump(ir::AstDumper *dumper) const
24 {
25     dumper->Add({{"type", "ETSStructDeclaration"},
26                  {"definition", Definition()},
27                  {"decorators", AstDumper::Optional(Decorators())}});
28 }
29 
Dump(ir::SrcDumper * dumper) const30 void ETSStructDeclaration::Dump(ir::SrcDumper *dumper) const
31 {
32     if (Definition() != nullptr) {
33         Definition()->Dump(dumper);
34     }
35 }
36 
Check(checker::TSChecker * checker)37 checker::Type *ETSStructDeclaration::Check([[maybe_unused]] checker::TSChecker *checker)
38 {
39     ES2PANDA_UNREACHABLE();
40 }
41 
Check(checker::ETSChecker * checker)42 checker::VerifiedType ETSStructDeclaration::Check([[maybe_unused]] checker::ETSChecker *checker)
43 {
44     ES2PANDA_ASSERT(checker->IsAnyError());
45     return {this, checker->GetAnalyzer()->Check(this)};
46 }
47 }  // namespace ark::es2panda::ir
48