Fix NativeScript property list

(cherry picked from commit bc110b3771)
This commit is contained in:
sheepandshepherd 2018-04-10 16:01:13 +02:00 committed by Rémi Verschelde
parent 3d5c5c28d5
commit 3fcdb3198b
1 changed files with 3 additions and 4 deletions

View File

@ -358,14 +358,13 @@ void NativeScript::get_script_property_list(List<PropertyInfo> *p_list) const {
NativeScriptDesc *script_data = get_script_desc(); NativeScriptDesc *script_data = get_script_desc();
Set<StringName> existing_properties; Set<StringName> existing_properties;
List<PropertyInfo>::Element *original_back = p_list->back();
while (script_data) { while (script_data) {
List<PropertyInfo>::Element *insert_position = p_list->front(); List<PropertyInfo>::Element *insert_position = original_back;
bool insert_before = true;
for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element E = script_data->properties.front(); E; E = E.next()) { for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element E = script_data->properties.front(); E; E = E.next()) {
if (!existing_properties.has(E.key())) { if (!existing_properties.has(E.key())) {
insert_position = insert_before ? p_list->insert_before(insert_position, E.get().info) : p_list->insert_after(insert_position, E.get().info); insert_position = p_list->insert_after(insert_position, E.get().info);
insert_before = false;
existing_properties.insert(E.key()); existing_properties.insert(E.key());
} }
} }