diff --git a/ets2panda/checker/ETSchecker.cpp b/ets2panda/checker/ETSchecker.cpp index c301c826b3faae4f4f5fdb00713854d26a5dda92..f556f61e0547408c9e03655788b37d08d85c827c 100644 --- a/ets2panda/checker/ETSchecker.cpp +++ b/ets2panda/checker/ETSchecker.cpp @@ -433,6 +433,7 @@ bool ETSChecker::IsClassStaticMethod(checker::ETSObjectType *objType, checker::S TypeFlag::ETS_STRING_ENUM | TypeFlag::READONLY | TypeFlag::BIGINT_LITERAL | TypeFlag::ETS_TYPE_ALIAS | TypeFlag::TYPE_ERROR; + CHECK_NOT_NULL(type); auto res = static_cast(type->TypeFlags() & ~(TO_CLEAR)); ES2PANDA_ASSERT_POS(res == TypeFlag::NONE || helpers::math::IsPowerOfTwo(res & ~(TypeFlag::NONE)), ark::es2panda::GetPositionForDiagnostic()); diff --git a/ets2panda/checker/types/ets/etsAnyType.cpp b/ets2panda/checker/types/ets/etsAnyType.cpp index 8f36fb2b2123613809dc8f798044a89eebd61803..ea399276063cd735fb696ab45e416260bd38d9f9 100644 --- a/ets2panda/checker/types/ets/etsAnyType.cpp +++ b/ets2panda/checker/types/ets/etsAnyType.cpp @@ -14,6 +14,7 @@ */ #include "etsAnyType.h" +#include #include "checker/ETSchecker.h" #include "checker/ets/conversion.h" @@ -62,6 +63,7 @@ void ETSAnyType::Cast(TypeRelation *relation, Type *target) if (relation->ApplyUnboxing()) { auto *const boxedTarget = relation->GetChecker()->AsETSChecker()->MaybeBoxInRelation(target); + ES2PANDA_ASSERT(boxedTarget != nullptr); conversion::Unboxing(relation, boxedTarget->AsETSObjectType()); relation->Result(true); } diff --git a/ets2panda/compiler/core/ETSGen.cpp b/ets2panda/compiler/core/ETSGen.cpp index 64969cbd232c5fbc3cc3c52d7dbd0b619e6ddd66..ef53c9883d2bb0156e963c54452c4caa0a3857c9 100644 --- a/ets2panda/compiler/core/ETSGen.cpp +++ b/ets2panda/compiler/core/ETSGen.cpp @@ -671,6 +671,7 @@ void ETSGen::BranchIfIsInstance(const ir::AstNode *const node, const VReg srcReg void ETSGen::IsInstance(const ir::AstNode *const node, const VReg srcReg, const checker::Type *target) { target = Checker()->GetApparentType(target); + ES2PANDA_ASSERT(target != nullptr); ES2PANDA_ASSERT(target->IsETSReferenceType() && GetAccumulatorType() != nullptr); if (target->IsETSAnyType()) { // should be IsSupertypeOf(target, source) @@ -720,6 +721,7 @@ void ETSGen::InternalCheckCast(const ir::AstNode *node, const es2panda::checker: // Handle checkcast for interop if it is 1.2 type. void ETSGen::EmitAnyCheckCast(const ir::AstNode *node, const checker::Type *target) { + ES2PANDA_ASSERT(target != nullptr); if (!target->IsETSAnyType() && (target->IsETSObjectType() || target->IsETSArrayType() || target->IsETSTupleType())) { InternalCheckCast(node, target); @@ -774,6 +776,7 @@ void ETSGen::CheckedReferenceNarrowing(const ir::AstNode *node, const checker::T } target = Checker()->GetApparentType(target); + ES2PANDA_ASSERT(target != nullptr); ES2PANDA_ASSERT(target->IsETSReferenceType()); if (target->IsETSAnyType()) { // should be IsSupertypeOf(target, source) @@ -810,6 +813,7 @@ void ETSGen::GuardUncheckedType(const ir::AstNode *node, const checker::Type *un CheckedReferenceNarrowing(node, Checker()->MaybeBoxType(target)); // Because on previous step accumulator type may be set in CheckerReferenceNarrowing to boxed counterpart of // target We need to apply unbox conversion if needed to avoid RTE + ES2PANDA_ASSERT(GetAccumulatorType() != nullptr); if (target->IsETSPrimitiveType() && GetAccumulatorType()->IsETSUnboxableObject()) { ApplyConversion(node, target); } @@ -1276,6 +1280,7 @@ void ETSGen::CastToInt(const ir::AstNode *node) void ETSGen::CastToReftype(const ir::AstNode *const node, const checker::Type *const targetType, const bool unchecked) { + ES2PANDA_ASSERT(GetAccumulatorType() != nullptr); ES2PANDA_ASSERT(GetAccumulatorType()->IsETSReferenceType()); if (!unchecked) {