Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate typed return values for arrays.
Fixes oniksan#38. Given: ``` message Foo { repeated int32 i = 1; repeated string s = 2; repeated Bar b = 3; } ``` Previously godobuf would generate: ``` get_i() -> Array get_s() -> Array get_b() -> Array ``` Now it generates: ``` get_i() -> Array[int] get_s() -> Array[string] get_b() -> Array[Bar] ``` To do this, we must assign a typed array when constructing the PBField. Godot does not currently have a typed array constructor: godotengine/godot#72627 (comment) To work around this, we create a local typed variable, like so: ``` class Test1: func _init(): var __rf_double_default: Array[float] = [] __rf_double = PBField.new("rf_double", PB_DATA_TYPE.DOUBLE, PB_RULE.REPEATED, 23, true, __rf_double_default) ... func get_rf_double() -> Array[float]: return __rf_double.value ```
- Loading branch information