### Godot version

4.2 (c5da2e54fe50cad34b5f93fa10538978b33af88d)

### System information

Windows 11

### Issue description

Attempting to run a scene with the following script report Identifier not found error:

![image](https://github.com/godotengine/godot/assets/3036176/3a63b930-0588-499d-80a2-4f88f5f07116)

This does not happen on 4.1.1 so this is a regression.

### Steps to reproduce

Create a script derived from Control and try to get access to the mouse_entered signal.

### Minimal reproduction project

[TestBug.zip](https://github.com/godotengine/godot/files/12237764/TestBug.zip)

}
						}
						owner = owner->_owner;
					}
				} break;
				case GDScriptParser::IdentifierNode::STATIC_VARIABLE: {
					
					GDScript *scr = codegen.script;
					while (scr) {
						if (scr->static_variables_indices.has(identifier)) {
							if (scr->static_variables_indices[identifier].getter != StringName() && scr->static_variables_indices[identifier].getter != codegen.function_name) {
								
								GDScriptCodeGenerator::Address temp = codegen.add_temporary(scr->static_variables_indices[identifier].data_type);
								GDScriptCodeGenerator::Address class_addr(GDScriptCodeGenerator::Address::CLASS);
								Vector<GDScriptCodeGenerator::Address> args; 
								gen->write_call(temp, class_addr, scr->static_variables_indices[identifier].getter, args);
								return temp;
							} else {
								
								GDScriptCodeGenerator::Address temp = codegen.add_temporary(scr->static_variables_indices[identifier].data_type);
								GDScriptCodeGenerator::Address _class = codegen.add_constant(scr);
								int index = scr->static_variables_indices[identifier].index;
								gen->write_get_static_variable(temp, _class, index);
								return temp;
							}
						}
						scr = scr->_base;
					}
				} break;