Improve delegate! error handling
kpob opened this issue · comments
If you make any mistake in a delegate
block, errors are swallowed.
The block expects a trait function to be declared, so without the pub
keyword.
Any other syntax errors cause that all the delegated functions don't show up in the module.
The macro should emit syn
errors to be presented in IDE.
delegate! {
to self.erc20 {
pub fn transfer(&mut self, recipient: &Address, amount: &U256); // pub
fn transfer_from(&mut self, owner: &Address, recipient: &Address, amount: &U256);
fn approve(&mut self, spender: &Address, amount: &U256);
fn name(&self) -> String;
fn symbol(&self) -> String;
fn decimals(&self) - a-> u8; // wrong arrow
fn total_supply(&self) -> U256;
fn balance_of(&self, owner: &Address) -> U256;
fn allowance(&self, owner: &Address, spender: &Address) -> U256;
}
to self.ownable {
fn get_owner(&self) -> Address;
fn transfer_ownership(&mut self, new_owner: &Address);
}
}