Skip to content

Commit 2d23ad8

Browse files
committed
---
yaml --- r: 133117 b: refs/heads/dist-snap c: ddc8cc9 h: refs/heads/master i: 133115: d00b9ea v: v3
1 parent 22aed93 commit 2d23ad8

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
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 149032aff393de695c068c4cd907d99ec75a3f7a
9+
refs/heads/dist-snap: ddc8cc92c998b7d80c782d00d178c791ab564915
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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)