Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual Methods missing return type #190

Closed
lilizoey opened this issue Mar 20, 2023 · 0 comments · Fixed by #207
Closed

Virtual Methods missing return type #190

lilizoey opened this issue Mar 20, 2023 · 0 comments · Fixed by #207
Labels
bug c: engine Godot classes (nodes, resources, ...)

Comments

@lilizoey
Copy link
Member

Virtual methods that have a return type don't have one in rust. For instance
PhysicsServer2DExtension._area_create returns an RID. However in PhysicsServer2DExtensionVirtual it is defined as:

fn area_create(&mut self) {
    unimplemented!()
}
@Bromeon Bromeon added bug c: register Register classes, functions and other symbols to GDScript c: engine Godot classes (nodes, resources, ...) and removed c: register Register classes, functions and other symbols to GDScript labels Mar 20, 2023
jbarnoud added a commit to jbarnoud/gdext that referenced this issue Mar 27, 2023
Fixes godot-rust#190

Some node methods are expected to return values. The corresponding
virtual methods, however, do not reflect that.

For instance, this is the virtual method `Node.get_configuration_warnings` before this commit:

```rust
fn get_configuration_warnings(&self) {
    unimplemented!()
}
```

This is the same method with this commit:

```rust
fn get_configuration_warnings(&self) -> PackedStringArray {
    unimplemented!()
}
```

This commit adapts the relevant code from
`godot_codegen::class_generator::make_method_definition` into
`make_virtual_method`.
jbarnoud added a commit to jbarnoud/gdext that referenced this issue Apr 3, 2023
Fixes godot-rust#190

Some node methods are expected to return values. The corresponding
virtual methods, however, do not reflect that.

For instance, this is the virtual method `Node.get_configuration_warnings` before this commit:

```rust
fn get_configuration_warnings(&self) {
    unimplemented!()
}
```

This is the same method with this commit:

```rust
fn get_configuration_warnings(&self) -> PackedStringArray {
    unimplemented!()
}
```

This commit makes
`godot_codegen::clas_generator::make_function_definition` and
`make_return` aware of virtual method. It also adds a test making sure
we can call a virtual method that has a return value.
jbarnoud added a commit to jbarnoud/gdext that referenced this issue Apr 4, 2023
Fixes godot-rust#190

Some node methods are expected to return values. The corresponding
virtual methods, however, do not reflect that.

For instance, this is the virtual method `Node.get_configuration_warnings` before this commit:

```rust
fn get_configuration_warnings(&self) {
    unimplemented!()
}
```

This is the same method with this commit:

```rust
fn get_configuration_warnings(&self) -> PackedStringArray {
    unimplemented!()
}
```

This commit makes
`godot_codegen::clas_generator::make_function_definition` and
`make_return` aware of virtual method. It also adds a test making sure
we can call a virtual method that has a return value.
bors bot added a commit that referenced this issue Apr 5, 2023
207: Add return values when generating virtual methods r=Bromeon a=jbarnoud

Fixes #190

Some node methods are expected to return values. The corresponding virtual methods, however, do not reflect that.

For instance, this is the virtual method `Node.get_configuration_warnings` before this commit:

```rust
fn get_configuration_warnings(&self) {
    unimplemented!()
}
```

This is the same method with this commit:

```rust
fn get_configuration_warnings(&self) -> PackedStringArray {
    unimplemented!()
}
```

This commit adapts what I think is the relevant code from
`godot_codegen::class_generator::make_method_definition` into `make_virtual_method`.

Note that I am very unfamiliar with most of the code I had to touch here as well as with the project.

Co-authored-by: Jonathan Barnoud <[email protected]>
@bors bors bot closed this as completed in e81d5d1 Apr 5, 2023
lilizoey pushed a commit to lilizoey/gdextension that referenced this issue Apr 11, 2023
Fixes godot-rust#190

Some node methods are expected to return values. The corresponding
virtual methods, however, do not reflect that.

For instance, this is the virtual method `Node.get_configuration_warnings` before this commit:

```rust
fn get_configuration_warnings(&self) {
    unimplemented!()
}
```

This is the same method with this commit:

```rust
fn get_configuration_warnings(&self) -> PackedStringArray {
    unimplemented!()
}
```

This commit makes
`godot_codegen::clas_generator::make_function_definition` and
`make_return` aware of virtual method. It also adds a test making sure
we can call a virtual method that has a return value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug c: engine Godot classes (nodes, resources, ...)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants