Skip to content

Commit

Permalink
fix function merge_additional_property(old_property, new_property)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanasimi committed Dec 9, 2024
1 parent 0591aac commit 3b0df74
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions application/net/wiki/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5022,22 +5022,19 @@ function module_code(library_namespace) {
if (!PATTERN_property_id.test(property_name)) {
continue;
}
if (exist_property_Map.has(property_name)) {
// 已存在相同的 property_name。
}
exist_property_Map.set(property_name,
property_Object[property_name]);
break;
}
});

var insert_to_property_list;
if (old_property.length === 1 && old_property[0].snaks) {
// assert: old_property 為原先已存在之 property。
old_property = old_property[0];
// TODO: simplify old_property
if (old_property[0].snaks) {
insert_to_property_list = [];
} else {
if (old_property[0].snaks) {
throw new Error('Cannot handle with '
+ JSON.stringify(old_property));
}
insert_to_property_list = old_property;
}

Expand Down Expand Up @@ -5072,6 +5069,14 @@ function module_code(library_namespace) {
}
});

if (insert_to_property_list !== old_property
&& insert_to_property_list.length > 0) {
old_property.push(insert_to_property_list);
} else if (old_property.length === 1 && old_property[0].snaks) {
// assert: old_property 為原先已存在之 property。
old_property = old_property[0];
}

return old_property;
}

Expand Down

0 comments on commit 3b0df74

Please sign in to comment.