File tree Expand file tree Collapse file tree 4 files changed +22
-8
lines changed Expand file tree Collapse file tree 4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: c7ed9908d6023a278b2a53711abea50d186b71bc
2
+ refs/heads/master: 87f4c153110743844e4b3a4bb9dcde31a5ef3eb4
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5
5
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
Original file line number Diff line number Diff line change @@ -928,15 +928,16 @@ class parser {
928
928
!self . is_keyword ( ~"with") {
929
929
self . expect ( token:: COMMA ) ;
930
930
if self . token == token:: RBRACE ||
931
- self . is_keyword ( ~"with") {
931
+ self . is_keyword ( ~"with") ||
932
+ self . token == token:: DOTDOT {
932
933
// Accept an optional trailing comma.
933
934
break ;
934
935
}
935
936
vec:: push ( fields, self . parse_field ( token:: COLON ) ) ;
936
937
}
937
938
938
939
let base;
939
- if self . eat_keyword ( ~"with") {
940
+ if self . eat_keyword ( ~"with") || self . eat ( token :: DOTDOT ) {
940
941
base = some ( self . parse_expr ( ) ) ;
941
942
} else {
942
943
base = none;
@@ -1548,6 +1549,16 @@ class parser {
1548
1549
let mut fields = ~[ self . parse_field ( token:: COLON ) ] ;
1549
1550
let mut base = none;
1550
1551
while self . token != token:: RBRACE {
1552
+ if self . token == token:: COMMA
1553
+ && self . look_ahead ( 1 ) == token:: DOTDOT {
1554
+ self . bump ( ) ;
1555
+ self . bump ( ) ;
1556
+ base = some ( self . parse_expr ( ) ) ; break ;
1557
+ }
1558
+
1559
+ // XXX: Remove "with" after all code is converted over and there's
1560
+ // a snapshot.
1561
+
1551
1562
// optional comma before "with"
1552
1563
if self . token == token:: COMMA
1553
1564
&& self . token_is_keyword ( ~"with",
Original file line number Diff line number Diff line change @@ -1039,7 +1039,9 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
1039
1039
some(expr) => {
1040
1040
if vec::len(fields) > 0u { space(s.s); }
1041
1041
ibox(s, indent_unit);
1042
- word_space(s, ~" with") ;
1042
+ word(s.s, ~" , ");
1043
+ space(s.s);
1044
+ word(s.s, ~" ..");
1043
1045
print_expr(s, expr);
1044
1046
end(s);
1045
1047
}
@@ -1055,7 +1057,9 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
1055
1057
some(expr) => {
1056
1058
if vec::len(fields) > 0u { space(s.s); }
1057
1059
ibox(s, indent_unit);
1058
- word_space(s, ~" with") ;
1060
+ word(s.s, ~" , ");
1061
+ space(s.s);
1062
+ word(s.s, ~" ..");
1059
1063
print_expr(s, expr);
1060
1064
end(s);
1061
1065
}
Original file line number Diff line number Diff line change @@ -5,8 +5,7 @@ struct Foo {
5
5
6
6
fn main ( ) {
7
7
let a = Foo { x : 1 , y : 2 } ;
8
- let b = Foo { x : 3 with a } ;
9
- let c = Foo { x : 4 , with a } ;
10
- io:: println ( fmt ! ( "%? %?" , b, c) ) ;
8
+ let c = Foo { x : 4 , .. a } ;
9
+ io:: println ( fmt ! ( "%?" , c) ) ;
11
10
}
12
11
You can’t perform that action at this time.
0 commit comments