You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Merge pull request #25550 from DualMatrix/fix-25357
Fixed Null appearing inside export variables with type hints and no default value
This commit is contained in:
@@ -4724,6 +4724,25 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
|||||||
_set_error("Type-less export needs a constant expression assigned to infer type.");
|
_set_error("Type-less export needs a constant expression assigned to infer type.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (member._export.type != Variant::NIL) {
|
||||||
|
IdentifierNode *id = alloc_node<IdentifierNode>();
|
||||||
|
id->name = member.identifier;
|
||||||
|
|
||||||
|
ConstantNode *cn = alloc_node<ConstantNode>();
|
||||||
|
|
||||||
|
Variant::CallError ce;
|
||||||
|
cn->value = Variant::construct(member._export.type, NULL, 0, ce);
|
||||||
|
|
||||||
|
OperatorNode *op = alloc_node<OperatorNode>();
|
||||||
|
op->op = OperatorNode::OP_INIT_ASSIGN;
|
||||||
|
op->arguments.push_back(id);
|
||||||
|
op->arguments.push_back(cn);
|
||||||
|
|
||||||
|
p_class->initializer->statements.push_back(op);
|
||||||
|
|
||||||
|
member.initial_assignment = op;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoexport && member.data_type.has_type) {
|
if (autoexport && member.data_type.has_type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user