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

refactor: change private init method from error to warning #1043

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions near-sdk-macros/src/core_impl/info_extractor/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Visitor {
}
}

pub fn visit_private_attr(&mut self, attr: &Attribute) -> syn::Result<()> {
pub fn visit_private_attr(&mut self, _attr: &Attribute) -> syn::Result<()> {
use VisitorKind::*;

match self.kind {
Expand All @@ -95,8 +95,13 @@ impl Visitor {
Ok(())
}
Init => {
let message = format!("{} function can't be private.", self.kind);
Err(Error::new(attr.span(), message))
// TODO: return an error instead in 5.0
// see https://github.com/near/near-sdk-rs/issues/1040
println!("near_bindgen: private init functions will be disallowed in 5.0");
Ok(())

// let message = format!("{} function can't be private.", self.kind);
// Err(Error::new(attr.span(), message))
}
}
}
Expand Down