Merge pull request #73398 from anvilfolk/fix-getter
Fix unset getter return types resulting in strange behavior
This commit is contained in:
commit
68807165f4
3 changed files with 12 additions and 1 deletions
|
@ -254,7 +254,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
|||
if (codegen.script->member_indices.has(identifier)) {
|
||||
if (codegen.script->member_indices[identifier].getter != StringName() && codegen.script->member_indices[identifier].getter != codegen.function_name) {
|
||||
// Perform getter.
|
||||
GDScriptCodeGenerator::Address temp = codegen.add_temporary();
|
||||
GDScriptCodeGenerator::Address temp = codegen.add_temporary(codegen.script->member_indices[identifier].data_type);
|
||||
Vector<GDScriptCodeGenerator::Address> args; // No argument needed.
|
||||
gen->write_call_self(temp, codegen.script->member_indices[identifier].getter, args);
|
||||
return temp;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
var Value:int = 8 :
|
||||
get:
|
||||
return Value
|
||||
set(v):
|
||||
Value = v
|
||||
|
||||
func test():
|
||||
var f:float = Value
|
||||
print(int(f))
|
|
@ -0,0 +1,2 @@
|
|||
GDTEST_OK
|
||||
8
|
Loading…
Reference in a new issue