### Godot version

4.0 beta 10

### System information

Windows 10

### Issue description

Godot crashes when i accidently name 2 items in an enum the same

EDIT:
The editor freeze for some seconds, then both editor- and console-window dissapear

### Steps to reproduce

Write

```gdscript
enum {
    A,
}
```

and then add a second line with another A:

```gdscript
enum {
    A,
    A # <- crash
}
```

Does not always immediatly happen if i copy&paste items.
Does not happen when i change the script in another editor and open the script in Godot.

### Minimal reproduction project

[enum.zip](https://github.com/godotengine/godot/files/10313759/enum.zip)

if (prop.name == name) {
							p_identifier->set_datatype(type_from_property(prop));
							return;
						}
					}
					if (base.is_hard_type()) {
						push_error(vformat(R"(Cannot find property "%s" on base "%s".)", name, base.to_string()), p_identifier);
					}
				}
			}
		}
		return;
	}
	GDScriptParser::ClassNode *base_class = base.class_type;
	List<GDScriptParser::ClassNode *> script_classes;
	bool is_base = true;
	if (base_class != nullptr) {
		get_class_node_current_scope_classes(base_class, &script_classes);
	}
	for (GDScriptParser::ClassNode *script_class : script_classes) {
		if (p_base == nullptr && script_class->identifier && script_class->identifier->name == name) {
			reduce_identifier_from_base_set_class(p_identifier, script_class->get_datatype());
			return;
		}
		if (script_class->has_member(name)) {
			resolve_class_member(script_class, name, p_identifier);
			GDScriptParser::ClassNode::Member member = script_class->get_member(name);
			switch (member.type) {
				case GDScriptParser::ClassNode::Member::CONSTANT: {
					p_identifier->set_datatype(member.get_datatype());