@@ -147,7 +147,7 @@ pub fn ty_to_str(ty: &ast::Ty, intr: @ident_interner) -> ~str {
147
147
}
148
148
149
149
pub fn pat_to_str ( pat : & ast:: pat , intr : @ident_interner ) -> ~str {
150
- to_str ( pat, print_irrefutable_pat , intr)
150
+ to_str ( pat, print_pat , intr)
151
151
}
152
152
153
153
pub fn expr_to_str ( e : & ast:: expr , intr : @ident_interner ) -> ~str {
@@ -1240,7 +1240,7 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
1240
1240
if first {
1241
1241
first = false ;
1242
1242
} else { space( s. s) ; word_space( s, "|"); }
1243
- print_refutable_pat (s, *p);
1243
+ print_pat (s, *p);
1244
1244
}
1245
1245
space(s.s);
1246
1246
match arm.guard {
@@ -1434,7 +1434,7 @@ pub fn print_expr(s: @ps, expr: &ast::expr) {
1434
1434
}
1435
1435
1436
1436
pub fn print_local_decl( s: @ps, loc: & ast:: local) {
1437
- print_irrefutable_pat ( s, loc. node. pat) ;
1437
+ print_pat ( s, loc. node. pat) ;
1438
1438
match loc. node. ty. node {
1439
1439
ast:: ty_infer => ( ) ,
1440
1440
_ => { word_space( s, ": ") ; print_type( s, & loc. node. ty) ; }
@@ -1521,20 +1521,7 @@ pub fn print_path(s: @ps, path: &ast::Path, colons_before_params: bool) {
1521
1521
print_path_( s, path, colons_before_params, & None )
1522
1522
}
1523
1523
1524
- pub fn print_bounded_path( s: @ps, path: & ast:: Path ,
1525
- bounds: & Option <OptVec <ast:: TyParamBound >>) {
1526
- print_path_( s, path, false, bounds)
1527
- }
1528
-
1529
- pub fn print_irrefutable_pat( s: @ps, pat: & ast:: pat) {
1530
- print_pat( s, pat, false)
1531
- }
1532
-
1533
- pub fn print_refutable_pat( s: @ps, pat: & ast:: pat) {
1534
- print_pat( s, pat, true)
1535
- }
1536
-
1537
- pub fn print_pat( s: @ps, pat: & ast:: pat, refutable: bool ) {
1524
+ pub fn print_pat( s: @ps, pat: & ast:: pat) {
1538
1525
maybe_print_comment( s, pat. span. lo) ;
1539
1526
let ann_node = node_pat( s, pat) ;
1540
1527
( s. ann. pre) ( ann_node) ;
@@ -1543,20 +1530,18 @@ pub fn print_pat(s: @ps, pat: &ast::pat, refutable: bool) {
1543
1530
match pat. node {
1544
1531
ast:: pat_wild => word( s. s, "_") ,
1545
1532
ast:: pat_ident( binding_mode, ref path, sub) => {
1546
- if refutable {
1547
- match binding_mode {
1548
- ast:: bind_by_ref( mutbl) => {
1549
- word_nbsp( s, "ref ") ;
1550
- print_mutability( s, mutbl) ;
1551
- }
1552
- ast:: bind_infer => { }
1533
+ match binding_mode {
1534
+ ast:: bind_by_ref( mutbl) => {
1535
+ word_nbsp( s, "ref ") ;
1536
+ print_mutability( s, mutbl) ;
1553
1537
}
1538
+ ast:: bind_infer => { }
1554
1539
}
1555
1540
print_path( s, path, true) ;
1556
1541
match sub {
1557
1542
Some ( p) => {
1558
1543
word( s. s, "@") ;
1559
- print_pat( s, p, refutable ) ;
1544
+ print_pat( s, p) ;
1560
1545
}
1561
1546
None => ( )
1562
1547
}
@@ -1569,7 +1554,7 @@ pub fn print_pat(s: @ps, pat: &ast::pat, refutable: bool) {
1569
1554
if !args. is_empty( ) {
1570
1555
popen( s) ;
1571
1556
commasep( s, inconsistent, * args,
1572
- |s, & p| print_pat( s, p, refutable ) ) ;
1557
+ |s, & p| print_pat( s, p) ) ;
1573
1558
pclose( s) ;
1574
1559
} else { }
1575
1560
}
@@ -1578,16 +1563,16 @@ pub fn print_pat(s: @ps, pat: &ast::pat, refutable: bool) {
1578
1563
ast:: pat_struct( ref path, ref fields, etc) => {
1579
1564
print_path( s, path, true) ;
1580
1565
word( s. s, "{ ") ;
1581
- fn print_field( s: @ps, f: & ast:: field_pat, refutable : bool ) {
1566
+ fn print_field( s: @ps, f: & ast:: field_pat) {
1582
1567
cbox( s, indent_unit) ;
1583
1568
print_ident( s, f. ident) ;
1584
1569
word_space( s, ": ") ;
1585
- print_pat( s, f. pat, refutable ) ;
1570
+ print_pat( s, f. pat) ;
1586
1571
end( s) ;
1587
1572
}
1588
1573
fn get_span( f: & ast:: field_pat) -> codemap:: span { return f. pat. span; }
1589
1574
commasep_cmnt( s, consistent, * fields,
1590
- |s, f| print_field( s, f, refutable ) ,
1575
+ |s, f| print_field( s, f) ,
1591
1576
get_span) ;
1592
1577
if etc {
1593
1578
if fields. len( ) != 0 u { word_space( s, ", ") ; }
@@ -1597,23 +1582,23 @@ pub fn print_pat(s: @ps, pat: &ast::pat, refutable: bool) {
1597
1582
}
1598
1583
ast:: pat_tup( ref elts) => {
1599
1584
popen( s) ;
1600
- commasep( s, inconsistent, * elts, |s, & p| print_pat( s, p, refutable ) ) ;
1585
+ commasep( s, inconsistent, * elts, |s, & p| print_pat( s, p) ) ;
1601
1586
if elts. len( ) == 1 {
1602
1587
word( s. s, ", ") ;
1603
1588
}
1604
1589
pclose( s) ;
1605
1590
}
1606
1591
ast:: pat_box( inner) => {
1607
1592
word( s. s, "@") ;
1608
- print_pat( s, inner, refutable ) ;
1593
+ print_pat( s, inner) ;
1609
1594
}
1610
1595
ast:: pat_uniq( inner) => {
1611
1596
word( s. s, "~") ;
1612
- print_pat( s, inner, refutable ) ;
1597
+ print_pat( s, inner) ;
1613
1598
}
1614
1599
ast:: pat_region( inner) => {
1615
1600
word( s. s, "& ") ;
1616
- print_pat( s, inner, refutable ) ;
1601
+ print_pat( s, inner) ;
1617
1602
}
1618
1603
ast:: pat_lit( e) => print_expr( s, e) ,
1619
1604
ast:: pat_range( begin, end) => {
@@ -1625,16 +1610,16 @@ pub fn print_pat(s: @ps, pat: &ast::pat, refutable: bool) {
1625
1610
ast:: pat_vec( ref before, slice, ref after) => {
1626
1611
word( s. s, "[ ") ;
1627
1612
do commasep( s, inconsistent, * before) |s, & p| {
1628
- print_pat( s, p, refutable ) ;
1613
+ print_pat( s, p) ;
1629
1614
}
1630
1615
for slice. iter( ) . advance |& p| {
1631
1616
if !before. is_empty( ) { word_space( s, "," ) ; }
1632
1617
word( s. s, ".." ) ;
1633
- print_pat( s, p, refutable ) ;
1618
+ print_pat( s, p) ;
1634
1619
if !after. is_empty( ) { word_space( s, "," ) ; }
1635
1620
}
1636
1621
do commasep( s, inconsistent, * after) |s, & p| {
1637
- print_pat( s, p, refutable ) ;
1622
+ print_pat( s, p) ;
1638
1623
}
1639
1624
word( s. s, "]" ) ;
1640
1625
}
@@ -1888,7 +1873,7 @@ pub fn print_arg(s: @ps, input: &ast::arg) {
1888
1873
word_space( s, "mut ") ;
1889
1874
}
1890
1875
match input. ty. node {
1891
- ast:: ty_infer => print_irrefutable_pat ( s, input. pat) ,
1876
+ ast:: ty_infer => print_pat ( s, input. pat) ,
1892
1877
_ => {
1893
1878
match input. pat. node {
1894
1879
ast:: pat_ident( _, ref path, _) if
@@ -1897,7 +1882,7 @@ pub fn print_arg(s: @ps, input: &ast::arg) {
1897
1882
// Do nothing.
1898
1883
}
1899
1884
_ => {
1900
- print_irrefutable_pat ( s, input. pat) ;
1885
+ print_pat ( s, input. pat) ;
1901
1886
word( s. s, ": ") ;
1902
1887
space( s. s) ;
1903
1888
}
0 commit comments