Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsyntax: Renamed types, traits and enum variants to CamelCase. #11417

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ use extra::hex::ToHex;
use extra::tempfile::TempDir;
use syntax::abi;
use syntax::ast;
use syntax::ast_map::{path, path_mod, path_name, path_pretty_name};
use syntax::ast_map::{PathMod, PathName, PathPrettyName};
use syntax::ast_map;
use syntax::attr;
use syntax::attr::AttrMetaMethods;
use syntax::crateid::CrateId;
Expand Down Expand Up @@ -583,7 +584,7 @@ pub fn sanitize(s: &str) -> ~str {
return result;
}

pub fn mangle(sess: Session, ss: path,
pub fn mangle(sess: Session, ss: ast_map::Path,
hash: Option<&str>, vers: Option<&str>) -> ~str {
// Follow C++ namespace-mangling style, see
// http://en.wikipedia.org/wiki/Name_mangling for more info.
Expand All @@ -609,7 +610,7 @@ pub fn mangle(sess: Session, ss: path,
// First, connect each component with <len, name> pairs.
for s in ss.iter() {
match *s {
path_name(s) | path_mod(s) | path_pretty_name(s, _) => {
PathName(s) | PathMod(s) | PathPrettyName(s, _) => {
push(sess.str_of(s))
}
}
Expand All @@ -625,7 +626,7 @@ pub fn mangle(sess: Session, ss: path,
let mut hash = match hash { Some(s) => s.to_owned(), None => ~"" };
for s in ss.iter() {
match *s {
path_pretty_name(_, extra) => {
PathPrettyName(_, extra) => {
let hi = (extra >> 32) as u32 as uint;
let lo = extra as u32 as uint;
hash.push_char(EXTRA_CHARS[hi % EXTRA_CHARS.len()] as char);
Expand All @@ -647,7 +648,7 @@ pub fn mangle(sess: Session, ss: path,
}

pub fn exported_name(sess: Session,
path: path,
path: ast_map::Path,
hash: &str,
vers: &str) -> ~str {
// The version will get mangled to have a leading '_', but it makes more
Expand All @@ -662,7 +663,7 @@ pub fn exported_name(sess: Session,
}

pub fn mangle_exported_name(ccx: &CrateContext,
path: path,
path: ast_map::Path,
t: ty::t) -> ~str {
let hash = get_symbol_hash(ccx, t);
return exported_name(ccx.sess, path,
Expand All @@ -676,8 +677,8 @@ pub fn mangle_internal_name_by_type_only(ccx: &CrateContext,
let s = ppaux::ty_to_short_str(ccx.tcx, t);
let hash = get_symbol_hash(ccx, t);
return mangle(ccx.sess,
~[path_name(ccx.sess.ident_of(name)),
path_name(ccx.sess.ident_of(s))],
~[PathName(ccx.sess.ident_of(name)),
PathName(ccx.sess.ident_of(s))],
Some(hash.as_slice()),
None);
}
Expand All @@ -689,20 +690,21 @@ pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext,
let hash = get_symbol_hash(ccx, t);
let (_, name) = gensym_name(name);
return mangle(ccx.sess,
~[path_name(ccx.sess.ident_of(s)), name],
~[PathName(ccx.sess.ident_of(s)), name],
Some(hash.as_slice()),
None);
}

pub fn mangle_internal_name_by_path_and_seq(ccx: &CrateContext,
mut path: path,
mut path: ast_map::Path,
flav: &str) -> ~str {
let (_, name) = gensym_name(flav);
path.push(name);
mangle(ccx.sess, path, None, None)
}

pub fn mangle_internal_name_by_path(ccx: &CrateContext, path: path) -> ~str {
pub fn mangle_internal_name_by_path(ccx: &CrateContext,
path: ast_map::Path) -> ~str {
mangle(ccx.sess, path, None, None)
}

Expand Down
46 changes: 23 additions & 23 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub fn phase_1_parse_input(sess: Session, cfg: ast::CrateConfig, input: &input)
pub fn phase_2_configure_and_expand(sess: Session,
cfg: ast::CrateConfig,
mut crate: ast::Crate)
-> (ast::Crate, syntax::ast_map::map) {
-> (ast::Crate, syntax::ast_map::Map) {
let time_passes = sess.time_passes();

sess.building_library.set(session::building_library(sess.opts, &crate));
Expand Down Expand Up @@ -220,7 +220,7 @@ pub struct CrateAnalysis {
/// structures carrying the results of the analysis.
pub fn phase_3_run_analysis_passes(sess: Session,
crate: &ast::Crate,
ast_map: syntax::ast_map::map) -> CrateAnalysis {
ast_map: syntax::ast_map::Map) -> CrateAnalysis {

let time_passes = sess.time_passes();

Expand Down Expand Up @@ -515,29 +515,29 @@ struct IdentifiedAnnotation {
contents: (),
}

impl pprust::pp_ann for IdentifiedAnnotation {
fn pre(&self, node: pprust::ann_node) {
impl pprust::PpAnn for IdentifiedAnnotation {
fn pre(&self, node: pprust::AnnNode) {
match node {
pprust::node_expr(s, _) => pprust::popen(s),
pprust::NodeExpr(s, _) => pprust::popen(s),
_ => ()
}
}
fn post(&self, node: pprust::ann_node) {
fn post(&self, node: pprust::AnnNode) {
match node {
pprust::node_item(s, item) => {
pprust::NodeItem(s, item) => {
pp::space(&mut s.s);
pprust::synth_comment(s, item.id.to_str());
}
pprust::node_block(s, blk) => {
pprust::NodeBlock(s, blk) => {
pp::space(&mut s.s);
pprust::synth_comment(s, ~"block " + blk.id.to_str());
}
pprust::node_expr(s, expr) => {
pprust::NodeExpr(s, expr) => {
pp::space(&mut s.s);
pprust::synth_comment(s, expr.id.to_str());
pprust::pclose(s);
}
pprust::node_pat(s, pat) => {
pprust::NodePat(s, pat) => {
pp::space(&mut s.s);
pprust::synth_comment(s, ~"pat " + pat.id.to_str());
}
Expand All @@ -549,17 +549,17 @@ struct TypedAnnotation {
analysis: CrateAnalysis,
}

impl pprust::pp_ann for TypedAnnotation {
fn pre(&self, node: pprust::ann_node) {
impl pprust::PpAnn for TypedAnnotation {
fn pre(&self, node: pprust::AnnNode) {
match node {
pprust::node_expr(s, _) => pprust::popen(s),
pprust::NodeExpr(s, _) => pprust::popen(s),
_ => ()
}
}
fn post(&self, node: pprust::ann_node) {
fn post(&self, node: pprust::AnnNode) {
let tcx = self.analysis.ty_cx;
match node {
pprust::node_expr(s, expr) => {
pprust::NodeExpr(s, expr) => {
pp::space(&mut s.s);
pp::word(&mut s.s, "as");
pp::space(&mut s.s);
Expand Down Expand Up @@ -589,16 +589,16 @@ pub fn pretty_print_input(sess: Session,
PpmIdentified | PpmExpandedIdentified => {
@IdentifiedAnnotation {
contents: (),
} as @pprust::pp_ann
} as @pprust::PpAnn
}
PpmTyped => {
let ast_map = ast_map.expect("--pretty=typed missing ast_map");
let analysis = phase_3_run_analysis_passes(sess, &crate, ast_map);
@TypedAnnotation {
analysis: analysis
} as @pprust::pp_ann
} as @pprust::PpAnn
}
_ => @pprust::no_ann::new() as @pprust::pp_ann,
_ => @pprust::NoAnn as @pprust::PpAnn,
};

let src = sess.codemap.get_filemap(source_name(input)).src;
Expand Down Expand Up @@ -662,10 +662,10 @@ pub fn build_target_config(sopts: @session::options,
"unknown architecture: " + sopts.target_triple)
};
let (int_type, uint_type) = match arch {
abi::X86 => (ast::ty_i32, ast::ty_u32),
abi::X86_64 => (ast::ty_i64, ast::ty_u64),
abi::Arm => (ast::ty_i32, ast::ty_u32),
abi::Mips => (ast::ty_i32, ast::ty_u32)
abi::X86 => (ast::TyI32, ast::TyU32),
abi::X86_64 => (ast::TyI64, ast::TyU64),
abi::Arm => (ast::TyI32, ast::TyU32),
abi::Mips => (ast::TyI32, ast::TyU32)
};
let target_triple = sopts.target_triple.clone();
let target_strs = match arch {
Expand Down Expand Up @@ -1116,7 +1116,7 @@ pub fn build_output_filenames(input: &input,
}

pub fn early_error(emitter: &diagnostic::Emitter, msg: &str) -> ! {
emitter.emit(None, msg, diagnostic::fatal);
emitter.emit(None, msg, diagnostic::Fatal);
fail!();
}

Expand Down
8 changes: 4 additions & 4 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use middle::lint;

use syntax::attr::AttrMetaMethods;
use syntax::ast::NodeId;
use syntax::ast::{int_ty, uint_ty};
use syntax::ast::{IntTy, UintTy};
use syntax::codemap::Span;
use syntax::diagnostic;
use syntax::parse::ParseSess;
Expand All @@ -35,8 +35,8 @@ pub struct config {
os: abi::Os,
arch: abi::Architecture,
target_strs: target_strs::t,
int_type: int_ty,
uint_type: uint_ty,
int_type: IntTy,
uint_type: UintTy,
}

pub static verbose: uint = 1 << 0;
Expand Down Expand Up @@ -368,7 +368,7 @@ impl Session_ {
}

// pointless function, now...
pub fn intr(&self) -> @syntax::parse::token::ident_interner {
pub fn intr(&self) -> @syntax::parse::token::IdentInterner {
token::get_ident_interner()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/front/assign_node_ids_and_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ impl ast_map::FoldOps for NodeIdAssigner {
}
}

pub fn assign_node_ids_and_map(sess: Session, crate: ast::Crate) -> (ast::Crate, ast_map::map) {
pub fn assign_node_ids_and_map(sess: Session, crate: ast::Crate) -> (ast::Crate, ast_map::Map) {
ast_map::map_crate(sess.diagnostic(), crate, NodeIdAssigner { sess: sess })
}
Loading