Skip to content

Commit 9dfa40a

Browse files
committed
---
yaml --- r: 31403 b: refs/heads/dist-snap c: b97fe98 h: refs/heads/master i: 31401: f9547cf 31399: 7631c33 v: v3
1 parent ba273e0 commit 9dfa40a

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: c28af2625870b2117e73fc8bee83a1704cff7414
10+
refs/heads/dist-snap: b97fe9835430553c0b566cf1f5687e6c7403821b
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libsyntax/ext/pipes/ast_builder.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,22 @@ trait ext_ctxt_ast_builder {
9191
+params: ~[ast::ty_param]) -> @ast::item;
9292
fn item_ty(name: ident, ty: @ast::ty) -> @ast::item;
9393
fn ty_vars(+ty_params: ~[ast::ty_param]) -> ~[@ast::ty];
94+
fn ty_field_imm(name: ident, ty: @ast::ty) -> ast::ty_field;
95+
fn ty_rec(+~[ast::ty_field]) -> @ast::ty;
9496
}
9597

9698
impl ast_builder of ext_ctxt_ast_builder for ext_ctxt {
99+
fn ty_field_imm(name: ident, ty: @ast::ty) -> ast::ty_field {
100+
{node: {ident: name, mt: { ty: ty, mutbl: ast::m_imm } },
101+
span: empty_span()}
102+
}
103+
104+
fn ty_rec(+fields: ~[ast::ty_field]) -> @ast::ty {
105+
@{id: self.next_id(),
106+
node: ast::ty_rec(fields),
107+
span: empty_span()}
108+
}
109+
97110
fn ty_param(id: ast::ident, +bounds: ~[ast::ty_param_bound])
98111
-> ast::ty_param
99112
{

branches/dist-snap/src/libsyntax/ext/pipes/pipec.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ impl compile of to_type_decls for state {
204204

205205
impl compile of gen_init for protocol {
206206
fn gen_init(cx: ext_ctxt) -> @ast::item {
207+
#debug("gen_init");
207208
let start_state = self.states[0];
208209

209210
let body = alt start_state.dir {
@@ -237,6 +238,23 @@ impl compile of gen_init for protocol {
237238
server_states += s.to_endpoint_decls(cx, recv);
238239
}
239240

241+
if self.is_bounded() {
242+
vec::push(
243+
items,
244+
cx.item_ty(
245+
@~"buffer",
246+
cx.ty_rec(
247+
(copy self.states).map_to_vec(
248+
|s| cx.ty_field_imm(
249+
s.name,
250+
cx.ty_path_ast_builder(
251+
(path(@~"pipes")
252+
+ @~"packet")
253+
.add_ty(
254+
cx.ty_path_ast_builder(
255+
path(s.name)))))))))
256+
}
257+
240258
vec::push(items,
241259
cx.item_mod(@~"client",
242260
client_states));

0 commit comments

Comments
 (0)