Skip to content

Commit 103e290

Browse files
committed
---
yaml --- r: 129819 b: refs/heads/auto c: ddc8cc9 h: refs/heads/master i: 129817: ff5dd84 129815: a629cb8 v: v3
1 parent 9eaf9ec commit 103e290

File tree

2 files changed

+22
-32
lines changed

2 files changed

+22
-32
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: 149032aff393de695c068c4cd907d99ec75a3f7a
16+
refs/heads/auto: ddc8cc92c998b7d80c782d00d178c791ab564915
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/driver/pretty.rs

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,33 @@ pub fn parse_pretty(sess: &Session, name: &str) -> (PpMode, Option<UserIdentifie
8787
// (The `use_once_payload` is working around the current lack of once
8888
// functions in the compiler.)
8989

90-
trait CratePrinter {
90+
impl PpSourceMode {
9191
/// Constructs a `PrinterSupport` object and passes it to `f`.
9292
fn call_with_pp_support<A,B>(&self,
9393
sess: Session,
9494
krate: &ast::Crate,
9595
ast_map: Option<ast_map::Map>,
9696
id: String,
97-
use_once_payload: B,
98-
f: |&PrinterSupport, B| -> A) -> A;
97+
payload: B,
98+
f: |&PrinterSupport, B| -> A) -> A {
99+
match *self {
100+
PpmNormal | PpmExpanded => {
101+
let annotation = NoAnn { sess: sess, ast_map: ast_map };
102+
f(&annotation, payload)
103+
}
104+
105+
PpmIdentified | PpmExpandedIdentified => {
106+
let annotation = IdentifiedAnnotation { sess: sess, ast_map: ast_map };
107+
f(&annotation, payload)
108+
}
109+
PpmTyped => {
110+
let ast_map = ast_map.expect("--pretty=typed missing ast_map");
111+
let analysis = driver::phase_3_run_analysis_passes(sess, krate, ast_map, id);
112+
let annotation = TypedAnnotation { analysis: analysis };
113+
f(&annotation, payload)
114+
}
115+
}
116+
}
99117
}
100118

101119
trait SessionCarrier {
@@ -339,34 +357,6 @@ impl UserIdentifiedItem {
339357
}
340358
}
341359

342-
impl CratePrinter for PpSourceMode {
343-
fn call_with_pp_support<A,B>(&self,
344-
sess: Session,
345-
krate: &ast::Crate,
346-
ast_map: Option<ast_map::Map>,
347-
id: String,
348-
payload: B,
349-
f: |&PrinterSupport, B| -> A) -> A {
350-
match *self {
351-
PpmNormal | PpmExpanded => {
352-
let annotation = NoAnn { sess: sess, ast_map: ast_map };
353-
f(&annotation, payload)
354-
}
355-
356-
PpmIdentified | PpmExpandedIdentified => {
357-
let annotation = IdentifiedAnnotation { sess: sess, ast_map: ast_map };
358-
f(&annotation, payload)
359-
}
360-
PpmTyped => {
361-
let ast_map = ast_map.expect("--pretty=typed missing ast_map");
362-
let analysis = driver::phase_3_run_analysis_passes(sess, krate, ast_map, id);
363-
let annotation = TypedAnnotation { analysis: analysis };
364-
f(&annotation, payload)
365-
}
366-
}
367-
}
368-
}
369-
370360
fn needs_ast_map(ppm: &PpMode, opt_uii: &Option<UserIdentifiedItem>) -> bool {
371361
match *ppm {
372362
PpmSource(PpmNormal) |

0 commit comments

Comments
 (0)