### 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)

p_function->set_datatype(resolving_datatype);
#ifdef TOOLS_ENABLED
	int default_value_count = 0;
#endif 
	for (int i = 0; i < p_function->parameters.size(); i++) {
		resolve_parameter(p_function->parameters[i]);
#ifdef DEBUG_ENABLED
		if (p_function->parameters[i]->usages == 0 && !String(p_function->parameters[i]->identifier->name).begins_with("_")) {
			parser->push_warning(p_function->parameters[i]->identifier, GDScriptWarning::UNUSED_PARAMETER, function_name, p_function->parameters[i]->identifier->name);
		}
		is_shadowing(p_function->parameters[i]->identifier, "function parameter");
#endif 
#ifdef TOOLS_ENABLED
		if (p_function->parameters[i]->initializer) {
			default_value_count++;
			if (p_function->parameters[i]->initializer->is_constant) {
				p_function->default_arg_values.push_back(p_function->parameters[i]->initializer->reduced_value);
			} else {
				p_function->default_arg_values.push_back(Variant()); 
			}
		}
#endif 
	}
	if (!p_is_lambda && function_name == GDScriptLanguage::get_singleton()->strings._init) {
		
		GDScriptParser::DataType return_type = parser->current_class->get_datatype();
		return_type.is_meta_type = false;
		p_function->set_datatype(return_type);
		if (p_function->return_type) {
			GDScriptParser::DataType declared_return = resolve_datatype(p_function->return_type);