Skip to content

Commit 379cfee

Browse files
author
tim
committed
---
yaml --- r: 7668 b: refs/heads/master c: dfae487 h: refs/heads/master v: v3
1 parent 1cff132 commit 379cfee

File tree

20 files changed

+157
-247
lines changed

20 files changed

+157
-247
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 04351a84ca342f4580e40b9c195b5403b864090b
2+
refs/heads/master: dfae48736ffd3504598b15e0f350269a8d1b1063

trunk/src/cargo/cargo.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type package = {
3434
uuid: str,
3535
url: str,
3636
method: str,
37+
description: str,
3738
ref: option::t<str>,
3839
tags: [str]
3940
};
@@ -105,9 +106,7 @@ fn load_pkg(filename: str) -> option::t<pkg> {
105106
let sess = @{
106107
cm: cm,
107108
mutable next_id: 1,
108-
diagnostic: diagnostic::mk_handler(cm, none),
109-
mutable chpos: 0u,
110-
mutable byte_pos: 0u
109+
diagnostic: diagnostic::mk_handler(cm, none)
111110
};
112111
let c = parser::parse_crate_from_crate_file(filename, [], sess);
113112

@@ -271,12 +270,15 @@ fn load_one_source_package(&src: source, p: map::hashmap<str, json::json>) {
271270
}
272271
_ { }
273272
}
273+
// TODO: make this *actually* get the description from the .rc file.
274+
let description = "This package's description.";
274275
vec::grow(src.packages, 1u, {
275276
// source: _source(src),
276277
name: name,
277278
uuid: uuid,
278279
url: url,
279280
method: method,
281+
description: description,
280282
ref: ref,
281283
tags: tags
282284
});
@@ -683,6 +685,9 @@ fn print_pkg(s: source, p: package) {
683685
m = m + " [" + str::connect(p.tags, ", ") + "]";
684686
}
685687
info(m);
688+
if p.description != "" {
689+
print(" >> " + p.description)
690+
}
686691
}
687692
fn cmd_list(c: cargo, argv: [str]) {
688693
for_each_package(c, { |s, p|

trunk/src/comp/driver/driver.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,7 @@ fn build_session(sopts: @session::options, input: str,
488488
parse_sess: @{
489489
cm: codemap,
490490
mutable next_id: 1,
491-
diagnostic: diagnostic_handler,
492-
mutable chpos: 0u,
493-
mutable byte_pos: 0u
491+
diagnostic: diagnostic_handler
494492
},
495493
codemap: codemap,
496494
// For a library crate, this is always none

trunk/src/comp/front/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn strip_items(crate: @ast::crate, in_cfg: in_cfg_pred)
2727

2828
let precursor =
2929
{fold_mod: bind fold_mod(ctxt, _, _),
30-
fold_block: fold::wrap(bind fold_block(ctxt, _, _)),
30+
fold_block: bind fold_block(ctxt, _, _),
3131
fold_native_mod: bind fold_native_mod(ctxt, _, _)
3232
with *fold::default_ast_fold()};
3333

trunk/src/comp/front/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn generate_test_harness(sess: session::session,
4444
mutable testfns: []};
4545

4646
let precursor =
47-
{fold_crate: fold::wrap(bind fold_crate(cx, _, _)),
47+
{fold_crate: bind fold_crate(cx, _, _),
4848
fold_item: bind fold_item(cx, _, _),
4949
fold_mod: bind fold_mod(cx, _, _) with *fold::default_ast_fold()};
5050

trunk/src/comp/syntax/codemap.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,17 @@ type lookup_fn = fn@(file_pos) -> uint;
3434

3535
fn lookup_pos(map: codemap, pos: uint, lookup: lookup_fn) -> loc {
3636
let len = vec::len(map.files);
37+
if len > 1u && map.files[len - 1u].name == "-" {
38+
// the trailing "-" must be the core_macros inserted by expand_crate,
39+
// exclude it from the targets to lookup
40+
len = len - 1u;
41+
}
3742
let a = 0u;
3843
let b = len;
3944
while b - a > 1u {
4045
let m = (a + b) / 2u;
4146
if lookup(map.files[m].start_pos) > pos { b = m; } else { a = m; }
4247
}
43-
if (a >= len) {
44-
ret { filename: "-", line: 0u, col: 0u };
45-
}
4648
let f = map.files[a];
4749
a = 0u;
4850
b = vec::len(f.lines);

trunk/src/comp/syntax/ext/expand.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@ import syntax::fold::*;
1010
import syntax::ext::base::*;
1111
import syntax::parse::parser::parse_expr_from_source_str;
1212

13-
import codemap::span;
14-
15-
fn expand_expr(exts: hashmap<str, syntax_extension>, cx: ext_ctxt,
16-
e: expr_, s: span, fld: ast_fold,
17-
orig: fn@(expr_, span, ast_fold) -> (expr_, span))
18-
-> (expr_, span)
19-
{
13+
fn expand_expr(exts: hashmap<str, syntax_extension>, cx: ext_ctxt, e: expr_,
14+
fld: ast_fold, orig: fn@(expr_, ast_fold) -> expr_) -> expr_ {
2015
ret alt e {
2116
expr_mac(mac) {
2217
alt mac.node {
@@ -36,19 +31,19 @@ fn expand_expr(exts: hashmap<str, syntax_extension>, cx: ext_ctxt,
3631
let fully_expanded = fld.fold_expr(expanded).node;
3732
cx.bt_pop();
3833

39-
(fully_expanded, s)
34+
fully_expanded
4035
}
4136
some(macro_defining(ext)) {
4237
let named_extension = ext(cx, pth.span, args, body);
4338
exts.insert(named_extension.ident, named_extension.ext);
44-
(ast::expr_rec([], none), s)
39+
ast::expr_rec([], none)
4540
}
4641
}
4742
}
4843
_ { cx.span_bug(mac.span, "naked syntactic bit") }
4944
}
5045
}
51-
_ { orig(e, s, fld) }
46+
_ { orig(e, fld) }
5247
};
5348
}
5449

@@ -72,10 +67,10 @@ fn expand_crate(sess: session::session, c: @crate) -> @crate {
7267
let afp = default_ast_fold();
7368
let cx: ext_ctxt = mk_ctxt(sess);
7469
let f_pre =
75-
{fold_expr: bind expand_expr(exts, cx, _, _, _, afp.fold_expr)
70+
{fold_expr: bind expand_expr(exts, cx, _, _, afp.fold_expr)
7671
with *afp};
7772
let f = make_fold(f_pre);
78-
let cm = parse_expr_from_source_str("<anon>", core_macros(),
73+
let cm = parse_expr_from_source_str("-", core_macros(),
7974
sess.opts.cfg,
8075
sess.parse_sess);
8176

trunk/src/comp/syntax/ext/simplext.rs

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
194194
let afp = default_ast_fold();
195195
let f_pre =
196196
{fold_ident: bind transcribe_ident(cx, b, idx_path, _, _),
197-
fold_path: bind transcribe_path(cx, b, idx_path, _, _, _),
197+
fold_path: bind transcribe_path(cx, b, idx_path, _, _),
198198
fold_expr:
199-
bind transcribe_expr(cx, b, idx_path, _, _, _, afp.fold_expr),
200-
fold_ty: bind transcribe_type(cx, b, idx_path, _, _, _, afp.fold_ty),
199+
bind transcribe_expr(cx, b, idx_path, _, _, afp.fold_expr),
200+
fold_ty: bind transcribe_type(cx, b, idx_path, _, _, afp.fold_ty),
201201
fold_block:
202-
bind transcribe_block(cx, b, idx_path, _, _, _, afp.fold_block),
202+
bind transcribe_block(cx, b, idx_path, _, _, afp.fold_block),
203203
map_exprs: bind transcribe_exprs(cx, b, idx_path, _, _),
204204
new_id: bind new_id(_, cx),
205205
new_span: bind new_span(cx, _) with *afp};
@@ -209,6 +209,7 @@ fn transcribe(cx: ext_ctxt, b: bindings, body: @expr) -> @expr {
209209
}
210210

211211

212+
212213
/* helper: descend into a matcher */
213214
fn follow(m: arb_depth<matchable>, idx_path: @mutable [uint]) ->
214215
arb_depth<matchable> {
@@ -333,67 +334,64 @@ fn transcribe_ident(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
333334

334335

335336
fn transcribe_path(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
336-
p: path_, s:span, _fld: ast_fold) -> (path_, span) {
337+
p: path_, _fld: ast_fold) -> path_ {
337338
// Don't substitute into qualified names.
338-
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret (p, s); }
339+
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u { ret p; }
339340
ret alt follow_for_trans(cx, b.find(p.idents[0]), idx_path) {
340341
some(match_ident(id)) {
341-
({global: false, idents: [id.node], types: []}, id.span)
342+
{global: false, idents: [id.node], types: []}
342343
}
343-
some(match_path(a_pth)) { (a_pth.node, a_pth.span) }
344+
some(match_path(a_pth)) { a_pth.node }
344345
some(m) { match_error(cx, m, "a path") }
345-
none { (p, s) }
346+
none { p }
346347
}
347348
}
348349

349350

350351
fn transcribe_expr(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
351-
e: ast::expr_, s: span, fld: ast_fold,
352-
orig: fn@(ast::expr_, span, ast_fold)->(ast::expr_, span))
353-
-> (ast::expr_, span)
354-
{
352+
e: ast::expr_, fld: ast_fold,
353+
orig: fn@(ast::expr_, ast_fold) -> ast::expr_) ->
354+
ast::expr_ {
355355
ret alt e {
356356
expr_path(p) {
357357
// Don't substitute into qualified names.
358358
if vec::len(p.node.types) > 0u || vec::len(p.node.idents) != 1u {
359-
(e, s);
359+
e;
360360
}
361361
alt follow_for_trans(cx, b.find(p.node.idents[0]), idx_path) {
362362
some(match_ident(id)) {
363-
(expr_path(@respan(id.span,
364-
{global: false,
365-
idents: [id.node],
366-
types: []})), id.span)
363+
expr_path(@respan(id.span,
364+
{global: false,
365+
idents: [id.node],
366+
types: []}))
367367
}
368-
some(match_path(a_pth)) { (expr_path(a_pth), s) }
369-
some(match_expr(a_exp)) { (a_exp.node, a_exp.span) }
368+
some(match_path(a_pth)) { expr_path(a_pth) }
369+
some(match_expr(a_exp)) { a_exp.node }
370370
some(m) { match_error(cx, m, "an expression") }
371-
none { orig(e, s, fld) }
371+
none { orig(e, fld) }
372372
}
373373
}
374-
_ { orig(e, s, fld) }
374+
_ { orig(e, fld) }
375375
}
376376
}
377377

378378
fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
379-
t: ast::ty_, s: span, fld: ast_fold,
380-
orig: fn@(ast::ty_, span, ast_fold) -> (ast::ty_, span))
381-
-> (ast::ty_, span)
382-
{
379+
t: ast::ty_, fld: ast_fold,
380+
orig: fn@(ast::ty_, ast_fold) -> ast::ty_) -> ast::ty_ {
383381
ret alt t {
384382
ast::ty_path(pth, _) {
385383
alt path_to_ident(pth) {
386384
some(id) {
387385
alt follow_for_trans(cx, b.find(id), idx_path) {
388-
some(match_ty(ty)) { (ty.node, ty.span) }
386+
some(match_ty(ty)) { ty.node }
389387
some(m) { match_error(cx, m, "a type") }
390-
none { orig(t, s, fld) }
388+
none { orig(t, fld) }
391389
}
392390
}
393-
none { orig(t, s, fld) }
391+
none { orig(t, fld) }
394392
}
395393
}
396-
_ { orig(t, s, fld) }
394+
_ { orig(t, fld) }
397395
}
398396
}
399397

@@ -402,14 +400,12 @@ fn transcribe_type(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
402400
`{v}` */
403401

404402
fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
405-
blk: blk_, s: span, fld: ast_fold,
406-
orig: fn@(blk_, span, ast_fold) -> (blk_, span))
407-
-> (blk_, span)
408-
{
403+
blk: blk_, fld: ast_fold,
404+
orig: fn@(blk_, ast_fold) -> blk_) -> blk_ {
409405
ret alt block_to_ident(blk) {
410406
some(id) {
411407
alt follow_for_trans(cx, b.find(id), idx_path) {
412-
some(match_block(new_blk)) { (new_blk.node, new_blk.span) }
408+
some(match_block(new_blk)) { new_blk.node }
413409

414410

415411

@@ -419,10 +415,10 @@ fn transcribe_block(cx: ext_ctxt, b: bindings, idx_path: @mutable [uint],
419415
some(m) {
420416
match_error(cx, m, "a block")
421417
}
422-
none { orig(blk, s, fld) }
418+
none { orig(blk, fld) }
423419
}
424420
}
425-
none { orig(blk, s, fld) }
421+
none { orig(blk, fld) }
426422
}
427423
}
428424

0 commit comments

Comments
 (0)