From 114e2dba6c53a9bab346efce04400fcbaf414eef Mon Sep 17 00:00:00 2001 From: Vivien Voros Date: Thu, 19 Oct 2023 13:22:35 +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. TSThisType, TSModuleBlock, TSMappedType, TSIntersectionType, TSImportType, TSConditionalType, TSInferType, TSNullKeyword Linked Internal issue: 13840 Change-Id: I82a6857287164f91317358b095b659e85cd97fb1 Signed-off-by: Vivien Voros --- ets2panda/checker/ETSAnalyzer.cpp | 32 +++++++------------------ ets2panda/checker/TSAnalyzer.cpp | 26 +++++++------------- ets2panda/compiler/core/ETSCompiler.cpp | 24 +++++++------------ ets2panda/compiler/core/JSCompiler.cpp | 24 +++++++------------ ets2panda/ir/ts/tsConditionalType.cpp | 16 ++++++++++--- ets2panda/ir/ts/tsConditionalType.h | 1 + ets2panda/ir/ts/tsImportType.cpp | 17 ++++++++++--- ets2panda/ir/ts/tsImportType.h | 1 + ets2panda/ir/ts/tsInferType.cpp | 16 ++++++++++--- ets2panda/ir/ts/tsInferType.h | 1 + ets2panda/ir/ts/tsIntersectionType.cpp | 16 ++++++++++--- ets2panda/ir/ts/tsIntersectionType.h | 1 + ets2panda/ir/ts/tsMappedType.cpp | 16 ++++++++++--- ets2panda/ir/ts/tsMappedType.h | 1 + ets2panda/ir/ts/tsModuleBlock.cpp | 16 ++++++++++--- ets2panda/ir/ts/tsModuleBlock.h | 1 + ets2panda/ir/ts/tsNullKeyword.cpp | 15 +++++++++--- ets2panda/ir/ts/tsNullKeyword.h | 1 + ets2panda/ir/ts/tsThisType.cpp | 16 ++++++++++--- ets2panda/ir/ts/tsThisType.h | 1 + 20 files changed, 145 insertions(+), 97 deletions(-) diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 1b18db86c4..9eca1e5f35 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -19,14 +19,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 { @@ -956,9 +948,8 @@ checker::Type *ETSAnalyzer::Check(ir::TSClassImplements *expr) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSConditionalType *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSConditionalType *node) const { - (void)node; UNREACHABLE(); } @@ -998,9 +989,8 @@ checker::Type *ETSAnalyzer::Check(ir::TSImportEqualsDeclaration *st) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSImportType *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSImportType *node) const { - (void)node; UNREACHABLE(); } @@ -1010,9 +1000,8 @@ checker::Type *ETSAnalyzer::Check(ir::TSIndexedAccessType *node) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSInferType *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSInferType *node) const { - (void)node; UNREACHABLE(); } @@ -1034,9 +1023,8 @@ checker::Type *ETSAnalyzer::Check(ir::TSInterfaceHeritage *expr) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSIntersectionType *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSIntersectionType *node) const { - (void)node; UNREACHABLE(); } @@ -1046,15 +1034,13 @@ checker::Type *ETSAnalyzer::Check(ir::TSLiteralType *node) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSMappedType *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSMappedType *node) const { - (void)node; UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSModuleBlock *st) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSModuleBlock *st) const { - (void)st; UNREACHABLE(); } @@ -1082,9 +1068,8 @@ checker::Type *ETSAnalyzer::Check(ir::TSNonNullExpression *expr) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSNullKeyword *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSNullKeyword *node) const { - (void)node; UNREACHABLE(); } @@ -1124,9 +1109,8 @@ checker::Type *ETSAnalyzer::Check(ir::TSStringKeyword *node) const UNREACHABLE(); } -checker::Type *ETSAnalyzer::Check(ir::TSThisType *node) const +checker::Type *ETSAnalyzer::Check([[maybe_unused]] ir::TSThisType *node) const { - (void)node; UNREACHABLE(); } diff --git a/ets2panda/checker/TSAnalyzer.cpp b/ets2panda/checker/TSAnalyzer.cpp index 6b42c2deb6..df7da65c1d 100644 --- a/ets2panda/checker/TSAnalyzer.cpp +++ b/ets2panda/checker/TSAnalyzer.cpp @@ -694,9 +694,8 @@ checker::Type *TSAnalyzer::Check(ir::TSClassImplements *expr) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSConditionalType *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSConditionalType *node) const { - (void)node; UNREACHABLE(); } @@ -736,9 +735,8 @@ checker::Type *TSAnalyzer::Check(ir::TSImportEqualsDeclaration *st) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSImportType *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSImportType *node) const { - (void)node; UNREACHABLE(); } @@ -748,9 +746,8 @@ checker::Type *TSAnalyzer::Check(ir::TSIndexedAccessType *node) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSInferType *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSInferType *node) const { - (void)node; UNREACHABLE(); } @@ -772,9 +769,8 @@ checker::Type *TSAnalyzer::Check(ir::TSInterfaceHeritage *expr) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSIntersectionType *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSIntersectionType *node) const { - (void)node; UNREACHABLE(); } @@ -784,15 +780,13 @@ checker::Type *TSAnalyzer::Check(ir::TSLiteralType *node) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSMappedType *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSMappedType *node) const { - (void)node; UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSModuleBlock *st) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSModuleBlock *st) const { - (void)st; UNREACHABLE(); } @@ -820,10 +814,9 @@ checker::Type *TSAnalyzer::Check(ir::TSNonNullExpression *expr) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSNullKeyword *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSNullKeyword *node) const { - (void)node; - UNREACHABLE(); + return nullptr; } checker::Type *TSAnalyzer::Check(ir::TSNumberKeyword *node) const @@ -862,9 +855,8 @@ checker::Type *TSAnalyzer::Check(ir::TSStringKeyword *node) const UNREACHABLE(); } -checker::Type *TSAnalyzer::Check(ir::TSThisType *node) const +checker::Type *TSAnalyzer::Check([[maybe_unused]] ir::TSThisType *node) const { - (void)node; UNREACHABLE(); } diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index 4770e12ab3..68f90b1a9f 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -706,9 +706,8 @@ void ETSCompiler::Compile(const ir::TSClassImplements *expr) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSConditionalType *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSConditionalType *node) const { - (void)node; UNREACHABLE(); } @@ -748,9 +747,8 @@ void ETSCompiler::Compile(const ir::TSImportEqualsDeclaration *st) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSImportType *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSImportType *node) const { - (void)node; UNREACHABLE(); } @@ -760,9 +758,8 @@ void ETSCompiler::Compile(const ir::TSIndexedAccessType *node) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSInferType *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSInferType *node) const { - (void)node; UNREACHABLE(); } @@ -784,9 +781,8 @@ void ETSCompiler::Compile(const ir::TSInterfaceHeritage *expr) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSIntersectionType *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSIntersectionType *node) const { - (void)node; UNREACHABLE(); } @@ -796,15 +792,13 @@ void ETSCompiler::Compile(const ir::TSLiteralType *node) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSMappedType *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSMappedType *node) const { - (void)node; UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSModuleBlock *st) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSModuleBlock *st) const { - (void)st; UNREACHABLE(); } @@ -832,9 +826,8 @@ void ETSCompiler::Compile(const ir::TSNonNullExpression *expr) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSNullKeyword *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSNullKeyword *node) const { - (void)node; UNREACHABLE(); } @@ -874,9 +867,8 @@ void ETSCompiler::Compile(const ir::TSStringKeyword *node) const UNREACHABLE(); } -void ETSCompiler::Compile(const ir::TSThisType *node) const +void ETSCompiler::Compile([[maybe_unused]] const ir::TSThisType *node) const { - (void)node; UNREACHABLE(); } diff --git a/ets2panda/compiler/core/JSCompiler.cpp b/ets2panda/compiler/core/JSCompiler.cpp index 23fc28f983..fc82e71a68 100644 --- a/ets2panda/compiler/core/JSCompiler.cpp +++ b/ets2panda/compiler/core/JSCompiler.cpp @@ -992,9 +992,8 @@ void JSCompiler::Compile(const ir::TSClassImplements *expr) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSConditionalType *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSConditionalType *node) const { - (void)node; UNREACHABLE(); } @@ -1034,9 +1033,8 @@ void JSCompiler::Compile(const ir::TSImportEqualsDeclaration *st) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSImportType *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSImportType *node) const { - (void)node; UNREACHABLE(); } @@ -1046,9 +1044,8 @@ void JSCompiler::Compile(const ir::TSIndexedAccessType *node) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSInferType *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSInferType *node) const { - (void)node; UNREACHABLE(); } @@ -1070,9 +1067,8 @@ void JSCompiler::Compile(const ir::TSInterfaceHeritage *expr) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSIntersectionType *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSIntersectionType *node) const { - (void)node; UNREACHABLE(); } @@ -1082,15 +1078,13 @@ void JSCompiler::Compile(const ir::TSLiteralType *node) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSMappedType *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSMappedType *node) const { - (void)node; UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSModuleBlock *st) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSModuleBlock *st) const { - (void)st; UNREACHABLE(); } @@ -1118,9 +1112,8 @@ void JSCompiler::Compile(const ir::TSNonNullExpression *expr) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSNullKeyword *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSNullKeyword *node) const { - (void)node; UNREACHABLE(); } @@ -1160,9 +1153,8 @@ void JSCompiler::Compile(const ir::TSStringKeyword *node) const UNREACHABLE(); } -void JSCompiler::Compile(const ir::TSThisType *node) const +void JSCompiler::Compile([[maybe_unused]] const ir::TSThisType *node) const { - (void)node; UNREACHABLE(); } diff --git a/ets2panda/ir/ts/tsConditionalType.cpp b/ets2panda/ir/ts/tsConditionalType.cpp index 175de0652f..dc194f4b9c 100644 --- a/ets2panda/ir/ts/tsConditionalType.cpp +++ b/ets2panda/ir/ts/tsConditionalType.cpp @@ -15,6 +15,9 @@ #include "tsConditionalType.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" namespace panda::es2panda::ir { @@ -43,11 +46,18 @@ void TSConditionalType::Dump(ir::AstDumper *dumper) const {"falseType", false_type_}}); } -void TSConditionalType::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSConditionalType::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSConditionalType::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSConditionalType::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSConditionalType::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -57,6 +67,6 @@ checker::Type *TSConditionalType::GetType([[maybe_unused]] checker::TSChecker *c checker::Type *TSConditionalType::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsConditionalType.h b/ets2panda/ir/ts/tsConditionalType.h index d2a26839ea..eb19607ef1 100644 --- a/ets2panda/ir/ts/tsConditionalType.h +++ b/ets2panda/ir/ts/tsConditionalType.h @@ -55,6 +55,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/tsImportType.cpp b/ets2panda/ir/ts/tsImportType.cpp index 6cdc3ba60c..316ba05511 100644 --- a/ets2panda/ir/ts/tsImportType.cpp +++ b/ets2panda/ir/ts/tsImportType.cpp @@ -15,6 +15,9 @@ #include "tsImportType.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "ir/ts/tsTypeParameter.h" #include "ir/ts/tsTypeParameterInstantiation.h" @@ -55,11 +58,19 @@ void TSImportType::Dump(ir::AstDumper *dumper) const {"isTypeOf", is_typeof_}}); } -void TSImportType::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSImportType::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} + +void TSImportType::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSImportType::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSImportType::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -69,6 +80,6 @@ checker::Type *TSImportType::GetType([[maybe_unused]] checker::TSChecker *checke checker::Type *TSImportType::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsImportType.h b/ets2panda/ir/ts/tsImportType.h index 2813e2a831..9f721f2cc0 100644 --- a/ets2panda/ir/ts/tsImportType.h +++ b/ets2panda/ir/ts/tsImportType.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 *GetType([[maybe_unused]] checker::TSChecker *checker) override; checker::Type *Check([[maybe_unused]] checker::ETSChecker *checker) override; diff --git a/ets2panda/ir/ts/tsInferType.cpp b/ets2panda/ir/ts/tsInferType.cpp index 5c06f16135..d108bb9540 100644 --- a/ets2panda/ir/ts/tsInferType.cpp +++ b/ets2panda/ir/ts/tsInferType.cpp @@ -15,6 +15,9 @@ #include "tsInferType.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "ir/ts/tsTypeParameter.h" @@ -34,11 +37,18 @@ void TSInferType::Dump(ir::AstDumper *dumper) const dumper->Add({{"type", "TSInferType"}, {"typeParameter", type_param_}}); } -void TSInferType::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSInferType::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSInferType::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSInferType::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSInferType::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -48,6 +58,6 @@ checker::Type *TSInferType::GetType([[maybe_unused]] checker::TSChecker *checker checker::Type *TSInferType::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsInferType.h b/ets2panda/ir/ts/tsInferType.h index 5d62c9776c..c06cb053c5 100644 --- a/ets2panda/ir/ts/tsInferType.h +++ b/ets2panda/ir/ts/tsInferType.h @@ -34,6 +34,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/tsIntersectionType.cpp b/ets2panda/ir/ts/tsIntersectionType.cpp index 2e96dbb3ff..a25efa4371 100644 --- a/ets2panda/ir/ts/tsIntersectionType.cpp +++ b/ets2panda/ir/ts/tsIntersectionType.cpp @@ -15,6 +15,9 @@ #include "tsIntersectionType.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "checker/ETSchecker.h" @@ -38,11 +41,18 @@ void TSIntersectionType::Dump(ir::AstDumper *dumper) const dumper->Add({{"type", "TSIntersectionType"}, {"types", types_}}); } -void TSIntersectionType::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSIntersectionType::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSIntersectionType::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSIntersectionType::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSIntersectionType::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -58,6 +68,6 @@ checker::Type *TSIntersectionType::GetType([[maybe_unused]] checker::ETSChecker checker::Type *TSIntersectionType::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsIntersectionType.h b/ets2panda/ir/ts/tsIntersectionType.h index 7ed628faa4..70556f32db 100644 --- a/ets2panda/ir/ts/tsIntersectionType.h +++ b/ets2panda/ir/ts/tsIntersectionType.h @@ -35,6 +35,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 *GetType([[maybe_unused]] checker::ETSChecker *checker) override; diff --git a/ets2panda/ir/ts/tsMappedType.cpp b/ets2panda/ir/ts/tsMappedType.cpp index bc7946d3f4..cb9c54072d 100644 --- a/ets2panda/ir/ts/tsMappedType.cpp +++ b/ets2panda/ir/ts/tsMappedType.cpp @@ -15,6 +15,9 @@ #include "tsMappedType.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/ts/tsTypeParameter.h" @@ -49,11 +52,18 @@ void TSMappedType::Dump(ir::AstDumper *dumper) const : AstDumper::Optional("-")}}); } -void TSMappedType::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSMappedType::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSMappedType::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSMappedType::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSMappedType::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -63,6 +73,6 @@ checker::Type *TSMappedType::GetType([[maybe_unused]] checker::TSChecker *checke checker::Type *TSMappedType::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsMappedType.h b/ets2panda/ir/ts/tsMappedType.h index c2fe678170..33a22120f1 100644 --- a/ets2panda/ir/ts/tsMappedType.h +++ b/ets2panda/ir/ts/tsMappedType.h @@ -56,6 +56,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/tsModuleBlock.cpp b/ets2panda/ir/ts/tsModuleBlock.cpp index 9c7b5a8029..1b3443a72c 100644 --- a/ets2panda/ir/ts/tsModuleBlock.cpp +++ b/ets2panda/ir/ts/tsModuleBlock.cpp @@ -16,6 +16,9 @@ #include "tsModuleBlock.h" #include "varbinder/scope.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" namespace panda::es2panda::ir { @@ -38,15 +41,22 @@ void TSModuleBlock::Dump(ir::AstDumper *dumper) const dumper->Add({{"type", "TSModuleBlock"}, {"body", statements_}}); } -void TSModuleBlock::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSModuleBlock::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSModuleBlock::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSModuleBlock::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSModuleBlock::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsModuleBlock.h b/ets2panda/ir/ts/tsModuleBlock.h index 8154d30a82..64c1479c7d 100644 --- a/ets2panda/ir/ts/tsModuleBlock.h +++ b/ets2panda/ir/ts/tsModuleBlock.h @@ -46,6 +46,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/tsNullKeyword.cpp b/ets2panda/ir/ts/tsNullKeyword.cpp index 49f02916f8..1ecd838242 100644 --- a/ets2panda/ir/ts/tsNullKeyword.cpp +++ b/ets2panda/ir/ts/tsNullKeyword.cpp @@ -15,6 +15,8 @@ #include "tsNullKeyword.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" #include "checker/TSchecker.h" @@ -27,11 +29,18 @@ void TSNullKeyword::Dump(ir::AstDumper *dumper) const dumper->Add({{"type", "TSNullKeyword"}}); } -void TSNullKeyword::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSNullKeyword::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSNullKeyword::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSNullKeyword::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSNullKeyword::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -41,6 +50,6 @@ checker::Type *TSNullKeyword::GetType([[maybe_unused]] checker::TSChecker *check checker::Type *TSNullKeyword::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsNullKeyword.h b/ets2panda/ir/ts/tsNullKeyword.h index a443f194ed..a53935ce16 100644 --- a/ets2panda/ir/ts/tsNullKeyword.h +++ b/ets2panda/ir/ts/tsNullKeyword.h @@ -27,6 +27,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/tsThisType.cpp b/ets2panda/ir/ts/tsThisType.cpp index 445cf9b41f..9827778d62 100644 --- a/ets2panda/ir/ts/tsThisType.cpp +++ b/ets2panda/ir/ts/tsThisType.cpp @@ -15,6 +15,9 @@ #include "tsThisType.h" +#include "checker/TSchecker.h" +#include "compiler/core/ETSGen.h" +#include "compiler/core/pandagen.h" #include "ir/astDump.h" namespace panda::es2panda::ir { @@ -26,11 +29,18 @@ void TSThisType::Dump(ir::AstDumper *dumper) const dumper->Add({{"type", "TSThisType"}}); } -void TSThisType::Compile([[maybe_unused]] compiler::PandaGen *pg) const {} +void TSThisType::Compile([[maybe_unused]] compiler::PandaGen *pg) const +{ + pg->GetAstCompiler()->Compile(this); +} +void TSThisType::Compile(compiler::ETSGen *etsg) const +{ + etsg->GetAstCompiler()->Compile(this); +} checker::Type *TSThisType::Check([[maybe_unused]] checker::TSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } checker::Type *TSThisType::GetType([[maybe_unused]] checker::TSChecker *checker) @@ -40,6 +50,6 @@ checker::Type *TSThisType::GetType([[maybe_unused]] checker::TSChecker *checker) checker::Type *TSThisType::Check([[maybe_unused]] checker::ETSChecker *checker) { - return nullptr; + return checker->GetAnalyzer()->Check(this); } } // namespace panda::es2panda::ir diff --git a/ets2panda/ir/ts/tsThisType.h b/ets2panda/ir/ts/tsThisType.h index 0cbf2359b8..d501237363 100644 --- a/ets2panda/ir/ts/tsThisType.h +++ b/ets2panda/ir/ts/tsThisType.h @@ -27,6 +27,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