Implement slicing syntax.
`expr[]`, `expr[expr..]`, `expr[..expr]`,`expr[expr..expr]` Uses the Slice and SliceMut traits. Allows ... as well as .. in range patterns.
This commit is contained in:
parent
af3889f697
commit
31a7e38759
27 changed files with 909 additions and 105 deletions
|
@ -424,6 +424,13 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
|||
self.call(expr, pred, &**l, Some(&**r).into_iter())
|
||||
}
|
||||
|
||||
ast::ExprSlice(ref base, ref start, ref end, _) => {
|
||||
self.call(expr,
|
||||
pred,
|
||||
&**base,
|
||||
start.iter().chain(end.iter()).map(|x| &**x))
|
||||
}
|
||||
|
||||
ast::ExprUnary(_, ref e) if self.is_method_call(expr) => {
|
||||
self.call(expr, pred, &**e, None::<ast::Expr>.iter())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue