Skip to content

Commit

Permalink
[lang] Add check for no env params in message signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop committed Mar 7, 2019
1 parent 5dc9607 commit 6f0ab0f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lang/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ impl Contract {
_ => ()
}
}
for fn_arg in inputs.iter().skip(1) {
if let ast::FnArg::Captured(arg_captured) = fn_arg {
if let syn::Pat::Ident(pat_ident) = &arg_captured.pat {
if pat_ident.ident == "env" {
bail!(
pat_ident.ident,
"contract messages must not contain an env argument"
)
}
}
}
}
}
Ok((deploy_handler, messages, methods))
}
Expand Down

0 comments on commit 6f0ab0f

Please sign in to comment.