diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-28 11:11:15 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-28 14:33:18 -0700 |
| commit | cfbc7cbdc7cd09490c7c723758329b5ba78e5f9f (patch) | |
| tree | 404292a41b0f966a85bfe123a97487a8c8ef9626 /src/libsyntax/ext | |
| parent | e9b7ce6f57e8ca74dfdb16ba91fcae38d2c44798 (diff) | |
| download | rust-cfbc7cbdc7cd09490c7c723758329b5ba78e5f9f.tar.gz rust-cfbc7cbdc7cd09490c7c723758329b5ba78e5f9f.zip | |
Convert core::pipes to camel case
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/proto.rs | 4 |
3 files changed, 25 insertions, 11 deletions
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index d0a5757ed1f..b346e23178e 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -4,6 +4,7 @@ // something smarter. import ast::{ident, node_id}; +import ast_util::respan; import codemap::span; import ext::base::mk_ctxt; @@ -209,8 +210,21 @@ impl ext_ctxt: ext_ctxt_ast_builder { fn item(name: ident, span: span, +node: ast::item_) -> @ast::item { + + // XXX: Would be nice if our generated code didn't violate + // Rust coding conventions + let non_camel_case_attribute = respan(self.empty_span(), { + style: ast::attr_outer, + value: respan(self.empty_span(), + ast::meta_list(~"allow", ~[ + @respan(self.empty_span(), + ast::meta_word(~"non_camel_case_types")) + ])), + is_sugared_doc: false + }); + @{ident: name, - attrs: ~[], + attrs: ~[non_camel_case_attribute], id: self.next_id(), node: node, vis: ast::public, diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index 6d45bfe4142..44b99bc2ad5 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -72,10 +72,10 @@ impl message: gen_send { }; body += ~"let b = pipe.reuse_buffer();\n"; - body += fmt!("let %s = pipes::send_packet_buffered(\ + body += fmt!("let %s = pipes::SendPacketBuffered(\ ptr::addr_of(b.buffer.data.%s));\n", sp, next.name); - body += fmt!("let %s = pipes::recv_packet_buffered(\ + body += fmt!("let %s = pipes::RecvPacketBuffered(\ ptr::addr_of(b.buffer.data.%s));\n", rp, next.name); } @@ -258,7 +258,7 @@ impl state: to_type_decls { self.span, cx.ty_path_ast_builder( path(~[cx.ident_of(~"pipes"), - cx.ident_of(dir.to_str() + ~"_packet")], + cx.ident_of(dir.to_str() + ~"Packet")], empty_span()) .add_ty(cx.ty_path_ast_builder( path(~[cx.ident_of(self.proto.name), @@ -275,7 +275,7 @@ impl state: to_type_decls { cx.ty_path_ast_builder( path(~[cx.ident_of(~"pipes"), cx.ident_of(dir.to_str() - + ~"_packet_buffered")], + + ~"PacketBuffered")], empty_span()) .add_tys(~[cx.ty_path_ast_builder( path(~[cx.ident_of(self.proto.name), @@ -321,7 +321,7 @@ impl protocol: gen_init { }; cx.parse_item(fmt!("fn init%s() -> (client::%s, server::%s)\ - { import pipes::has_buffer; %s }", + { import pipes::HasBuffer; %s }", start_state.ty_params.to_source(cx), start_state.to_ty(cx).to_source(cx), start_state.to_ty(cx).to_source(cx), @@ -341,7 +341,7 @@ impl protocol: gen_init { let buffer_fields = self.gen_buffer_init(ext_cx); let buffer = #ast { - ~{header: pipes::buffer_header(), + ~{header: pipes::BufferHeader(), data: $(buffer_fields)} }; @@ -349,7 +349,7 @@ impl protocol: gen_init { ext_cx.block( self.states.map_to_vec( |s| ext_cx.parse_stmt( - fmt!("data.%s.set_buffer(buffer)", + fmt!("data.%s.set_buffer_(buffer)", s.name))), ext_cx.parse_expr( fmt!("ptr::addr_of(data.%s)", @@ -390,7 +390,7 @@ impl protocol: gen_init { } let ty = s.to_ty(cx); let fty = #ast[ty] { - pipes::packet<$(ty)> + pipes::Packet<$(ty)> }; cx.ty_field_imm(cx.ident_of(s.name), fty) }; diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 6c9dd577060..ab810bd48fd 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -10,8 +10,8 @@ enum direction { impl direction: ToStr { fn to_str() -> ~str { match self { - send => ~"send", - recv => ~"recv" + send => ~"Send", + recv => ~"Recv" } } } |
