mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Merge pull request #73915 from vonagam/fix-conversions-from-native-member
GDScript: Fix conversions from native members accessed by identifier
This commit is contained in:
commit
c0f1ed57c4
3 changed files with 14 additions and 1 deletions
|
|
@ -238,7 +238,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code
|
||||||
// Try class members.
|
// Try class members.
|
||||||
if (_is_class_member_property(codegen, identifier)) {
|
if (_is_class_member_property(codegen, identifier)) {
|
||||||
// Get property.
|
// Get property.
|
||||||
GDScriptCodeGenerator::Address temp = codegen.add_temporary(); // TODO: Could get the type of the class member here.
|
GDScriptCodeGenerator::Address temp = codegen.add_temporary(_gdtype_from_datatype(p_expression->get_datatype(), codegen.script));
|
||||||
gen->write_get_member(temp, identifier);
|
gen->write_get_member(temp, identifier);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
class Foo extends Node:
|
||||||
|
func _init():
|
||||||
|
name = 'f'
|
||||||
|
var string: String = name
|
||||||
|
assert(typeof(string) == TYPE_STRING)
|
||||||
|
assert(string == 'f')
|
||||||
|
print('ok')
|
||||||
|
|
||||||
|
func test():
|
||||||
|
var foo := Foo.new()
|
||||||
|
foo.free()
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
GDTEST_OK
|
||||||
|
ok
|
||||||
Loading…
Add table
Add a link
Reference in a new issue