Skip to content

Commit

Permalink
Rename JsonDumper to Dumper
Browse files Browse the repository at this point in the history
The Dumper no longer has anything to do specifically with JSON, it
merely represents processing into an `Analysis` output.
  • Loading branch information
Mark-Simulacrum committed Jul 25, 2019
1 parent eb4fbda commit 68c0ba2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//!
//! SpanUtils is used to manipulate spans. In particular, to extract sub-spans
//! from spans (e.g., the span for `bar` from the above example path).
//! DumpVisitor walks the AST and processes it, and JsonDumper is used for
//! DumpVisitor walks the AST and processes it, and Dumper is used for
//! recording the output.

use rustc::hir::def::{Res, DefKind as HirDefKind};
Expand Down Expand Up @@ -38,7 +38,7 @@ use syntax_pos::*;

use crate::{escape, generated_code, id_from_def_id, id_from_node_id, lower_attributes,
PathCollector, SaveContext};
use crate::json_dumper::{Access, JsonDumper};
use crate::dumper::{Access, Dumper};
use crate::span_utils::SpanUtils;
use crate::sig;

Expand Down Expand Up @@ -78,7 +78,7 @@ macro_rules! access_from_vis {
pub struct DumpVisitor<'l, 'tcx, 'll> {
save_ctxt: SaveContext<'l, 'tcx>,
tcx: TyCtxt<'tcx>,
dumper: &'ll mut JsonDumper,
dumper: &'ll mut Dumper,

span: SpanUtils<'l>,

Expand All @@ -95,7 +95,7 @@ pub struct DumpVisitor<'l, 'tcx, 'll> {
impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
pub fn new(
save_ctxt: SaveContext<'l, 'tcx>,
dumper: &'ll mut JsonDumper,
dumper: &'ll mut Dumper,
) -> DumpVisitor<'l, 'tcx, 'll> {
let span_utils = SpanUtils::new(&save_ctxt.tcx.sess);
DumpVisitor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ pub struct Access {
pub public: bool,
}

pub struct JsonDumper {
pub struct Dumper {
result: Analysis,
config: Config,
}

impl JsonDumper {
pub fn new(config: Config) -> JsonDumper {
JsonDumper {
impl Dumper {
pub fn new(config: Config) -> Dumper {
Dumper {
config: config.clone(),
result: Analysis::new(config),
}
Expand All @@ -27,7 +27,7 @@ impl JsonDumper {
}
}

impl JsonDumper {
impl Dumper {
pub fn crate_prelude(&mut self, data: CratePreludeData) {
self.result.prelude = Some(data)
}
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_save_analysis/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![recursion_limit="256"]


mod json_dumper;
mod dumper;
mod dump_visitor;
#[macro_use]
mod span_utils;
Expand Down Expand Up @@ -39,7 +39,7 @@ use syntax::visit::{self, Visitor};
use syntax::print::pprust::{arg_to_string, ty_to_string};
use syntax_pos::*;

use json_dumper::JsonDumper;
use dumper::Dumper;
use dump_visitor::DumpVisitor;
use span_utils::SpanUtils;

Expand Down Expand Up @@ -1076,7 +1076,7 @@ impl<'a> SaveHandler for DumpHandler<'a> {
) {
let sess = &save_ctxt.tcx.sess;
let (output, file_name) = self.output_file(&save_ctxt);
let mut dumper = JsonDumper::new(save_ctxt.config.clone());
let mut dumper = Dumper::new(save_ctxt.config.clone());
let mut visitor = DumpVisitor::new(save_ctxt, &mut dumper);

visitor.dump_crate_info(cratename, krate);
Expand Down Expand Up @@ -1109,12 +1109,12 @@ impl<'b> SaveHandler for CallbackHandler<'b> {
cratename: &str,
input: &'l Input,
) {
// We're using the JsonDumper here because it has the format of the
// We're using the Dumper here because it has the format of the
// save-analysis results that we will pass to the callback. IOW, we are
// using the JsonDumper to collect the save-analysis results, but not
// using the Dumper to collect the save-analysis results, but not
// actually to dump them to a file. This is all a bit convoluted and
// there is certainly a simpler design here trying to get out (FIXME).
let mut dumper = JsonDumper::new(save_ctxt.config.clone());
let mut dumper = Dumper::new(save_ctxt.config.clone());
let mut visitor = DumpVisitor::new(save_ctxt, &mut dumper);

visitor.dump_crate_info(cratename, krate);
Expand Down

0 comments on commit 68c0ba2

Please sign in to comment.