From fb82a98a87a92d490cea157ea8de0c2ccba5f097 Mon Sep 17 00:00:00 2001 From: Maxim Bolshov Date: Wed, 2 Jul 2025 15:54:04 +0300 Subject: [PATCH] Minor utils/plugin refactoring * Add missing assert * Add missing static_cast Issue: #ICJK24 Testing: ninja ets_tests Signed-off-by: Maxim Bolshov --- ets2panda/compiler/lowering/util.cpp | 1 + ets2panda/public/es2panda_lib.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ets2panda/compiler/lowering/util.cpp b/ets2panda/compiler/lowering/util.cpp index 70277eeeac..397eb4ad56 100644 --- a/ets2panda/compiler/lowering/util.cpp +++ b/ets2panda/compiler/lowering/util.cpp @@ -57,6 +57,7 @@ util::UString GenName(ArenaAllocator *const allocator) void SetSourceRangesRecursively(ir::AstNode *node, const lexer::SourceRange &range) { + ES2PANDA_ASSERT(node != nullptr); node->SetRange(range); node->IterateRecursively([](ir::AstNode *n) { n->SetRange(n->Parent()->Range()); }); } diff --git a/ets2panda/public/es2panda_lib.cpp b/ets2panda/public/es2panda_lib.cpp index 1a0d1f9d2c..7d1405550e 100644 --- a/ets2panda/public/es2panda_lib.cpp +++ b/ets2panda/public/es2panda_lib.cpp @@ -130,7 +130,7 @@ __attribute__((unused)) es2panda_variantDoubleCharArrayBool EnumMemberResultToEs // NOLINTBEGIN(cppcoreguidelines-pro-type-union-access) // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-expr) es2panda_variantDoubleCharArrayBool es2panda_variant; - es2panda_variant.index = variant.index(); + es2panda_variant.index = static_cast(variant.index()); switch (es2panda_variant.index) { case es2panda_variantIndex::CAPI_DOUBLE: es2panda_variant.variant.d = std::get(variant); -- Gitee