Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Keep order for C# exported members #54199

Merged
merged 1 commit into from
Oct 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions modules/mono/csharp_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1585,8 +1585,8 @@ void CSharpInstance::get_properties_state_for_reloading(List<Pair<StringName, Va
}

void CSharpInstance::get_property_list(List<PropertyInfo> *p_properties) const {
for (Map<StringName, PropertyInfo>::Element *E = script->member_info.front(); E; E = E->next()) {
p_properties->push_back(E->value());
for (OrderedHashMap<StringName, PropertyInfo>::ConstElement E = script->member_info.front(); E; E = E.next()) {
p_properties->push_front(E.value());
}

// Call _get_property_list
Expand All @@ -1608,12 +1608,12 @@ void CSharpInstance::get_property_list(List<PropertyInfo> *p_properties) const {

if (ret) {
Array array = Array(GDMonoMarshal::mono_object_to_variant(ret));
for (int i = 0, size = array.size(); i < size; i++)
for (int i = 0, size = array.size(); i < size; i++) {
p_properties->push_back(PropertyInfo::from_dict(array.get(i)));
return;
}
}

break;
return;
}

top = top->get_parent_class();
Expand All @@ -1634,8 +1634,9 @@ Variant::Type CSharpInstance::get_property_type(const StringName &p_name, bool *
}

void CSharpInstance::get_method_list(List<MethodInfo> *p_list) const {
if (!script->is_valid() || !script->script_class)
if (!script->is_valid() || !script->script_class) {
return;
}

GD_MONO_SCOPE_THREAD_ATTACH;

Expand Down Expand Up @@ -3280,8 +3281,8 @@ Ref<Script> CSharpScript::get_base_script() const {
}

void CSharpScript::get_script_property_list(List<PropertyInfo> *p_list) const {
for (Map<StringName, PropertyInfo>::Element *E = member_info.front(); E; E = E->next()) {
p_list->push_back(E->value());
for (OrderedHashMap<StringName, PropertyInfo>::ConstElement E = member_info.front(); E; E = E.next()) {
p_list->push_front(E.value());
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/mono/csharp_script.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class CSharpScript : public Script {
Set<StringName> exported_members_names;
#endif

Map<StringName, PropertyInfo> member_info;
OrderedHashMap<StringName, PropertyInfo> member_info;

void _clear();

Expand Down