mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 08:03:29 +00:00
!2823 Adapt the new command to the module scope
Merge pull request !2823 from 杨阳/module_optimization
This commit is contained in:
commit
34f86c36e7
@ -323,16 +323,26 @@ void DebuggerApi::GetModuleVariables(const EcmaVM *vm, Local<ObjectRef> &moduleO
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr uint32_t MAX_ARRAY_LENGTH = 4; // two pairs of key and value
|
if (dictionary.IsTaggedArray()) {
|
||||||
if (dictionary.IsTaggedArray() &&
|
JSTaggedValue localExportEntries = SourceTextModule::Cast(currentModule.GetTaggedObject())->GetLocalExportEntries();
|
||||||
TaggedArray::Cast(dictionary.GetTaggedObject())->GetLength() <= MAX_ARRAY_LENGTH) {
|
ASSERT(localExportEntries.IsTaggedArray());
|
||||||
|
TaggedArray *localExportArray = TaggedArray::Cast(localExportEntries.GetTaggedObject());
|
||||||
|
uint32_t exportEntriesLen = localExportArray->GetLength();
|
||||||
TaggedArray *dict = TaggedArray::Cast(dictionary.GetTaggedObject());
|
TaggedArray *dict = TaggedArray::Cast(dictionary.GetTaggedObject());
|
||||||
uint32_t length = dict->GetLength();
|
uint32_t valueLen = dict->GetLength();
|
||||||
for (uint32_t idx = 0; idx < length; idx += 2) { // 2 means skip value
|
if (exportEntriesLen != valueLen) {
|
||||||
JSTaggedValue key = dict->Get(idx);
|
LOG_FULL(FATAL) << "Key does not match value";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t idx = 0; idx < valueLen; idx++) {
|
||||||
|
LocalExportEntry *ee = LocalExportEntry::Cast(localExportArray->Get(idx).GetTaggedObject());
|
||||||
|
JSTaggedValue key = ee->GetExportName();
|
||||||
if (key.IsString()) {
|
if (key.IsString()) {
|
||||||
Local<JSValueRef> name = JSNApiHelper::ToLocal<JSValueRef>(JSHandle<JSTaggedValue>(thread, key));
|
Local<JSValueRef> name = JSNApiHelper::ToLocal<JSValueRef>(JSHandle<JSTaggedValue>(thread, key));
|
||||||
JSTaggedValue moduleValue = dict->Get(idx + 1);
|
JSTaggedValue moduleValue = dict->Get(idx);
|
||||||
|
if (moduleValue.IsHole()) {
|
||||||
|
moduleValue = JSTaggedValue::Undefined();
|
||||||
|
}
|
||||||
Local<JSValueRef> value = JSNApiHelper::ToLocal<JSValueRef>(
|
Local<JSValueRef> value = JSNApiHelper::ToLocal<JSValueRef>(
|
||||||
JSHandle<JSTaggedValue>(thread, moduleValue));
|
JSHandle<JSTaggedValue>(thread, moduleValue));
|
||||||
PropertyAttribute descriptor(value, true, true, true);
|
PropertyAttribute descriptor(value, true, true, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user