From c3769060c7e4dfaa1d0460ce8a5a2ae91efaf1d7 Mon Sep 17 00:00:00 2001 From: Vivien Voros Date: Thu, 19 Oct 2023 11:54:38 +0200 Subject: [PATCH] Compile logic is moved to JSCompiler and ETSCompiler classes. Check logic with their helper functions is moved to TSAnalyzer and ETSAnalyzer classes. TSModuleDeclaration, TSParameterProperty, TSTypePredicate, TSTypeParameterInstantiation, TSTypeParameterDeclaration, TSTypeParameter, TSTypeOperator Linked Internal issue: 13840 Change-Id: I80892fb253f16733c821fcef16f6a3a76b39d347 Signed-off-by: Vivien Voros --- ets2panda/checker/ETSAnalyzer.cpp | 29 +++++-------------- ets2panda/checker/TSAnalyzer.cpp | 21 +++++--------- ets2panda/compiler/core/ETSCompiler.cpp | 21 +++++--------- ets2panda/compiler/core/JSCompiler.cpp | 21 +++++--------- ets2panda/ir/ts/tsModuleDeclaration.cpp | 17 +++++++++-- ets2panda/ir/ts/tsModuleDeclaration.h | 1 + ets2panda/ir/ts/tsParameterProperty.cpp | 16 ++++++++-- ets2panda/ir/ts/tsParameterProperty.h | 1 + ets2panda/ir/ts/tsTypeOperator.cpp | 16 ++++++++-- ets2panda/ir/ts/tsTypeOperator.h | 1 + ets2panda/ir/ts/tsTypeParameter.cpp | 16 ++++++++-- ets2panda/ir/ts/tsTypeParameter.h | 1 + .../ir/ts/tsTypeParameterDeclaration.cpp | 16 ++++++++-- ets2panda/ir/ts/tsTypeParameterDeclaration.h | 1 + .../ir/ts/tsTypeParameterInstantiation.cpp | 16 ++++++++-- .../ir/ts/tsTypeParameterInstantiation.h | 1 + ets2panda/ir/ts/tsTypePredicate.cpp | 16 ++++++++-- ets2panda/ir/ts/tsTypePredicate.h | 1 + 18 files changed, 127 insertions(+), 85 deletions(-) diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index ec729cf229..a2f4303841 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -20,14 +20,6 @@ #include "checker/ETSchecker.h" #include "checker/ets/castingContext.h" #include "checker/ets/typeRelationContext.h" -#include "ir/base/catchClause.h" -#include "ir/base/classProperty.h" -#include "ir/base/classStaticBlock.h" -#include "ir/expressions/identifier.h" -#include "ir/expressions/objectExpression.h" -#include "ir/expressions/arrayExpression.h" -#include "ir/statements/blockStatement.h" -#include "ir/statements/returnStatement.h" #include "util/helpers.h" namespace panda::es2panda::checker { @@ -1087,9 +1079,8 @@ checker::Type *ETSAnalyzer::Check(ir::TSModuleBlock *st) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSModuleDeclaration *st) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSModuleDeclaration *st) const { - (void)st; UNREACHABLE(); } @@ -1129,9 +1120,8 @@ checker::Type *ETSAnalyzer::Check(ir::TSObjectKeyword *node) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSParameterProperty *expr) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSParameterProperty *expr) const { - (void)expr; UNREACHABLE(); } @@ -1183,33 +1173,28 @@ checker::Type *ETSAnalyzer::Check(ir::TSTypeLiteral *node) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSTypeOperator *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeOperator *node) const { - (void)node; UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSTypeParameter *expr) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameter *expr) const { - (void)expr; UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSTypeParameterDeclaration *expr) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameterDeclaration *expr) const { - (void)expr; UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSTypeParameterInstantiation *expr) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameterInstantiation *expr) const { - (void)expr; UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSTypePredicate *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSTypePredicate *node) const { - (void)node; UNREACHABLE(); } diff --git a/ets2panda/checker/TSAnalyzer.cpp b/ets2panda/checker/TSAnalyzer.cpp index d3e96e821f..4a9067cce3 100644 --- a/ets2panda/checker/TSAnalyzer.cpp +++ b/ets2panda/checker/TSAnalyzer.cpp @@ -803,9 +803,8 @@ checker::Type *TSAnalyzer::Check(ir::TSModuleBlock *st) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSModuleDeclaration *st) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSModuleDeclaration *st) const { - (void)st; UNREACHABLE(); } @@ -845,9 +844,8 @@ checker::Type *TSAnalyzer::Check(ir::TSObjectKeyword *node) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSParameterProperty *expr) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSParameterProperty *expr) const { - (void)expr; UNREACHABLE(); } @@ -899,33 +897,28 @@ checker::Type *TSAnalyzer::Check(ir::TSTypeLiteral *node) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSTypeOperator *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypeOperator *node) const { - (void)node; UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSTypeParameter *expr) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameter *expr) const { - (void)expr; UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSTypeParameterDeclaration *expr) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameterDeclaration *expr) const { - (void)expr; UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSTypeParameterInstantiation *expr) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypeParameterInstantiation *expr) const { - (void)expr; UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSTypePredicate *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSTypePredicate *node) const { - (void)node; UNREACHABLE(); } diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index 46dd096ae8..c2f13fbdeb 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -816,9 +816,8 @@ void ETSCompiler::Compile(const ir::TSModuleBlock *st) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSModuleDeclaration *st) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSModuleDeclaration *st) const { - (void)st; UNREACHABLE(); } @@ -858,9 +857,8 @@ void ETSCompiler::Compile(const ir::TSObjectKeyword *node) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSParameterProperty *expr) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSParameterProperty *expr) const { - (void)expr; UNREACHABLE(); } @@ -912,33 +910,28 @@ void ETSCompiler::Compile(const ir::TSTypeLiteral *node) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSTypeOperator *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSTypeOperator *node) const { - (void)node; UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSTypeParameter *expr) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSTypeParameter *expr) const { - (void)expr; UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSTypeParameterDeclaration *expr) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSTypeParameterDeclaration *expr) const { - (void)expr; UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSTypeParameterInstantiation *expr) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSTypeParameterInstantiation *expr) const { - (void)expr; UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSTypePredicate *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSTypePredicate *node) const { - (void)node; UNREACHABLE(); } diff --git a/ets2panda/compiler/core/JSCompiler.cpp b/ets2panda/compiler/core/JSCompiler.cpp index 10a894d364..b794fb1704 100644 --- a/ets2panda/compiler/core/JSCompiler.cpp +++ b/ets2panda/compiler/core/JSCompiler.cpp @@ -1101,9 +1101,8 @@ void JSCompiler::Compile(const ir::TSModuleBlock *st) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSModuleDeclaration *st) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSModuleDeclaration *st) const { - (void)st; UNREACHABLE(); } @@ -1143,9 +1142,8 @@ void JSCompiler::Compile(const ir::TSObjectKeyword *node) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSParameterProperty *expr) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSParameterProperty *expr) const { - (void)expr; UNREACHABLE(); } @@ -1197,33 +1195,28 @@ void JSCompiler::Compile(const ir::TSTypeLiteral *node) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSTypeOperator *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSTypeOperator *node) const { - (void)node; UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSTypeParameter *expr) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSTypeParameter *expr) const { - (void)expr; UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSTypeParameterDeclaration *expr) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSTypeParameterDeclaration *expr) const { - (void)expr; UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSTypeParameterInstantiation *expr) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSTypeParameterInstantiation *expr) const { - (void)expr; UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSTypePredicate *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSTypePredicate *node) const { - (void)node; UNREACHABLE(); } diff --git a/ets2panda/ir/ts/tsModuleDeclaration.cpp b/ets2panda/ir/ts/tsModuleDeclaration.cpp index bc8abb3a0c..25ad9e6570 100644 --- a/ets2panda/ir/ts/tsModuleDeclaration.cpp +++ b/ets2panda/ir/ts/tsModuleDeclaration.cpp @@ -16,6 +16,9 @@ #include "tsModuleDeclaration.h" #include "varbinder/scope.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "ir/base/decorator.h" #include "ir/expression.h" @@ -57,15 +60,23 @@ void TSModuleDeclaration::Dump(ir::AstDumper *dumper) const {"global", global_}}); } -void TSModuleDeclaration::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSModuleDeclaration::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} + +void TSModuleDeclaration::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSModuleDeclaration::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSModuleDeclaration::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsModuleDeclaration.h b/ets2panda/ir/ts/tsModuleDeclaration.h index e8f28c207f..cc3aafc114 100644 --- a/ets2panda/ir/ts/tsModuleDeclaration.h +++ b/ets2panda/ir/ts/tsModuleDeclaration.h @@ -80,6 +80,7 @@ public: void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; + void Compile(compiler::ETSGen *etsg) const override; checker::Type *Check([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *Check([[maybe_unused]] checker::ETSChecker *checker) override; diff --git a/ets2panda/ir/ts/tsParameterProperty.cpp b/ets2panda/ir/ts/tsParameterProperty.cpp index d42b520c35..4f5cfd854a 100644 --- a/ets2panda/ir/ts/tsParameterProperty.cpp +++ b/ets2panda/ir/ts/tsParameterProperty.cpp @@ -15,6 +15,9 @@ #include "tsParameterProperty.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "ir/expression.h" @@ -42,15 +45,22 @@ void TSParameterProperty::Dump(ir::AstDumper *dumper) const {"parameter", parameter_}}); } -void TSParameterProperty::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSParameterProperty::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSParameterProperty::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSParameterProperty::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSParameterProperty::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsParameterProperty.h b/ets2panda/ir/ts/tsParameterProperty.h index 77b8fbb832..f11529dac3 100644 --- a/ets2panda/ir/ts/tsParameterProperty.h +++ b/ets2panda/ir/ts/tsParameterProperty.h @@ -64,6 +64,7 @@ public: void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; + void Compile(compiler::ETSGen *etsg) const override; checker::Type *Check([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *Check([[maybe_unused]] checker::ETSChecker *checker) override; diff --git a/ets2panda/ir/ts/tsTypeOperator.cpp b/ets2panda/ir/ts/tsTypeOperator.cpp index 538bb29e5c..f945f6e43f 100644 --- a/ets2panda/ir/ts/tsTypeOperator.cpp +++ b/ets2panda/ir/ts/tsTypeOperator.cpp @@ -15,6 +15,9 @@ #include "tsTypeOperator.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" namespace panda::es2panda::ir { @@ -37,11 +40,18 @@ void TSTypeOperator::Dump(ir::AstDumper *dumper) const }); } -void TSTypeOperator::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSTypeOperator::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSTypeOperator::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSTypeOperator::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSTypeOperator::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -51,6 +61,6 @@ checker::Type *TSTypeOperator::GetType([[maybe_unused]] checker::TSChecker *chec checker::Type *TSTypeOperator::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsTypeOperator.h b/ets2panda/ir/ts/tsTypeOperator.h index ea2b54e731..dd09a88034 100644 --- a/ets2panda/ir/ts/tsTypeOperator.h +++ b/ets2panda/ir/ts/tsTypeOperator.h @@ -50,6 +50,7 @@ public: void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; + void Compile(compiler::ETSGen *etsg) const override; checker::Type *Check([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *GetType([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *Check([[maybe_unused]] checker::ETSChecker *checker) override; diff --git a/ets2panda/ir/ts/tsTypeParameter.cpp b/ets2panda/ir/ts/tsTypeParameter.cpp index 3a92543a40..e464990af2 100644 --- a/ets2panda/ir/ts/tsTypeParameter.cpp +++ b/ets2panda/ir/ts/tsTypeParameter.cpp @@ -15,6 +15,9 @@ #include "tsTypeParameter.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "ir/typeNode.h" #include "ir/expressions/identifier.h" @@ -58,15 +61,22 @@ void TSTypeParameter::Dump(ir::AstDumper *dumper) const }); } -void TSTypeParameter::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSTypeParameter::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSTypeParameter::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSTypeParameter::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSTypeParameter::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsTypeParameter.h b/ets2panda/ir/ts/tsTypeParameter.h index aaf9227a7b..09f485eb51 100644 --- a/ets2panda/ir/ts/tsTypeParameter.h +++ b/ets2panda/ir/ts/tsTypeParameter.h @@ -61,6 +61,7 @@ public: void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; + void Compile(compiler::ETSGen *etsg) const override; checker::Type *Check([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *Check([[maybe_unused]] checker::ETSChecker *checker) override; diff --git a/ets2panda/ir/ts/tsTypeParameterDeclaration.cpp b/ets2panda/ir/ts/tsTypeParameterDeclaration.cpp index a84b6d16cb..128f2abae2 100644 --- a/ets2panda/ir/ts/tsTypeParameterDeclaration.cpp +++ b/ets2panda/ir/ts/tsTypeParameterDeclaration.cpp @@ -16,6 +16,9 @@ #include "tsTypeParameterDeclaration.h" #include "varbinder/scope.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "ir/ts/tsTypeParameter.h" @@ -39,15 +42,22 @@ void TSTypeParameterDeclaration::Dump(ir::AstDumper *dumper) const dumper->Add({{"type", "TSTypeParameterDeclaration"}, {"params", params_}}); } -void TSTypeParameterDeclaration::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSTypeParameterDeclaration::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSTypeParameterDeclaration::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSTypeParameterDeclaration::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSTypeParameterDeclaration::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsTypeParameterDeclaration.h b/ets2panda/ir/ts/tsTypeParameterDeclaration.h index 6e203679ad..8da7d35aeb 100644 --- a/ets2panda/ir/ts/tsTypeParameterDeclaration.h +++ b/ets2panda/ir/ts/tsTypeParameterDeclaration.h @@ -57,6 +57,7 @@ public: void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; + void Compile(compiler::ETSGen *etsg) const override; checker::Type *Check([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *Check([[maybe_unused]] checker::ETSChecker *checker) override; diff --git a/ets2panda/ir/ts/tsTypeParameterInstantiation.cpp b/ets2panda/ir/ts/tsTypeParameterInstantiation.cpp index 614e9798df..7b604b1540 100644 --- a/ets2panda/ir/ts/tsTypeParameterInstantiation.cpp +++ b/ets2panda/ir/ts/tsTypeParameterInstantiation.cpp @@ -16,6 +16,9 @@ #include "es2panda.h" #include "tsTypeParameterInstantiation.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "ir/expression.h" #include "ir/typeNode.h" @@ -62,16 +65,23 @@ void TSTypeParameterInstantiation::Dump(ir::AstDumper *dumper) const dumper->Add({{"type", "TSTypeParameterInstantiation"}, {"params", params_}}); } -void TSTypeParameterInstantiation::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSTypeParameterInstantiation::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSTypeParameterInstantiation::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSTypeParameterInstantiation::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSTypeParameterInstantiation::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsTypeParameterInstantiation.h b/ets2panda/ir/ts/tsTypeParameterInstantiation.h index 727e08911e..0ce61df1c3 100644 --- a/ets2panda/ir/ts/tsTypeParameterInstantiation.h +++ b/ets2panda/ir/ts/tsTypeParameterInstantiation.h @@ -49,6 +49,7 @@ public: void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; + void Compile(compiler::ETSGen *etsg) const override; checker::Type *Check([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *Check([[maybe_unused]] checker::ETSChecker *checker) override; diff --git a/ets2panda/ir/ts/tsTypePredicate.cpp b/ets2panda/ir/ts/tsTypePredicate.cpp index 9e12cb8569..16c99b8747 100644 --- a/ets2panda/ir/ts/tsTypePredicate.cpp +++ b/ets2panda/ir/ts/tsTypePredicate.cpp @@ -15,6 +15,9 @@ #include "tsTypePredicate.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "ir/typeNode.h" #include "ir/expression.h" @@ -44,11 +47,18 @@ void TSTypePredicate::Dump(ir::AstDumper *dumper) const {"asserts", asserts_}}); } -void TSTypePredicate::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSTypePredicate::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSTypePredicate::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSTypePredicate::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSTypePredicate::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -58,6 +68,6 @@ checker::Type *TSTypePredicate::GetType([[maybe_unused]] checker::TSChecker *che checker::Type *TSTypePredicate::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsTypePredicate.h b/ets2panda/ir/ts/tsTypePredicate.h index e32610b702..f19587cf06 100644 --- a/ets2panda/ir/ts/tsTypePredicate.h +++ b/ets2panda/ir/ts/tsTypePredicate.h @@ -48,6 +48,7 @@ public: void Iterate(const NodeTraverser &cb) const override; void Dump(ir::AstDumper *dumper) const override; void Compile([[maybe_unused]] compiler::PandaGen *pg) const override; + void Compile(compiler::ETSGen *etsg) const override; checker::Type *Check([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *GetType([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *Check([[maybe_unused]] checker::ETSChecker *checker) override; -- Gitee