From e71a943f47d21ecad3a4ed5944e3008ccef149c4 Mon Sep 17 00:00:00 2001 From: hufeng Date: Mon, 24 Jan 2022 11:06:59 +0800 Subject: [PATCH] fixed 45146d3 from https://gitee.com/hufeng20/ark_runtime_core/pulls/43 [ts2abc] EcmaScript_Standard_Module_with_runtime Signed-off-by: hufeng Change-Id: I2b3b7d792ab884a65d295f66e9dcdb67f369eda2 --- libpandafile/literal_data_accessor-inl.h | 6 +----- libpandafile/literal_data_accessor.h | 8 ++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libpandafile/literal_data_accessor-inl.h b/libpandafile/literal_data_accessor-inl.h index d683f872ca..4ea63d80df 100644 --- a/libpandafile/literal_data_accessor-inl.h +++ b/libpandafile/literal_data_accessor-inl.h @@ -18,7 +18,6 @@ #include #include "file_items.h" -#include "helpers.h" #include "literal_data_accessor.h" #include "utils/utf.h" @@ -92,10 +91,7 @@ inline void LiteralDataAccessor::EnumerateLiteralVals(File::EntityId id, const C template inline void LiteralDataAccessor::EnumerateLiteralVals(size_t index, const Callback &cb) { - ASSERT(index < literal_num_); - auto l_sp = literal_data_sp_.SubSpan(index * ID_SIZE); - auto id = File::EntityId(static_cast(helpers::Read(&l_sp))); - EnumerateLiteralVals(id, cb); + EnumerateLiteralVals(GetLiteralArrayId(index), cb); } } // namespace panda::panda_file diff --git a/libpandafile/literal_data_accessor.h b/libpandafile/literal_data_accessor.h index 943c6c3cea..cd3f8381dd 100644 --- a/libpandafile/literal_data_accessor.h +++ b/libpandafile/literal_data_accessor.h @@ -18,6 +18,7 @@ #include "field_data_accessor.h" #include "file.h" +#include "helpers.h" #include "utils/span.h" namespace panda::panda_file { @@ -83,6 +84,13 @@ public: return literal_data_id_; } + File::EntityId GetLiteralArrayId(size_t index) const + { + ASSERT(index < literal_num_); + auto l_sp = literal_data_sp_.SubSpan(index * ID_SIZE); + return File::EntityId(static_cast(helpers::Read(&l_sp))); + } + using LiteralValue = std::variant; private: -- Gitee