Skip to content
This repository was archived by the owner on Jul 6, 2019. It is now read-only.

Commit e09fa3c

Browse files
committed
Merge pull request #1 from Gyscos/latest
Update platformtree for new rust
2 parents 57e9081 + d509aac commit e09fa3c

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

platformtree/src/builder/meta_args.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ fn set_tasks(cx: &mut ExtCtxt, tasks: Vec<P<ast::MetaItem>>) {
6363
let mut vec_clone = cx.cfg();
6464
let maybe_pos = vec_clone.iter().position(|i| {
6565
match i.node {
66-
ast::MetaList(ref k, _) if *k == TAG => true,
66+
ast::MetaItemKind::List(ref k, _) if *k == TAG => true,
6767
_ => false,
6868
}
6969
});
@@ -80,7 +80,7 @@ fn set_tasks(cx: &mut ExtCtxt, tasks: Vec<P<ast::MetaItem>>) {
8080
fn get_tasks(cx: &ExtCtxt) -> Vec<P<ast::MetaItem>> {
8181
for i in cx.cfg.iter() {
8282
match i.node {
83-
ast::MetaList(ref k, ref v) if *k == TAG => return v.clone(),
83+
ast::MetaItemKind::List(ref k, ref v) if *k == TAG => return v.clone(),
8484
_ => (),
8585
}
8686
};
@@ -92,10 +92,10 @@ fn get_task(tasks: &Vec<P<ast::MetaItem>>, task: &str) -> Vec<String> {
9292
let mut ty_params = vec!();
9393
for mi in tasks.iter() {
9494
match mi.node {
95-
ast::MetaList(ref k, ref v) if *k == task => {
95+
ast::MetaItemKind::List(ref k, ref v) if *k == task => {
9696
for submi in v.iter() {
9797
match submi.node {
98-
ast::MetaWord(ref w) => ty_params.push((&*w).to_string()),
98+
ast::MetaItemKind::Word(ref w) => ty_params.push((&*w).to_string()),
9999
_ => panic!("unexpected node type"),
100100
}
101101
}
@@ -125,11 +125,11 @@ fn get_task(tasks: &Vec<P<ast::MetaItem>>, task: &str) -> Vec<String> {
125125
// fn get_args(cx: &ExtCtxt) -> Option<Vec<MetaArgs>> {
126126
// cx.cfg.iter().find(|i| {
127127
// match i.node {
128-
// ast::MetaList(ref k, _) => k.get() == TAG,
128+
// ast::MetaItemKind::List(ref k, _) => k.get() == TAG,
129129
// _ => false,
130130
// }
131131
// }).and_then(|i| match i.node {
132-
// ast::MetaList(_, ref v) => Some(meta_item_to_meta_args(v)),
132+
// ast::MetaItemKind::List(_, ref v) => Some(meta_item_to_meta_args(v)),
133133
// _ => panic!(),
134134
// })
135135
// }

platformtree/src/builder/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ mod os;
3232
pub mod meta_args;
3333

3434
pub struct Builder {
35-
main_stmts: Vec<P<ast::Stmt>>,
35+
main_stmts: Vec<ast::Stmt>,
3636
type_items: Vec<P<ast::Item>>,
3737
pt: Rc<node::PlatformTree>,
3838
}
@@ -120,7 +120,7 @@ impl Builder {
120120
}
121121

122122
pub fn new(pt: Rc<node::PlatformTree>, cx: &ExtCtxt) -> Builder {
123-
let use_zinc = cx.item_use_simple(DUMMY_SP, ast::Inherited, cx.path_ident(
123+
let use_zinc = cx.item_use_simple(DUMMY_SP, ast::Visibility::Inherited, cx.path_ident(
124124
DUMMY_SP, cx.ident_of("zinc")));
125125

126126
Builder {
@@ -130,15 +130,15 @@ impl Builder {
130130
}
131131
}
132132

133-
pub fn main_stmts(&self) -> Vec<P<ast::Stmt>> {
133+
pub fn main_stmts(&self) -> Vec<ast::Stmt> {
134134
self.main_stmts.clone()
135135
}
136136

137137
pub fn pt(&self) -> Rc<node::PlatformTree> {
138138
self.pt.clone()
139139
}
140140

141-
pub fn add_main_statement(&mut self, stmt: P<ast::Stmt>) {
141+
pub fn add_main_statement(&mut self, stmt: ast::Stmt) {
142142
self.main_stmts.push(stmt);
143143
}
144144

@@ -228,14 +228,14 @@ impl Builder {
228228
ident: cx.ident_of(name),
229229
attrs: attrs,
230230
id: ast::DUMMY_NODE_ID,
231-
node: ast::ItemFn(
232-
cx.fn_decl(Vec::new(), cx.ty(DUMMY_SP, ast::Ty_::TyTup(Vec::new()))),
231+
node: ast::ItemKind::Fn(
232+
cx.fn_decl(Vec::new(), cx.ty(DUMMY_SP, ast::TyKind::Tup(Vec::new()))),
233233
ast::Unsafety::Unsafe,
234234
ast::Constness::NotConst,
235-
abi::Rust, // TODO(farcaller): should this be abi::C?
235+
abi::Abi::Rust, // TODO(farcaller): should this be abi::Abi::C?
236236
ast::Generics::default(),
237237
body),
238-
vis: ast::Public,
238+
vis: ast::Visibility::Public,
239239
span: span,
240240
})
241241
}

platformtree/src/builder/os.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ fn build_args(builder: &mut Builder, cx: &mut ExtCtxt,
117117
DUMMY_SP,
118118
cx.ty_ident(DUMMY_SP, cx.ident_of("str")),
119119
Some(static_lifetime),
120-
ast::MutImmutable), quote_expr!(&*cx, $val_slice))
120+
ast::Mutability::Immutable), quote_expr!(&*cx, $val_slice))
121121
},
122122
node::RefValue(ref rname) => {
123123
let refnode = builder.pt.get_by_name(rname.as_str()).unwrap();
@@ -134,12 +134,12 @@ fn build_args(builder: &mut Builder, cx: &mut ExtCtxt,
134134
DUMMY_SP,
135135
cx.ty_path(type_name_as_path(cx, reftype.as_str(), refparams)),
136136
Some(a_lifetime),
137-
ast::MutImmutable), quote_expr!(&*cx, &$val_slice))
137+
ast::Mutability::Immutable), quote_expr!(&*cx, &$val_slice))
138138
},
139139
};
140140
let name_ident = cx.ident_of(k.as_str());
141141
let sf = ast::StructField_ {
142-
kind: ast::NamedField(name_ident, ast::Public),
142+
kind: ast::NamedField(name_ident, ast::Visibility::Public),
143143
id: ast::DUMMY_NODE_ID,
144144
ty: ty,
145145
attrs: vec!(),
@@ -169,7 +169,7 @@ fn build_args(builder: &mut Builder, cx: &mut ExtCtxt,
169169
ident: name_ident,
170170
attrs: vec!(),
171171
id: ast::DUMMY_NODE_ID,
172-
node: ast::ItemStruct(
172+
node: ast::ItemKind::Struct(
173173
ast::VariantData::Struct(fields, ast::DUMMY_NODE_ID),
174174
ast::Generics {
175175
lifetimes: vec!(cx.lifetime_def(DUMMY_SP, intern("'a"), vec!())),
@@ -179,7 +179,7 @@ fn build_args(builder: &mut Builder, cx: &mut ExtCtxt,
179179
predicates: vec!(),
180180
}
181181
}),
182-
vis: ast::Public,
182+
vis: ast::Visibility::Public,
183183
span: DUMMY_SP,
184184
});
185185
builder.add_type_item(struct_item);

platformtree/src/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use std::ops::Deref;
1717
use std::collections::HashMap;
1818
use std::rc::{Rc, Weak};
19-
use syntax::ast::{TokenTree, LitInt, UnsuffixedIntLit};
19+
use syntax::ast::{TokenTree, LitKind, LitIntType};
2020
use syntax::codemap::{Span, mk_sp};
2121
use syntax::ext::base::ExtCtxt;
2222
use syntax::parse::{token, ParseSess, lexer, integer_lit};
@@ -186,7 +186,7 @@ impl<'a> Parser<'a> {
186186

187187
let lit = integer_lit(intname.as_str().deref(), None, &self.sess.span_diagnostic, self.span);
188188
match lit {
189-
LitInt(i, _) => {
189+
LitKind::Int(i, _) => {
190190
format!("{}", i)
191191
},
192192
_ => {
@@ -345,7 +345,7 @@ impl<'a> Parser<'a> {
345345
if suffix.is_none() {
346346
let lit = integer_lit(intname.as_str().deref(), None, &self.sess.span_diagnostic, self.span);
347347
match lit {
348-
LitInt(i, UnsuffixedIntLit(_)) => {
348+
LitKind::Int(i, LitIntType::Unsuffixed) => {
349349
self.bump();
350350
Some(node::IntValue(i as usize))
351351
},

0 commit comments

Comments
 (0)