• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2022 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 "tsExternalModuleReference.h"
17 
18 #include "checker/TSchecker.h"
19 #include "compiler/core/ETSGen.h"
20 #include "compiler/core/pandagen.h"
21 #include "ir/astDump.h"
22 #include "ir/srcDump.h"
23 
24 namespace panda::es2panda::ir {
TransformChildren(const NodeTransformer & cb)25 void TSExternalModuleReference::TransformChildren(const NodeTransformer &cb)
26 {
27     expr_ = cb(expr_)->AsExpression();
28 }
29 
Iterate(const NodeTraverser & cb) const30 void TSExternalModuleReference::Iterate(const NodeTraverser &cb) const
31 {
32     cb(expr_);
33 }
34 
Dump(ir::AstDumper * dumper) const35 void TSExternalModuleReference::Dump(ir::AstDumper *dumper) const
36 {
37     dumper->Add({{"type", "TSExternalModuleReference"}, {"expression", expr_}});
38 }
39 
Dump(ir::SrcDumper * dumper) const40 void TSExternalModuleReference::Dump(ir::SrcDumper *dumper) const
41 {
42     dumper->Add("TSExternalModuleReference");
43 }
44 
Compile(compiler::PandaGen * pg) const45 void TSExternalModuleReference::Compile(compiler::PandaGen *pg) const
46 {
47     pg->GetAstCompiler()->Compile(this);
48 }
49 
Compile(compiler::ETSGen * etsg) const50 void TSExternalModuleReference::Compile(compiler::ETSGen *etsg) const
51 {
52     etsg->GetAstCompiler()->Compile(this);
53 }
54 
Check(checker::TSChecker * checker)55 checker::Type *TSExternalModuleReference::Check(checker::TSChecker *checker)
56 {
57     return checker->GetAnalyzer()->Check(this);
58 }
59 
Check(checker::ETSChecker * checker)60 checker::Type *TSExternalModuleReference::Check(checker::ETSChecker *checker)
61 {
62     return checker->GetAnalyzer()->Check(this);
63 }
64 }  // namespace panda::es2panda::ir
65