diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 1b18db86c4a0cd71e901844ad228d72eebb6614b..9eca1e5f35e44d0a661c781469e9eeff0961de9e 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 6b42c2deb681f0d36cb4402187745b155a66a41c..df7da65c1d451e183ba2fec196a91f102dbcf3d6 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 4770e12ab3c3b6adab796ada779aa83caaa6a554..68f90b1a9f3878c9f7c6fffd3811ecb7ac58fae5 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 23fc28f983e779a35e8f1d8cd8a810190aa0c3b6..fc82e71a6841f85c03d677b3da126528705c4f87 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 175de0652ff92201aaa38c1c0d7e0a05aed3fa8b..dc194f4b9cd1c0cf6687ed3a1fbd2980a9748423 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 d2a26839ea1f37c9a65d12bc02216d786bc4529b..eb19607ef19c6f7af6e8acc6f3458f37b8a579ef 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 6cdc3ba60ccc9f71c4dfd4b5cd79cb4c77545471..316ba0551154e56b010124d5e1fdd61efabd044d 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 2813e2a83178f566a339e93e735ba06d1763af8c..9f721f2cc0ca86407fa29645f8ca814dc59ed06e 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 5c06f1613556beebec0eba10434a272e058b3d0f..d108bb9540087e4571bec027eecfd970346b17c8 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 5d62c9776c69c87527c9f9809754817341d5cf0d..c06cb053c531172f4cb3cdac12f5bba46019fa96 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 2e96dbb3fffee08d5a902213a6c4c311b662543d..a25efa4371b2611fea732dc37e1ce2dd278bf8c0 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 7ed628faa41db80069289bf66613f79a967e215c..70556f32db9e400242b432646fd04762bd23d6ce 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 bc7946d3f40fd0bd8e3b493254ea84c7afdb7e7c..cb9c54072d10beec131d13ad3906b1f410c81ad8 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 c2fe678170a84aa44e7233cf74eb2eaa2cee5430..33a22120f1fa5a47a054c792f7fa899cfe203ab5 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 9c7b5a802983ce8b999ff0ffc33be970ed2f08aa..1b3443a72c8b68448e704a76dfe84cfdc75561fd 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 8154d30a82e187972d685df1cd8462ad02202d24..64c1479c7df8ea488d4896308e50a846449b0814 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 49f02916f8439c5dcccab44cab1e9458e6c0f876..1ecd8382424dbc59c457fbed877881178e5524a4 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 a443f194ed8276988fec7ef7d5892453b22f93d6..a53935ce169c56689fcd19340ad1a8e2cf0be5d1 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 445cf9b41fead0940e374ff2049be6f713bfe537..9827778d624a63a5faa7d69a5a3b5240ec7b3dba 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 0cbf2359b8ebfd1b9aaa3f358789b7ed6c662d39..d501237363dd12390bb5f5693450942f3e1df7c7 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;