Allow setters returning values when return_raw.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rhai_codegen"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
edition = "2018"
|
||||
authors = ["jhwgh1968", "Stephen Chung"]
|
||||
description = "Procedural macros support package for Rhai, a scripting language and engine for Rust"
|
||||
|
@@ -541,8 +541,10 @@ impl ExportedFn {
|
||||
"property setter requires exactly 2 parameters",
|
||||
))
|
||||
}
|
||||
// 3b. Property setters must return nothing.
|
||||
FnSpecialAccess::Property(Property::Set(_)) if self.return_type().is_some() => {
|
||||
// 3b. Non-raw property setters must return nothing.
|
||||
FnSpecialAccess::Property(Property::Set(_))
|
||||
if params.return_raw.is_none() && self.return_type().is_some() =>
|
||||
{
|
||||
return Err(syn::Error::new(
|
||||
self.signature.output.span(),
|
||||
"property setter cannot return any value",
|
||||
@@ -569,8 +571,10 @@ impl ExportedFn {
|
||||
"index setter requires exactly 3 parameters",
|
||||
))
|
||||
}
|
||||
// 5b. Index setters must return nothing.
|
||||
FnSpecialAccess::Index(Index::Set) if self.return_type().is_some() => {
|
||||
// 5b. Non-raw index setters must return nothing.
|
||||
FnSpecialAccess::Index(Index::Set)
|
||||
if params.return_raw.is_none() && self.return_type().is_some() =>
|
||||
{
|
||||
return Err(syn::Error::new(
|
||||
self.signature.output.span(),
|
||||
"index setter cannot return any value",
|
||||
|
Reference in New Issue
Block a user