rustc: Eliminate some indirection to the syntax crate

This commit is contained in:
Brian Anderson 2012-05-13 17:12:56 -07:00
parent a2572fe77e
commit 1f52652a06
22 changed files with 49 additions and 77 deletions

View File

@ -22,6 +22,7 @@
use core(vers = "0.2");
use std(vers = "0.2");
use rustc(vers = "0.2");
use syntax(name = "rustsyntax", vers = "0.2");
import core::*;

View File

@ -1,10 +1,10 @@
// cargo.rs - Rust package manager
import rustc::syntax::{ast, codemap};
import rustc::syntax::parse;
import syntax::{ast, codemap};
import syntax::parse;
import rustc::util::filesearch::{get_cargo_root, get_cargo_root_nearest,
get_cargo_sysroot, libdir};
import rustc::driver::diagnostic;
import syntax::diagnostic;
import result::{ok, err};
import io::writer_util;

View File

@ -6,7 +6,7 @@
use core(vers = "0.2");
use std(vers = "0.2");
use rustc(vers = "0.2");
use syntax(name = "rustsyntax", vers = "0.2");
import core::*;

View File

@ -1,9 +1,9 @@
import io::writer_util;
import rustc::syntax::{ast, ast_util, fold, visit, codemap};
import rustc::syntax::parse;
import rustc::syntax::print::pprust;
import rustc::driver::diagnostic;
import syntax::{ast, ast_util, fold, visit, codemap};
import syntax::parse;
import syntax::print::pprust;
import syntax::diagnostic;
enum test_mode { tm_converge, tm_run, }
type context = { mode: test_mode }; // + rng

View File

@ -1,4 +1,4 @@
import rustsyntax::diagnostic;
import syntax::diagnostic;
export diagnostic;
export driver;

View File

@ -3,6 +3,7 @@
use core(vers = "0.2");
use std(vers = "0.2");
use rustc(vers = "0.2");
use syntax(name = "rustsyntax", vers = "0.2");
import core::*;
@ -12,7 +13,7 @@ import std::getopts;
import std::map::hashmap;
import getopts::{opt_present};
import rustc::driver::driver::*;
import rustc::syntax::codemap;
import syntax::codemap;
import rustc::driver::diagnostic;
import rustc::middle::lint;
import io::reader_util;

View File

@ -45,7 +45,7 @@ mod back {
mod driver {
import session = driver_::session;
export session;
import diagnostic = rustsyntax::diagnostic;
import diagnostic = syntax::diagnostic;
export diagnostic;
}

View File

@ -103,7 +103,7 @@ fn decode_inlined_item(cdata: cstore::crate_metadata,
alt ii {
ast::ii_item(i) {
#debug(">>> DECODED ITEM >>>\n%s\n<<< DECODED ITEM <<<",
rustsyntax::print::pprust::item_to_str(i));
syntax::print::pprust::item_to_str(i));
}
_ { }
}

View File

