Skip to content

Commit fb958fd

Browse files
committed
---
yaml --- r: 79227 b: refs/heads/auto c: 6c6d053 h: refs/heads/master i: 79225: 3b9af1e 79223: e031419 v: v3
1 parent 0abc2bb commit fb958fd

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 2f6498f7b4be2584d1164d68fc4d5ae485da2ea6
16+
refs/heads/auto: 6c6d053b0177ed91071128aa5a2f57539e746987
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libsyntax/ext/expand.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,10 +1452,6 @@ mod test {
14521452
pprust::print_mod(s, &crate.module, crate.attrs);
14531453
}
14541454
1455-
// "fn a() -> int { let b = 13; let c = b; b+c }" --> b & c should get new names, in the expr too.
1456-
// "macro_rules! f (($x:ident) => ($x + b)) fn a() -> int { let b = 13; f!(b)}" --> one should
1457-
// be renamed, one should not.
1458-
14591455
fn expand_and_resolve_and_pretty_print (crate_str : @str) -> ~str {
14601456
let resolver = new_ident_resolver();
14611457
let resolver_fold = fun_to_ident_folder(resolver);
@@ -1469,10 +1465,20 @@ mod test {
14691465

14701466
#[test]
14711467
fn automatic_renaming () {
1468+
// "fn a() -> int { let b = 13; let c = b; b+c }"
1469+
// --> b & c should get new names, in the expr too.
1470+
// "macro_rules! f (($x:ident) => ($x + b)) fn a() -> int { let b = 13; f!(b)}"
1471+
// --> one should be renamed, one should not.
1472+
14721473
let teststrs =
1473-
~[@"fn a() -> int { let b = 13; let c = b; b+c }",
1474-
@"macro_rules! f (($x:ident) => ($x + b)) fn a() -> int { let b = 13; f!(b)}"];
1474+
~[// b & c should get new names throughout, in the expr too:
1475+
@"fn a() -> int { let b = 13; let c = b; b+c }",
1476+
// the use of b before the + should be renamed, the other one not:
1477+
@"macro_rules! f (($x:ident) => ($x + b)) fn a() -> int { let b = 13; f!(b)}",
1478+
// the b before the plus should not be renamed (requires marks)
1479+
@"macro_rules! f (($x:ident) => ({let b=9; ($x + b)})) fn a() -> int { f!(b)}"];
14751480
for s in teststrs.iter() {
1481+
// we need regexps to test these!
14761482
std::io::println(expand_and_resolve_and_pretty_print(*s));
14771483
}
14781484
}

0 commit comments

Comments
 (0)