Skip to content

Commit 023c16f

Browse files
committed
---
yaml --- r: 15608 b: refs/heads/try c: a872a99 h: refs/heads/master v: v3
1 parent 30c6f24 commit 023c16f

File tree

22 files changed

+169
-214
lines changed

22 files changed

+169
-214
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 587d8a5d4f503ec07a8b964c04376078d14bf307
5+
refs/heads/try: a872a99bfe400f794171a58fc47025133ce08155
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/librustsyntax/ast.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ type ident = str;
3737
type fn_ident = option<ident>;
3838

3939
#[auto_serialize]
40-
type path_ = {global: bool, idents: [ident], types: [@ty]};
41-
42-
#[auto_serialize]
43-
type path = spanned<path_>;
40+
type path = {span: span, global: bool, idents: [ident], types: [@ty]};
4441

4542
#[auto_serialize]
4643
type crate_num = int;

branches/try/src/librustsyntax/ast_util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn mk_sp(lo: uint, hi: uint) -> span {
2121
// make this a const, once the compiler supports it
2222
fn dummy_sp() -> span { ret mk_sp(0u, 0u); }
2323

24-
fn path_name(p: @path) -> str { path_name_i(p.node.idents) }
24+
fn path_name(p: @path) -> str { path_name_i(p.idents) }
2525

2626
fn path_name_i(idents: [ident]) -> str { str::connect(idents, "::") }
2727

@@ -183,8 +183,8 @@ fn is_exported(i: ident, m: _mod) -> bool {
183183
}
184184

185185
ast::view_path_list(path, ids, _) {
186-
if vec::len(path.node.idents) == 1u {
187-
if i == path.node.idents[0] { ret true; }
186+
if vec::len(path.idents) == 1u {
187+
if i == path.idents[0] { ret true; }
188188
for ids.each {|id|
189189
if id.node.name == i { ret true; }
190190
}
@@ -249,7 +249,7 @@ fn default_block(stmts1: [@stmt], expr1: option<@expr>, id1: node_id) ->
249249
}
250250

251251
fn ident_to_path(s: span, i: ident) -> @path {
252-
@respan(s, {global: false, idents: [i], types: []})
252+
@{span: s, global: false, idents: [i], types: []}
253253
}
254254

255255
pure fn is_unguarded(&&a: arm) -> bool {

branches/try/src/librustsyntax/ext/auto_serialize.rs

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,17 @@ fn expand(cx: ext_ctxt,
124124
impl helpers for ext_ctxt {
125125
fn helper_path(base_path: @ast::path,
126126
helper_name: str) -> @ast::path {
127-
let head = vec::init(base_path.node.idents);
128-
let tail = vec::last(base_path.node.idents);
127+
let head = vec::init(base_path.idents);
128+
let tail = vec::last(base_path.idents);
129129
self.path(base_path.span, head + [helper_name + "_" + tail])
130130
}
131131

132132
fn path(span: span, strs: [str]) -> @ast::path {
133-
@{node: {global: false, idents: strs, types: []},
134-
span: span}
133+
@{span: span, global: false, idents: strs, types: []}
135134
}
136135

137136
fn path_tps(span: span, strs: [str], tps: [@ast::ty]) -> @ast::path {
138-
@{node: {global: false, idents: strs, types: tps},
139-
span: span}
137+
@{span: span, global: false, idents: strs, types: tps}
140138
}
141139

142140
fn ty_path(span: span, strs: [str], tps: [@ast::ty]) -> @ast::ty {
@@ -195,10 +193,7 @@ impl helpers for ext_ctxt {
195193
}
196194

197195
fn binder_pat(span: span, nm: str) -> @ast::pat {
198-
let path = @{node: {global: false,
199-
idents: [nm],
200-
types: []},
201-
span: span};
196+
let path = @{span: span, global: false, idents: [nm], types: []};
202197
@{id: self.next_id(),
203198
node: ast::pat_ident(path, none),
204199
span: span}
@@ -292,7 +287,7 @@ fn ser_path(cx: ext_ctxt, tps: ser_tps_map, path: @ast::path,
292287
ast::expr_path(
293288
cx.helper_path(path, "serialize")));
294289

295-
let ty_args = vec::map(path.node.types) {|ty|
290+
let ty_args = vec::map(path.types) {|ty|
296291
let sv_stmts = ser_ty(cx, tps, ty, cx.clone(s), #ast{ __v });
297292
let sv = cx.expr(path.span,
298293
ast::expr_block(cx.blk(path.span, sv_stmts)));
@@ -428,9 +423,9 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
428423
}
429424

430425
ast::ty_path(path, _) {
431-
if vec::len(path.node.idents) == 1u &&
432-
vec::is_empty(path.node.types) {
433-
let ident = path.node.idents[0];
426+
if vec::len(path.idents) == 1u &&
427+
vec::is_empty(path.types) {
428+
let ident = path.idents[0];
434429

435430
alt tps.find(ident) {
436431
some(f) { f(v) }
@@ -566,7 +561,7 @@ fn deser_path(cx: ext_ctxt, tps: deser_tps_map, path: @ast::path,
566561
ast::expr_path(
567562
cx.helper_path(path, "deserialize")));
568563

569-
let ty_args = vec::map(path.node.types) {|ty|
564+
let ty_args = vec::map(path.types) {|ty|
570565
let dv_expr = deser_ty(cx, tps, ty, cx.clone(d));
571566
cx.lambda(cx.expr_blk(dv_expr))
572567
};
@@ -650,9 +645,9 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map,
650645
}
651646

652647
ast::ty_path(path, _) {
653-
if vec::len(path.node.idents) == 1u &&
654-
vec::is_empty(path.node.types) {
655-
let ident = path.node.idents[0];
648+
if vec::len(path.idents) == 1u &&
649+
vec::is_empty(path.types) {
650+
let ident = path.idents[0];
656651

657652
alt tps.find(ident) {
658653
some(f) { f() }

branches/try/src/librustsyntax/ext/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, error: str) -> str {
137137
fn expr_to_ident(cx: ext_ctxt, expr: @ast::expr, error: str) -> ast::ident {
138138
alt expr.node {
139139
ast::expr_path(p) {
140-
if vec::len(p.node.types) > 0u || vec::len(p.node.idents) != 1u {
140+
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
141141
cx.span_fatal(expr.span, error);
142-
} else { ret p.node.idents[0]; }
142+
} else { ret p.idents[0]; }
143143
}
144144
_ { cx.span_fatal(expr.span, error); }
145145
}

branches/try/src/librustsyntax/ext/build.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ fn mk_unary(cx: ext_ctxt, sp: span, op: ast::unop, e: @ast::expr)
3030
}
3131
fn mk_path(cx: ext_ctxt, sp: span, idents: [ast::ident]) ->
3232
@ast::expr {
33-
let path = {global: false, idents: idents, types: []};
34-
let sp_path = @{node: path, span: sp};
35-
let pathexpr = ast::expr_path(sp_path);
33+
let path = @{span: sp, global: false, idents: idents, types: []};
34+
let pathexpr = ast::expr_path(path);
3635
ret @{id: cx.next_id(), node: pathexpr, span: sp};
3736
}
3837
fn mk_access_(cx: ext_ctxt, sp: span, p: @ast::expr, m: ast::ident)

branches/try/src/librustsyntax/ext/concat_idents.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ fn expand_syntax_ext(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg,
1616
}
1717

1818
ret @{id: cx.next_id(),
19-
node: ast::expr_path(@{node: {global: false, idents: [res],
20-
types: []},
21-
span: sp}),
19+
node: ast::expr_path(@{span: sp, global: false, idents: [res],
20+
types: []}),
2221
span: sp};
2322
}

branches/try/src/librustsyntax/ext/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ fn expand_expr(exts: hashmap<str, syntax_extension>, cx: ext_ctxt,
1919
expr_mac(mac) {
2020
alt mac.node {
2121
mac_invoc(pth, args, body) {
22-
assert (vec::len(pth.node.idents) > 0u);
23-
let extname = pth.node.idents[0];
22+
assert (vec::len(pth.idents) > 0u);
23+
let extname = pth.idents[0];
2424
alt exts.find(extname) {
2525
none {
2626
cx.span_fatal(pth.span,

branches/try/src/librustsyntax/ext/qquote.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ fn expand_ast(ecx: ext_ctxt, _sp: span,
142142
ecx.span_fatal(_sp, "#ast requires exactly one arg");
143143
}
144144
alt (args[0].node) {
145-
ast::expr_path(@{node: {idents: id, _},_}) if vec::len(id) == 1u
145+
ast::expr_path(@{idents: id, _}) if vec::len(id) == 1u
146146
{what = id[0]}
147147
_ {ecx.span_fatal(args[0].span, "expected an identifier");}
148148
}

branches/try/src/librustsyntax/ext/simplext.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import base::*;
55

66
import fold::*;
77
import ast_util::respan;
8-
import ast::{ident, path, ty, blk_, expr, path_, expr_path,
8+
import ast::{ident, path, ty, blk_, expr, expr_path,
99
expr_vec, expr_mac, mac_invoc, node_id};
1010

1111
export add_new_extension;
1212

1313
fn path_to_ident(pth: @path) -> option<ident> {
14-
if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u {
15-
ret some(pth.node.idents[0u]);
14+
if vec::len(pth.idents) == 1u && vec::len(pth.types) == 0u {
15+
ret some(pth.idents[0u]);
1616
}
1717
ret none;
1818
}
@@ -190,7 +190,7 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
190190
let afp = default_ast_fold();
191191
let f_pre =
192192
{fold_ident: bind transcribe_ident(cx, b, idx_path, _, _),
193-
fold_path: bind transcribe_path(cx, b, idx_path, _, _, _),
193+
fold_path: bind transcribe_path(cx, b, idx_path, _, _),
194194
fold_expr:
195195
bind transcribe_expr(cx, b, idx_path, _, _, _, afp.fold_expr),
196196
fold_ty: bind transcribe_type(cx, b, idx_path, _, _, _, afp.fold_ty),
@@ -329,17 +329,17 @@ fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
329329

330330

331331
fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
332-
p: path_, s:span, _fld: ast_fold) -> (path_, span) {
332+
p: path, _fld: ast_fold) -> path {
333333
// Don't substitute into qualified names.
334-
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret (p, s); }
335-
ret alt follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
336-
some(match_ident(id)) {
337-
({global: false, idents: [id.node], types: []}, id.span)
338-
}
339-
some(match_path(a_pth)) { (a_pth.node, a_pth.span) }
340-
some(m) { match_error(cx, m, "a path") }
341-
none { (p, s) }
342-
}
334+
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret p; }
335+
alt follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
336+
some(match_ident(id)) {
337+
{span: id.span, global: false, idents: [id.node], types: []}
338+
}
339+
some(match_path(a_pth)) { *a_pth }
340+
some(m) { match_error(cx, m, "a path") }
341+
none { p }
342+
}
343343
}
344344

345345

@@ -351,15 +351,15 @@ fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mut [uint],
351351
ret alt e {
352352
expr_path(p) {
353353
// Don't substitute into qualified names.
354-
if vec::len(p.node.types) > 0u || vec::len(p.node.idents) != 1u {
354+
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
355355
(e, s);
356356
}
357-
alt follow_for_trans(cx, b.find(p.node.idents[0]), idx_path) {
357+
alt follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
358358
some(match_ident(id)) {
359-
(expr_path(@respan(id.span,
360-
{global: false,
361-
idents: [id.node],
362-
types: []})), id.span)
359+
(expr_path(@{span: id.span,
360+
global: false,
361+
idents: [id.node],
362+
types: []}), id.span)
363363
}
364364
some(match_path(a_pth)) { (expr_path(a_pth), s) }
365365
some(match_expr(a_exp)) { (a_exp.node, a_exp.span) }

branches/try/src/librustsyntax/fold.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type ast_fold_precursor =
4646
fold_native_mod: fn@(native_mod, ast_fold) -> native_mod,
4747
fold_variant: fn@(variant_, span, ast_fold) -> (variant_, span),
4848
fold_ident: fn@(&&ident, ast_fold) -> ident,
49-
fold_path: fn@(path_, span, ast_fold) -> (path_, span),
49+
fold_path: fn@(path, ast_fold) -> path,
5050
fold_local: fn@(local_, span, ast_fold) -> (local_, span),
5151
map_exprs: fn@(fn@(&&@expr) -> @expr, [@expr]) -> [@expr],
5252
new_id: fn@(node_id) -> node_id,
@@ -559,8 +559,8 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ {
559559

560560
fn noop_fold_ident(&&i: ident, _fld: ast_fold) -> ident { ret i; }
561561

562-
fn noop_fold_path(&&p: path_, fld: ast_fold) -> path_ {
563-
ret {global: p.global,
562+
fn noop_fold_path(&&p: path, fld: ast_fold) -> path {
563+
ret {span: fld.new_span(p.span), global: p.global,
564564
idents: vec::map(p.idents, fld.fold_ident),
565565
types: vec::map(p.types, fld.fold_ty)};
566566
}
@@ -613,7 +613,7 @@ fn default_ast_fold() -> @ast_fold_precursor {
613613
fold_native_mod: noop_fold_native_mod,
614614
fold_variant: wrap(noop_fold_variant),
615615
fold_ident: noop_fold_ident,
616-
fold_path: wrap(noop_fold_path),
616+
fold_path: noop_fold_path,
617617
fold_local: wrap(noop_fold_local),
618618
map_exprs: noop_map_exprs,
619619
new_id: noop_id,
@@ -754,8 +754,7 @@ fn make_fold(afp: ast_fold_precursor) -> ast_fold {
754754
ret afp.fold_ident(x, f);
755755
}
756756
fn f_path(afp: ast_fold_precursor, f: ast_fold, &&x: @path) -> @path {
757-
let (n, s) = afp.fold_path(x.node, x.span, f);
758-
ret @{node: n, span: afp.new_span(s)};
757+
@afp.fold_path(*x, f)
759758
}
760759
fn f_local(afp: ast_fold_precursor, f: ast_fold, &&x: @local) -> @local {
761760
let (n, s) = afp.fold_local(x.node, x.span, f);

0 commit comments

Comments
 (0)