diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-01-13 06:02:56 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-01-15 18:51:14 +0200 |
| commit | 2cdc86c180296ff2c929ec55fcf33a0f6b391b3a (patch) | |
| tree | 1d9e7cc7086adb4c17ba82171d3696ac633a8648 /src/libsyntax/print | |
| parent | 1c78ad937b4da9dd872b0a865025f3e2e885f90d (diff) | |
| download | rust-2cdc86c180296ff2c929ec55fcf33a0f6b391b3a.tar.gz rust-2cdc86c180296ff2c929ec55fcf33a0f6b391b3a.zip | |
syntax: add fully qualified UFCS expressions.
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 9b6f8e6002d..ec6672d22a9 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -727,14 +727,7 @@ impl<'a> State<'a> { try!(self.print_bounds("", &bounds[])); } ast::TyQPath(ref qpath) => { - try!(word(&mut self.s, "<")); - try!(self.print_type(&*qpath.self_type)); - try!(space(&mut self.s)); - try!(self.word_space("as")); - try!(self.print_trait_ref(&*qpath.trait_ref)); - try!(word(&mut self.s, ">")); - try!(word(&mut self.s, "::")); - try!(self.print_ident(qpath.item_name)); + try!(self.print_qpath(&**qpath, false)) } ast::TyFixedLengthVec(ref ty, ref v) => { try!(word(&mut self.s, "[")); @@ -1749,6 +1742,7 @@ impl<'a> State<'a> { } } ast::ExprPath(ref path) => try!(self.print_path(path, true)), + ast::ExprQPath(ref qpath) => try!(self.print_qpath(&**qpath, true)), ast::ExprBreak(opt_ident) => { try!(word(&mut self.s, "break")); try!(space(&mut self.s)); @@ -1933,6 +1927,22 @@ impl<'a> State<'a> { Ok(()) } + fn print_qpath(&mut self, + qpath: &ast::QPath, + colons_before_params: bool) + -> IoResult<()> + { + try!(word(&mut self.s, "<")); + try!(self.print_type(&*qpath.self_type)); + try!(space(&mut self.s)); + try!(self.word_space("as")); + try!(self.print_trait_ref(&*qpath.trait_ref)); + try!(word(&mut self.s, ">")); + try!(word(&mut self.s, "::")); + try!(self.print_ident(qpath.item_path.identifier)); + self.print_path_parameters(&qpath.item_path.parameters, colons_before_params) + } + fn print_path_parameters(&mut self, parameters: &ast::PathParameters, colons_before_params: bool) |
