Skip to content

Commit 52e72ac

Browse files
committed
---
yaml --- r: 129983 b: refs/heads/snap-stage3 c: ddc8cc9 h: refs/heads/master i: 129981: 779e8fd 129979: a1eeb3a 129975: c761021 129967: d6c9e81 129951: 003af3f 129919: 632c83d v: v3
1 parent 99c2e42 commit 52e72ac

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0bdac78da87605f6f7f6e7924872617226b19c85
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 149032aff393de695c068c4cd907d99ec75a3f7a
4+
refs/heads/snap-stage3: ddc8cc92c998b7d80c782d00d178c791ab564915
55
refs/heads/try: 28d5878c1f0465c11c8e7a3085008b0c592d48d0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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