@ -13,7 +13,7 @@
use core(vers = "0.2");
use std(vers = "0.2");
use rustsyntax(vers = "0.2");
use syntax(name = "rustsyntax", vers = "0.2");
import core::*;
@ -82,8 +82,6 @@ mod middle {
}
}
mod syntax;
mod front {
mod config;
mod test;

View File

@ -1,33 +0,0 @@
// Temporary wrapper modules for migrating syntax to its own crate
import rustsyntax::codemap;
export codemap;
import rustsyntax::ast;
export ast;
import rustsyntax::ast_util;
export ast_util;
import rustsyntax::visit;
export visit;
import rustsyntax::fold;
export fold;
import rustsyntax::print;
export print;
import rustsyntax::parse;
export parse;
import rustsyntax::util;
export util;
import rustsyntax::attr;
export attr;
import rustsyntax::ext;
export ext;
import rustsyntax::diagnostic;
export diagnostic;

View File

@ -10,10 +10,10 @@
import std::map::hashmap;
import rustc::driver::session;
import rustc::driver::driver;
import rustc::driver::diagnostic;
import rustc::driver::diagnostic::handler;
import rustc::syntax::ast;
import rustc::syntax::codemap;
import syntax::diagnostic;
import syntax::diagnostic::handler;
import syntax::ast;
import syntax::codemap;
import rustc::middle::ast_map;
import rustc::back::link;
import rustc::util::filesearch;

View File

@ -5,8 +5,8 @@
an AST's attributes."
)];
import rustc::syntax::ast;
import rustc::syntax::attr;
import syntax::ast;
import syntax::attr;
import core::tuple;
export crate_attrs;
@ -21,10 +21,10 @@ type crate_attrs = {
mod test {
fn parse_attributes(source: str) -> [ast::attribute] {
import rustc::syntax::parse;
import rustc::syntax::parse::parser;
import rustc::syntax::codemap;
import rustc::driver::diagnostic;
import syntax::parse;
import parse::parser;
import syntax::codemap;
import syntax::diagnostic;
let cm = codemap::new_codemap();
let handler = diagnostic::mk_handler(none);

View File

@ -6,7 +6,7 @@
of the natural-language documentation for a crate."
)];
import rustc::syntax::ast;
import syntax::ast;
import rustc::middle::ast_map;
import std::map::hashmap;

View File

@ -1,6 +1,6 @@
#[doc = "Converts the Rust AST to the rustdoc document model"];
import rustc::syntax::ast;
import syntax::ast;
export from_srv, extract;

View File

@ -180,7 +180,7 @@ fn write_header_(ctxt: ctxt, lvl: hlvl, title: str) {
fn header_kind(doc: doc::itemtag) -> str {
alt doc {
doc::modtag(_) {
if doc.id() == rustc::syntax::ast::crate_node_id {
if doc.id() == syntax::ast::crate_node_id {
"Crate"
} else {
"Module"
@ -216,7 +216,7 @@ fn header_kind(doc: doc::itemtag) -> str {
fn header_name(doc: doc::itemtag) -> str {
let fullpath = str::connect(doc.path() + [doc.name()], "::");
alt doc {
doc::modtag(_) if doc.id() != rustc::syntax::ast::crate_node_id {
doc::modtag(_) if doc.id() != syntax::ast::crate_node_id {
fullpath
}
doc::nmodtag(_) {

View File

@ -7,6 +7,8 @@ modules, pages for the crate, indexes, etc.
"];
import syntax::ast;
export mk_pass;
fn mk_pass(output_style: config::output_style) -> pass {
@ -92,7 +94,7 @@ fn fold_mod(
let doc = fold::default_any_fold_mod(fold, doc);
if doc.id() != rustc::syntax::ast::crate_node_id {
if doc.id() != ast::crate_node_id {
let doc = strip_mod(doc);
let page = doc::itempage(doc::modtag(doc));

View File

@ -3,10 +3,10 @@
import rustc::driver::driver;
import driver::{file_input, str_input};
import rustc::driver::session;
import rustc::driver::diagnostic;
import rustc::syntax::ast;
import rustc::syntax::codemap;
import rustc::syntax::parse;
import syntax::diagnostic;
import syntax::ast;
import syntax::codemap;
import syntax::parse;
export from_file, from_str, from_file_sess, from_str_sess;

View File

@ -1,5 +1,7 @@
#[doc = "Records the full path to items"];
import syntax::ast;
export mk_pass;
fn mk_pass() -> pass {
@ -36,7 +38,7 @@ fn fold_item(fold: fold::fold<ctxt>, doc: doc::itemdoc) -> doc::itemdoc {
}
fn fold_mod(fold: fold::fold<ctxt>, doc: doc::moddoc) -> doc::moddoc {
let is_topmod = doc.id() == rustc::syntax::ast::crate_node_id;
let is_topmod = doc.id() == ast::crate_node_id;
if !is_topmod { vec::push(fold.ctxt.path, doc.name()); }
let doc = fold::default_any_fold_mod(fold, doc);

View File

@ -1,7 +1,7 @@
#[doc = "Prunes branches of the tree that are not exported"];
import rustc::syntax::ast;
import rustc::syntax::ast_util;
import syntax::ast;
import syntax::ast_util;
import rustc::middle::ast_map;
import std::map::hashmap;

View File

@ -3,12 +3,12 @@
import std::map;
import std::map::hashmap;
import std::list;
import rustc::syntax::ast;
import rustc::syntax::ast_util;
import syntax::ast;
import syntax::ast_util;
import rustc::util::common;
import rustc::middle::ast_map;
import rustc::syntax::visit;
import rustc::syntax::codemap;
import syntax::visit;
import syntax::codemap;
import rustc::middle::resolve;
export mk_pass;
@ -316,7 +316,7 @@ fn merge_reexports(
fn fold_mod(fold: fold::fold<path_map>, doc: doc::moddoc) -> doc::moddoc {
let doc = fold::default_seq_fold_mod(fold, doc);
let is_topmod = doc.id() == rustc::syntax::ast::crate_node_id;
let is_topmod = doc.id() == ast::crate_node_id;
// In the case of the top mod, it really doesn't have a name;
// the name we have here is actually the crate name

View File

@ -14,6 +14,7 @@
use core(vers = "0.2");
use std(vers = "0.2");
use rustc(vers = "0.2");
use syntax(name = "rustsyntax", vers = "0.2");
import core::*;

View File

@ -1,8 +1,8 @@
#[doc =
"Pulls type information out of the AST and attaches it to the document"];
import rustc::syntax::ast;
import rustc::syntax::print::pprust;
import syntax::ast;
import syntax::print::pprust;
import rustc::middle::ast_map;
import std::map::hashmap;