Rename JsonDumper to Dumper

The Dumper no longer has anything to do specifically with JSON, it
merely represents processing into an `Analysis` output.
This commit is contained in:
Mark Rousskov 2019-07-25 12:26:28 -04:00
parent eb4fbda1f2
commit 68c0ba284d
3 changed files with 15 additions and 15 deletions

View file

@ -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};
@ -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;
@ -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>,
@ -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 {

View file

@ -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),
}
@ -27,7 +27,7 @@ impl JsonDumper {
}
}
impl JsonDumper {
impl Dumper {
pub fn crate_prelude(&mut self, data: CratePreludeData) {
self.result.prelude = Some(data)
}

View file

@ -7,7 +7,7 @@
#![recursion_limit="256"]
mod json_dumper;
mod dumper;
mod dump_visitor;
#[macro_use]
mod span_utils;
@ -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;
@ -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);
@ -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);