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 "tsBigintKeyword.h"
17
18 #include "checker/ETSchecker.h"
19 #include "compiler/core/ETSGen.h"
20 #include "compiler/core/pandagen.h"
21 #include "ir/astDump.h"
22 #include "ir/srcDump.h"
23 #include "checker/TSchecker.h"
24
25 namespace ark::es2panda::ir {
TransformChildren(const NodeTransformer & cb,std::string_view const transformationName)26 void TSBigintKeyword::TransformChildren([[maybe_unused]] const NodeTransformer &cb,
27 [[maybe_unused]] std::string_view const transformationName)
28 {
29 for (auto *&it : VectorIterationGuard(Annotations())) {
30 if (auto *transformedNode = cb(it); it != transformedNode) {
31 it->SetTransformedNode(transformationName, transformedNode);
32 it = transformedNode->AsAnnotationUsage();
33 }
34 }
35 }
36
Iterate(const NodeTraverser & cb) const37 void TSBigintKeyword::Iterate([[maybe_unused]] const NodeTraverser &cb) const
38 {
39 for (auto *it : VectorIterationGuard(Annotations())) {
40 cb(it);
41 }
42 }
43
Dump(ir::AstDumper * dumper) const44 void TSBigintKeyword::Dump(ir::AstDumper *dumper) const
45 {
46 dumper->Add({{"type", "TSBigIntKeyword"}, {"annotations", AstDumper::Optional(Annotations())}});
47 }
48
Dump(ir::SrcDumper * dumper) const49 void TSBigintKeyword::Dump(ir::SrcDumper *dumper) const
50 {
51 for (auto *anno : Annotations()) {
52 anno->Dump(dumper);
53 }
54 dumper->Add("TSBigintKeyword");
55 }
56
Compile(compiler::PandaGen * pg) const57 void TSBigintKeyword::Compile([[maybe_unused]] compiler::PandaGen *pg) const
58 {
59 pg->GetAstCompiler()->Compile(this);
60 }
Compile(compiler::ETSGen * etsg) const61 void TSBigintKeyword::Compile(compiler::ETSGen *etsg) const
62 {
63 etsg->GetAstCompiler()->Compile(this);
64 }
65
Check(checker::TSChecker * checker)66 checker::Type *TSBigintKeyword::Check([[maybe_unused]] checker::TSChecker *checker)
67 {
68 return checker->GetAnalyzer()->Check(this);
69 }
70
GetType(checker::TSChecker * checker)71 checker::Type *TSBigintKeyword::GetType([[maybe_unused]] checker::TSChecker *checker)
72 {
73 return checker->GlobalBigintType();
74 }
75
Check(checker::ETSChecker * checker)76 checker::VerifiedType TSBigintKeyword::Check([[maybe_unused]] checker::ETSChecker *checker)
77 {
78 return {this, checker->GetAnalyzer()->Check(this)};
79 }
80 } // namespace ark::es2panda::ir
81