Add a pass-by-copy parameter passing convention
This is intended to solve the problem of how to pass arguments to constructor functions -- you want to move in rvalues, but not have to explicitly copy stuff that is not an rvalue. The by-copy passing convention will ensure the callee gets its own copy of the value. For rvalues, it'll just pass off the value. For lvalues, it'll make a copy. Issue #1177
This commit is contained in:
parent
6297fc979e
commit
4e03112141
9 changed files with 36 additions and 10 deletions
|
|
@ -12,9 +12,10 @@ import middle::ast_map;
|
|||
fn mode_str(m: ty::mode) -> str {
|
||||
alt m {
|
||||
ast::by_ref. { "&&" }
|
||||
ast::by_val. { "+" }
|
||||
ast::by_val. { "++" }
|
||||
ast::by_mut_ref. { "&" }
|
||||
ast::by_move. { "-" }
|
||||
ast::by_copy. { "+" }
|
||||
_ { "" }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue