Modernized a few type names in rustc and syntax

This commit is contained in:
Marvin Löbel 2013-08-31 18:13:04 +02:00
parent 617850131b
commit 539f37925c
115 changed files with 1316 additions and 1311 deletions

View File

@ -13,14 +13,14 @@ use driver::session::sess_os_to_meta_os;
use driver::session;
use metadata::loader::meta_section_name;
pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t {
return target_strs::t {
module_asm: ~"",
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(),
data_layout: match target_os {
session::os_macos => {
session::OsMacos => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
@ -28,7 +28,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st
"-a0:0:64-n32"
}
session::os_win32 => {
session::OsWin32 => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
@ -36,7 +36,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st
"-a0:0:64-n32"
}
session::os_linux => {
session::OsLinux => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
@ -44,7 +44,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st
"-a0:0:64-n32"
}
session::os_android => {
session::OsAndroid => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
@ -52,7 +52,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st
"-a0:0:64-n32"
}
session::os_freebsd => {
session::OsFreebsd => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +

View File

@ -814,13 +814,13 @@ pub fn mangle_internal_name_by_seq(_ccx: &mut CrateContext, flav: &str) -> ~str
}
pub fn output_dll_filename(os: session::os, lm: LinkMeta) -> ~str {
pub fn output_dll_filename(os: session::Os, lm: LinkMeta) -> ~str {
let (dll_prefix, dll_suffix) = match os {
session::os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
session::os_macos => (macos::DLL_PREFIX, macos::DLL_SUFFIX),
session::os_linux => (linux::DLL_PREFIX, linux::DLL_SUFFIX),
session::os_android => (android::DLL_PREFIX, android::DLL_SUFFIX),
session::os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
session::OsWin32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
session::OsMacos => (macos::DLL_PREFIX, macos::DLL_SUFFIX),
session::OsLinux => (linux::DLL_PREFIX, linux::DLL_SUFFIX),
session::OsAndroid => (android::DLL_PREFIX, android::DLL_SUFFIX),
session::OsFreebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
};
fmt!("%s%s-%s-%s%s", dll_prefix, lm.name, lm.extras_hash, lm.vers, dll_suffix)
}
@ -835,7 +835,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
match sess.opts.linker {
Some(ref linker) => linker.to_str(),
None => match sess.targ_cfg.os {
session::os_android =>
session::OsAndroid =>
match &sess.opts.android_cross_path {
&Some(ref path) => {
fmt!("%s/bin/arm-linux-androideabi-gcc", *path)
@ -845,7 +845,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
(--android-cross-path)")
}
},
session::os_win32 => ~"g++",
session::OsWin32 => ~"g++",
_ => ~"cc"
}
}
@ -892,7 +892,7 @@ pub fn link_binary(sess: Session,
}
// Clean up on Darwin
if sess.targ_cfg.os == session::os_macos {
if sess.targ_cfg.os == session::OsMacos {
run::process_status("dsymutil", [output.to_str()]);
}
@ -913,7 +913,7 @@ pub fn link_args(sess: Session,
// Converts a library file-stem into a cc -l argument
fn unlib(config: @session::config, stem: ~str) -> ~str {
if stem.starts_with("lib") &&
config.os != session::os_win32 {
config.os != session::OsWin32 {
stem.slice(3, stem.len()).to_owned()
} else {
stem
@ -939,7 +939,7 @@ pub fn link_args(sess: Session,
obj_filename.to_str()]);
let lib_cmd = match sess.targ_cfg.os {
session::os_macos => ~"-dynamiclib",
session::OsMacos => ~"-dynamiclib",
_ => ~"-shared"
};
@ -995,7 +995,7 @@ pub fn link_args(sess: Session,
// On mac we need to tell the linker to let this library
// be rpathed
if sess.targ_cfg.os == session::os_macos {
if sess.targ_cfg.os == session::OsMacos {
args.push(~"-Wl,-install_name,@rpath/"
+ output.filename().unwrap());
}
@ -1003,7 +1003,7 @@ pub fn link_args(sess: Session,
// On linux librt and libdl are an indirect dependencies via rustrt,
// and binutils 2.22+ won't add them automatically
if sess.targ_cfg.os == session::os_linux {
if sess.targ_cfg.os == session::OsLinux {
args.push_all([~"-lrt", ~"-ldl"]);
// LLVM implements the `frem` instruction as a call to `fmod`,
@ -1011,12 +1011,12 @@ pub fn link_args(sess: Session,
// have to be explicit about linking to it. See #2510
args.push(~"-lm");
}
else if sess.targ_cfg.os == session::os_android {
else if sess.targ_cfg.os == session::OsAndroid {
args.push_all([~"-ldl", ~"-llog", ~"-lsupc++", ~"-lgnustl_shared"]);
args.push(~"-lm");
}
if sess.targ_cfg.os == session::os_freebsd {
if sess.targ_cfg.os == session::OsFreebsd {
args.push_all([~"-pthread", ~"-lrt",
~"-L/usr/local/lib", ~"-lexecinfo",
~"-L/usr/local/lib/gcc46",
@ -1030,7 +1030,7 @@ pub fn link_args(sess: Session,
// linker from the dwarf unwind info. Unfortunately, it does not seem to
// understand how to unwind our __morestack frame, so we have to turn it
// off. This has impacted some other projects like GHC.
if sess.targ_cfg.os == session::os_macos {
if sess.targ_cfg.os == session::OsMacos {
args.push(~"-Wl,-no_compact_unwind");
}

View File

@ -13,14 +13,14 @@ use driver::session;
use driver::session::sess_os_to_meta_os;
use metadata::loader::meta_section_name;
pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t {
return target_strs::t {
module_asm: ~"",
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(),
data_layout: match target_os {
session::os_macos => {
session::OsMacos => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
@ -28,7 +28,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st
"-a0:0:64-n32"
}
session::os_win32 => {
session::OsWin32 => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
@ -36,7 +36,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st
"-a0:0:64-n32"
}
session::os_linux => {
session::OsLinux => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
@ -44,7 +44,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st
"-a0:0:64-n32"
}
session::os_android => {
session::OsAndroid => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +
@ -52,7 +52,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st
"-a0:0:64-n32"
}
session::os_freebsd => {
session::OsFreebsd => {
~"e-p:32:32:32" +
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
"-f32:32:32-f64:64:64" +

View File

@ -16,8 +16,8 @@ use metadata::filesearch;
use std::hashmap::HashSet;
use std::{os, util, vec};
fn not_win32(os: session::os) -> bool {
os != session::os_win32
fn not_win32(os: session::Os) -> bool {
os != session::OsWin32
}
pub fn get_rpath_flags(sess: session::Session, out_filename: &Path)
@ -25,7 +25,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path)
let os = sess.targ_cfg.os;
// No rpath on windows
if os == session::os_win32 {
if os == session::OsWin32 {
return ~[];
}
@ -52,7 +52,7 @@ pub fn rpaths_to_flags(rpaths: &[Path]) -> ~[~str] {
rpaths.iter().map(|rpath| fmt!("-Wl,-rpath,%s",rpath.to_str())).collect()
}
fn get_rpaths(os: session::os,
fn get_rpaths(os: session::Os,
sysroot: &Path,
output: &Path,
libs: &[Path],
@ -97,13 +97,13 @@ fn get_rpaths(os: session::os,
return rpaths;
}
fn get_rpaths_relative_to_output(os: session::os,
fn get_rpaths_relative_to_output(os: session::Os,
output: &Path,
libs: &[Path]) -> ~[Path] {
libs.iter().map(|a| get_rpath_relative_to_output(os, output, a)).collect()
}
pub fn get_rpath_relative_to_output(os: session::os,
pub fn get_rpath_relative_to_output(os: session::Os,
output: &Path,
lib: &Path)
-> Path {
@ -113,10 +113,10 @@ pub fn get_rpath_relative_to_output(os: session::os,
// Mac doesn't appear to support $ORIGIN
let prefix = match os {
session::os_android | session::os_linux | session::os_freebsd
session::OsAndroid | session::OsLinux | session::OsFreebsd
=> "$ORIGIN",
session::os_macos => "@executable_path",
session::os_win32 => util::unreachable()
session::OsMacos => "@executable_path",
session::OsWin32 => util::unreachable()
};
Path(prefix).push_rel(&os::make_absolute(output).get_relative_to(&os::make_absolute(lib)))
@ -205,7 +205,7 @@ mod test {
#[cfg(target_os = "linux")]
#[cfg(target_os = "android")]
fn test_rpath_relative() {
let o = session::os_linux;
let o = session::OsLinux;
let res = get_rpath_relative_to_output(o,
&Path("bin/rustc"), &Path("lib/libstd.so"));
assert_eq!(res.to_str(), ~"$ORIGIN/../lib");
@ -214,7 +214,7 @@ mod test {
#[test]
#[cfg(target_os = "freebsd")]
fn test_rpath_relative() {
let o = session::os_freebsd;
let o = session::OsFreebsd;
let res = get_rpath_relative_to_output(o,
&Path("bin/rustc"), &Path("lib/libstd.so"));
assert_eq!(res.to_str(), ~"$ORIGIN/../lib");
@ -223,7 +223,7 @@ mod test {
#[test]
#[cfg(target_os = "macos")]
fn test_rpath_relative() {
let o = session::os_macos;
let o = session::OsMacos;
let res = get_rpath_relative_to_output(o,
&Path("bin/rustc"),
&Path("lib/libstd.so"));

View File

@ -14,32 +14,32 @@ use driver::session::sess_os_to_meta_os;
use driver::session;
use metadata::loader::meta_section_name;
pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t {
return target_strs::t {
module_asm: ~"",
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(),
data_layout: match target_os {
session::os_macos => {
session::OsMacos => {
~"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" +
"-i32:32:32-i64:32:64" +
"-f32:32:32-f64:32:64-v64:64:64" +
"-v128:128:128-a0:0:64-f80:128:128" + "-n8:16:32"
}
session::os_win32 => {
session::OsWin32 => {
~"e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32"
}
session::os_linux => {
session::OsLinux => {
~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
}
session::os_android => {
session::OsAndroid => {
~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
}
session::os_freebsd => {
session::OsFreebsd => {
~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
}
},

View File

@ -14,38 +14,38 @@ use driver::session::sess_os_to_meta_os;
use driver::session;
use metadata::loader::meta_section_name;
pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t {
pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t {
return target_strs::t {
module_asm: ~"",
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),
meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(),
data_layout: match target_os {
session::os_macos => {
session::OsMacos => {
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64"
}
session::os_win32 => {
session::OsWin32 => {
// FIXME: Test this. Copied from linux (#2398)
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64-S128"
}
session::os_linux => {
session::OsLinux => {
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64-S128"
}
session::os_android => {
session::OsAndroid => {
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64-S128"
}
session::os_freebsd => {
session::OsFreebsd => {
~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
"s0:64:64-f80:128:128-n8:16:32:64-S128"

View File

@ -43,12 +43,12 @@ use syntax::parse::token;
use syntax::print::{pp, pprust};
use syntax;
pub enum pp_mode {
ppm_normal,
ppm_expanded,
ppm_typed,
ppm_identified,
ppm_expanded_identified
pub enum PpMode {
PpmNormal,
PpmExpanded,
PpmTyped,
PpmIdentified,
PpmExpandedIdentified
}
/**
@ -67,11 +67,11 @@ pub fn source_name(input: &input) -> @str {
pub fn default_configuration(sess: Session) ->
ast::CrateConfig {
let tos = match sess.targ_cfg.os {
session::os_win32 => @"win32",
session::os_macos => @"macos",
session::os_linux => @"linux",
session::os_android => @"android",
session::os_freebsd => @"freebsd"
session::OsWin32 => @"win32",
session::OsMacos => @"macos",
session::OsLinux => @"linux",
session::OsAndroid => @"android",
session::OsFreebsd => @"freebsd"
};
// ARM is bi-endian, however using NDK seems to default
@ -338,8 +338,8 @@ pub fn phase_5_run_llvm_passes(sess: Session,
// output are OK, so we generate assembly first and then run it through
// an external assembler.
// Same for Android.
if (sess.targ_cfg.os == session::os_android ||
sess.targ_cfg.os == session::os_win32) &&
if (sess.targ_cfg.os == session::OsAndroid ||
sess.targ_cfg.os == session::OsWin32) &&
(sess.opts.output_type == link::output_type_object ||
sess.opts.output_type == link::output_type_exe) {
let output_type = link::output_type_assembly;
@ -439,7 +439,7 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
}
pub fn pretty_print_input(sess: Session, cfg: ast::CrateConfig, input: &input,
ppm: pp_mode) {
ppm: PpMode) {
fn ann_paren_for_expr(node: pprust::ann_node) {
match node {
@ -485,20 +485,20 @@ pub fn pretty_print_input(sess: Session, cfg: ast::CrateConfig, input: &input,
let crate = phase_1_parse_input(sess, cfg.clone(), input);
let (crate, is_expanded) = match ppm {
ppm_expanded | ppm_expanded_identified | ppm_typed => {
PpmExpanded | PpmExpandedIdentified | PpmTyped => {
(phase_2_configure_and_expand(sess, cfg, crate), true)
}
_ => (crate, false)
};
let annotation = match ppm {
ppm_identified | ppm_expanded_identified => {
PpmIdentified | PpmExpandedIdentified => {
pprust::pp_ann {
pre: ann_paren_for_expr,
post: ann_identified_post
}
}
ppm_typed => {
PpmTyped => {
let analysis = phase_3_run_analysis_passes(sess, crate);
pprust::pp_ann {
pre: ann_paren_for_expr,
@ -518,19 +518,19 @@ pub fn pretty_print_input(sess: Session, cfg: ast::CrateConfig, input: &input,
}
}
pub fn get_os(triple: &str) -> Option<session::os> {
pub fn get_os(triple: &str) -> Option<session::Os> {
for &(name, os) in os_names.iter() {
if triple.contains(name) { return Some(os) }
}
None
}
static os_names : &'static [(&'static str, session::os)] = &'static [
("mingw32", session::os_win32),
("win32", session::os_win32),
("darwin", session::os_macos),
("android", session::os_android),
("linux", session::os_linux),
("freebsd", session::os_freebsd)];
static os_names : &'static [(&'static str, session::Os)] = &'static [
("mingw32", session::OsWin32),
("win32", session::OsWin32),
("darwin", session::OsMacos),
("android", session::OsAndroid),
("linux", session::OsLinux),
("freebsd", session::OsFreebsd)];
pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
for &(arch, abi) in architecture_abis.iter() {
@ -817,13 +817,13 @@ pub fn build_session_(sopts: @session::options,
}
}
pub fn parse_pretty(sess: Session, name: &str) -> pp_mode {
pub fn parse_pretty(sess: Session, name: &str) -> PpMode {
match name {
&"normal" => ppm_normal,
&"expanded" => ppm_expanded,
&"typed" => ppm_typed,
&"expanded,identified" => ppm_expanded_identified,
&"identified" => ppm_identified,
&"normal" => PpmNormal,
&"expanded" => PpmExpanded,
&"typed" => PpmTyped,
&"expanded,identified" => PpmExpandedIdentified,
&"identified" => PpmIdentified,
_ => {
sess.fatal("argument to `pretty` must be one of `normal`, \
`expanded`, `typed`, `identified`, \

View File

@ -20,7 +20,7 @@ use middle::lint;
use syntax::ast::NodeId;
use syntax::ast::{int_ty, uint_ty, float_ty};
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::diagnostic;
use syntax::parse::ParseSess;
use syntax::{ast, codemap};
@ -31,7 +31,7 @@ use syntax;
use std::hashmap::HashMap;
#[deriving(Eq)]
pub enum os { os_win32, os_macos, os_linux, os_android, os_freebsd, }
pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, }
#[deriving(Clone)]
pub enum crate_type {
@ -41,7 +41,7 @@ pub enum crate_type {
}
pub struct config {
os: os,
os: Os,
arch: abi::Architecture,
target_strs: target_strs::t,
int_type: int_ty,
@ -209,25 +209,25 @@ pub struct Session_ {
parse_sess: @mut ParseSess,
codemap: @codemap::CodeMap,
// For a library crate, this is always none
entry_fn: @mut Option<(NodeId, codemap::span)>,
entry_fn: @mut Option<(NodeId, codemap::Span)>,
entry_type: @mut Option<EntryFnType>,
span_diagnostic: @mut diagnostic::span_handler,
filesearch: @filesearch::FileSearch,
building_library: @mut bool,
working_dir: Path,
lints: @mut HashMap<ast::NodeId, ~[(lint::lint, codemap::span, ~str)]>,
lints: @mut HashMap<ast::NodeId, ~[(lint::lint, codemap::Span, ~str)]>,
}
pub type Session = @Session_;
impl Session_ {
pub fn span_fatal(@self, sp: span, msg: &str) -> ! {
pub fn span_fatal(@self, sp: Span, msg: &str) -> ! {
self.span_diagnostic.span_fatal(sp, msg)
}
pub fn fatal(@self, msg: &str) -> ! {
self.span_diagnostic.handler().fatal(msg)
}
pub fn span_err(@self, sp: span, msg: &str) {
pub fn span_err(@self, sp: Span, msg: &str) {
self.span_diagnostic.span_err(sp, msg)
}
pub fn err(@self, msg: &str) {
@ -242,25 +242,25 @@ impl Session_ {
pub fn abort_if_errors(@self) {
self.span_diagnostic.handler().abort_if_errors()
}
pub fn span_warn(@self, sp: span, msg: &str) {
pub fn span_warn(@self, sp: Span, msg: &str) {
self.span_diagnostic.span_warn(sp, msg)
}
pub fn warn(@self, msg: &str) {
self.span_diagnostic.handler().warn(msg)
}
pub fn span_note(@self, sp: span, msg: &str) {
pub fn span_note(@self, sp: Span, msg: &str) {
self.span_diagnostic.span_note(sp, msg)
}
pub fn note(@self, msg: &str) {
self.span_diagnostic.handler().note(msg)
}
pub fn span_bug(@self, sp: span, msg: &str) -> ! {
pub fn span_bug(@self, sp: Span, msg: &str) -> ! {
self.span_diagnostic.span_bug(sp, msg)
}
pub fn bug(@self, msg: &str) -> ! {
self.span_diagnostic.handler().bug(msg)
}
pub fn span_unimpl(@self, sp: span, msg: &str) -> ! {
pub fn span_unimpl(@self, sp: Span, msg: &str) -> ! {
self.span_diagnostic.span_unimpl(sp, msg)
}
pub fn unimpl(@self, msg: &str) -> ! {
@ -269,7 +269,7 @@ impl Session_ {
pub fn add_lint(@self,
lint: lint::lint,
id: ast::NodeId,
sp: span,
sp: Span,
msg: ~str) {
match self.lints.find_mut(&id) {
Some(arr) => { arr.push((lint, sp, msg)); return; }
@ -288,7 +288,7 @@ impl Session_ {
}
// This exists to help with refactoring to eliminate impossible
// cases later on
pub fn impossible_case(@self, sp: span, msg: &str) -> ! {
pub fn impossible_case(@self, sp: Span, msg: &str) -> ! {
self.span_bug(sp, fmt!("Impossible case reached: %s", msg));
}
pub fn verbose(@self) -> bool { self.debugging_opt(verbose) }
@ -411,15 +411,15 @@ pub fn building_library(req_crate_type: crate_type,
}
}
pub fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
pub fn sess_os_to_meta_os(os: Os) -> metadata::loader::Os {
use metadata::loader;
match os {
os_win32 => loader::os_win32,
os_linux => loader::os_linux,
os_android => loader::os_android,
os_macos => loader::os_macos,
os_freebsd => loader::os_freebsd
OsWin32 => loader::OsWin32,
OsLinux => loader::OsLinux,
OsAndroid => loader::OsAndroid,
OsMacos => loader::OsMacos,
OsFreebsd => loader::OsFreebsd
}
}

View File

@ -39,8 +39,8 @@ fn no_prelude(attrs: &[ast::Attribute]) -> bool {
}
fn inject_libstd_ref(sess: Session, crate: &ast::Crate) -> @ast::Crate {
fn spanned<T>(x: T) -> codemap::spanned<T> {
codemap::spanned { node: x, span: dummy_sp() }
fn spanned<T>(x: T) -> codemap::Spanned<T> {
codemap::Spanned { node: x, span: dummy_sp() }
}
let precursor = @fold::AstFoldFns {

View File

@ -18,7 +18,7 @@ use std::vec;
use syntax::ast_util::*;
use syntax::attr::AttrMetaMethods;
use syntax::attr;
use syntax::codemap::{dummy_sp, span, ExpnInfo, NameAndSpan};
use syntax::codemap::{dummy_sp, Span, ExpnInfo, NameAndSpan};
use syntax::codemap;
use syntax::ext::base::ExtCtxt;
use syntax::fold;
@ -29,7 +29,7 @@ use syntax::{ast, ast_util};
type node_id_gen = @fn() -> ast::NodeId;
struct Test {
span: span,
span: Span,
path: ~[ast::ident],
bench: bool,
ignore: bool,
@ -379,8 +379,8 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item {
return @item;
}
fn nospan<T>(t: T) -> codemap::spanned<T> {
codemap::spanned { node: t, span: dummy_sp() }
fn nospan<T>(t: T) -> codemap::Spanned<T> {
codemap::Spanned { node: t, span: dummy_sp() }
}
fn path_node(ids: ~[ast::ident]) -> ast::Path {

View File

@ -21,7 +21,7 @@ use syntax::ast;
use std::vec;
use syntax::attr;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::{span, dummy_sp};
use syntax::codemap::{Span, dummy_sp};
use syntax::diagnostic::span_handler;
use syntax::parse::token;
use syntax::parse::token::ident_interner;
@ -33,7 +33,7 @@ pub fn read_crates(diag: @mut span_handler,
crate: &ast::Crate,
cstore: @mut cstore::CStore,
filesearch: @FileSearch,
os: loader::os,
os: loader::Os,
statik: bool,
intr: @ident_interner) {
let e = @mut Env {
@ -68,7 +68,7 @@ impl visit::Visitor<()> for ReadCrateVisitor {
#[deriving(Clone)]
struct cache_entry {
cnum: int,
span: span,
span: Span,
hash: @str,
metas: @~[@ast::MetaItem]
}
@ -116,7 +116,7 @@ struct Env {
diag: @mut span_handler,
filesearch: @FileSearch,
cstore: @mut cstore::CStore,
os: loader::os,
os: loader::Os,
statik: bool,
crate_cache: @mut ~[cache_entry],
next_crate_num: ast::CrateNum,
@ -252,7 +252,7 @@ fn resolve_crate(e: @mut Env,
ident: @str,
metas: ~[@ast::MetaItem],
hash: @str,
span: span)
span: Span)
-> ast::CrateNum {
let metas = metas_with_ident(ident, metas);

View File

@ -52,7 +52,7 @@ pub fn each_lang_item(cstore: @mut cstore::CStore,
/// Iterates over each child of the given item.
pub fn each_child_of_item(cstore: @mut cstore::CStore,
def_id: ast::def_id,
callback: &fn(decoder::def_like, ast::ident)) {
callback: &fn(decoder::DefLike, ast::ident)) {
let crate_data = cstore::get_crate_data(cstore, def_id.crate);
let get_crate_data: decoder::GetCrateDataCb = |cnum| {
cstore::get_crate_data(cstore, cnum)
@ -67,7 +67,7 @@ pub fn each_child_of_item(cstore: @mut cstore::CStore,
/// Iterates over each top-level crate item.
pub fn each_top_level_item_of_crate(cstore: @mut cstore::CStore,
cnum: ast::CrateNum,
callback: &fn(decoder::def_like,
callback: &fn(decoder::DefLike,
ast::ident)) {
let crate_data = cstore::get_crate_data(cstore, cnum);
let get_crate_data: decoder::GetCrateDataCb = |cnum| {

View File

@ -43,7 +43,7 @@ use syntax::ast;
use syntax::codemap;
use syntax::parse::token;
type cmd = @crate_metadata;
type Cmd = @crate_metadata;
// A function that takes a def_id relative to the crate being searched and
// returns a def_id relative to the compilation environment, i.e. if we hit a
@ -74,7 +74,7 @@ fn lookup_hash(d: ebml::Doc, eq_fn: &fn(x:&[u8]) -> bool, hash: u64) ->
ret
}
pub type GetCrateDataCb<'self> = &'self fn(ast::CrateNum) -> cmd;
pub type GetCrateDataCb<'self> = &'self fn(ast::CrateNum) -> Cmd;
pub fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option<ebml::Doc> {
fn eq_item(bytes: &[u8], item_id: int) -> bool {
@ -192,12 +192,12 @@ fn item_reqd_and_translated_parent_item(cnum: ast::CrateNum,
ast::def_id { crate: cnum, node: trait_did.node }
}
fn item_def_id(d: ebml::Doc, cdata: cmd) -> ast::def_id {
fn item_def_id(d: ebml::Doc, cdata: Cmd) -> ast::def_id {
let tagdoc = reader::get_doc(d, tag_def_id);
return translate_def_id(cdata, reader::with_doc_data(tagdoc, parse_def_id));
}
fn get_provided_source(d: ebml::Doc, cdata: cmd) -> Option<ast::def_id> {
fn get_provided_source(d: ebml::Doc, cdata: Cmd) -> Option<ast::def_id> {
do reader::maybe_get_doc(d, tag_item_method_provided_source).map_move |doc| {
translate_def_id(cdata, reader::with_doc_data(doc, parse_def_id))
}
@ -213,13 +213,13 @@ fn variant_disr_val(d: ebml::Doc) -> Option<ty::Disr> {
}
}
fn doc_type(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::t {
fn doc_type(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::t {
let tp = reader::get_doc(doc, tag_items_data_item_type);
parse_ty_data(*tp.data, cdata.cnum, tp.start, tcx,
|_, did| translate_def_id(cdata, did))
}
fn doc_method_fty(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::BareFnTy {
fn doc_method_fty(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::BareFnTy {
let tp = reader::get_doc(doc, tag_item_method_fty);
parse_bare_fn_ty_data(*tp.data, cdata.cnum, tp.start, tcx,
|_, did| translate_def_id(cdata, did))
@ -227,7 +227,7 @@ fn doc_method_fty(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::BareFnTy {
fn doc_transformed_self_ty(doc: ebml::Doc,
tcx: ty::ctxt,
cdata: cmd) -> Option<ty::t>
cdata: Cmd) -> Option<ty::t>
{
do reader::maybe_get_doc(doc, tag_item_method_transformed_self_ty).map |tp| {
parse_ty_data(*tp.data, cdata.cnum, tp.start, tcx,
@ -236,21 +236,21 @@ fn doc_transformed_self_ty(doc: ebml::Doc,
}
pub fn item_type(_item_id: ast::def_id, item: ebml::Doc,
tcx: ty::ctxt, cdata: cmd) -> ty::t {
tcx: ty::ctxt, cdata: Cmd) -> ty::t {
doc_type(item, tcx, cdata)
}
fn doc_trait_ref(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::TraitRef {
fn doc_trait_ref(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::TraitRef {
parse_trait_ref_data(*doc.data, cdata.cnum, doc.start, tcx,
|_, did| translate_def_id(cdata, did))
}
fn item_trait_ref(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::TraitRef {
fn item_trait_ref(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::TraitRef {
let tp = reader::get_doc(doc, tag_item_trait_ref);
doc_trait_ref(tp, tcx, cdata)
}
fn item_ty_param_defs(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd,
fn item_ty_param_defs(item: ebml::Doc, tcx: ty::ctxt, cdata: Cmd,
tag: uint)
-> @~[ty::TypeParameterDef] {
let mut bounds = ~[];
@ -278,7 +278,7 @@ fn item_ty_param_count(item: ebml::Doc) -> uint {
n
}
fn enum_variant_ids(item: ebml::Doc, cdata: cmd) -> ~[ast::def_id] {
fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> ~[ast::def_id] {
let mut ids: ~[ast::def_id] = ~[];
let v = tag_items_data_item_variant;
do reader::tagged_docs(item, v) |p| {
@ -322,15 +322,15 @@ fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::ident {
}
fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::CrateNum)
-> def_like {
-> DefLike {
let fam = item_family(item);
match fam {
ImmStatic => dl_def(ast::def_static(did, false)),
MutStatic => dl_def(ast::def_static(did, true)),
Struct => dl_def(ast::def_struct(did)),
UnsafeFn => dl_def(ast::def_fn(did, ast::unsafe_fn)),
Fn => dl_def(ast::def_fn(did, ast::impure_fn)),
ForeignFn => dl_def(ast::def_fn(did, ast::extern_fn)),
ImmStatic => DlDef(ast::def_static(did, false)),
MutStatic => DlDef(ast::def_static(did, true)),
Struct => DlDef(ast::def_struct(did)),
UnsafeFn => DlDef(ast::def_fn(did, ast::unsafe_fn)),
Fn => DlDef(ast::def_fn(did, ast::impure_fn)),
ForeignFn => DlDef(ast::def_fn(did, ast::extern_fn)),
StaticMethod | UnsafeStaticMethod => {
let purity = if fam == UnsafeStaticMethod { ast::unsafe_fn } else
{ ast::impure_fn };
@ -347,19 +347,19 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::CrateNum)
ast::FromImpl(item_reqd_and_translated_parent_item(cnum,
item))
};
dl_def(ast::def_static_method(did, provenance, purity))
DlDef(ast::def_static_method(did, provenance, purity))
}
Type | ForeignType => dl_def(ast::def_ty(did)),
Mod => dl_def(ast::def_mod(did)),
ForeignMod => dl_def(ast::def_foreign_mod(did)),
Type | ForeignType => DlDef(ast::def_ty(did)),
Mod => DlDef(ast::def_mod(did)),
ForeignMod => DlDef(ast::def_foreign_mod(did)),
Variant => {
let enum_did = item_reqd_and_translated_parent_item(cnum, item);
dl_def(ast::def_variant(enum_did, did))
DlDef(ast::def_variant(enum_did, did))
}
Trait => dl_def(ast::def_trait(did)),
Enum => dl_def(ast::def_ty(did)),
Impl => dl_impl(did),
PublicField | PrivateField | InheritedField => dl_field,
Trait => DlDef(ast::def_trait(did)),
Enum => DlDef(ast::def_ty(did)),
Impl => DlImpl(did),
PublicField | PrivateField | InheritedField => DlField,
}
}
@ -371,7 +371,7 @@ pub fn lookup_def(cnum: ast::CrateNum, data: @~[u8], did_: ast::def_id) ->
return def_like_to_def(item_to_def_like(item, did, cnum));
}
pub fn get_trait_def(cdata: cmd,
pub fn get_trait_def(cdata: Cmd,
item_id: ast::NodeId,
tcx: ty::ctxt) -> ty::TraitDef
{
@ -398,7 +398,7 @@ pub fn get_trait_def(cdata: cmd,
}
}
pub fn get_type(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
pub fn get_type(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt)
-> ty::ty_param_bounds_and_ty {
let item = lookup_item(id, cdata.data);
@ -415,7 +415,7 @@ pub fn get_type(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
}
}
pub fn get_region_param(cdata: cmd, id: ast::NodeId)
pub fn get_region_param(cdata: Cmd, id: ast::NodeId)
-> Option<ty::region_variance> {
let item = lookup_item(id, cdata.data);
@ -426,7 +426,7 @@ pub fn get_type_param_count(data: @~[u8], id: ast::NodeId) -> uint {
item_ty_param_count(lookup_item(id, data))
}
pub fn get_impl_trait(cdata: cmd,
pub fn get_impl_trait(cdata: Cmd,
id: ast::NodeId,
tcx: ty::ctxt) -> Option<@ty::TraitRef>
{
@ -436,7 +436,7 @@ pub fn get_impl_trait(cdata: cmd,
}
}
pub fn get_impl_vtables(cdata: cmd,
pub fn get_impl_vtables(cdata: Cmd,
id: ast::NodeId,
tcx: ty::ctxt) -> typeck::impl_res
{
@ -451,7 +451,7 @@ pub fn get_impl_vtables(cdata: cmd,
}
pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
pub fn get_impl_method(intr: @ident_interner, cdata: Cmd, id: ast::NodeId,
name: ast::ident) -> Option<ast::def_id> {
let items = reader::get_doc(reader::Doc(cdata.data), tag_items);
let mut found = None;
@ -470,22 +470,22 @@ pub fn get_symbol(data: @~[u8], id: ast::NodeId) -> ~str {
}
// Something that a name can resolve to.
pub enum def_like {
dl_def(ast::def),
dl_impl(ast::def_id),
dl_field
pub enum DefLike {
DlDef(ast::def),
DlImpl(ast::def_id),
DlField
}
fn def_like_to_def(def_like: def_like) -> ast::def {
fn def_like_to_def(def_like: DefLike) -> ast::def {
match def_like {
dl_def(def) => return def,
dl_impl(*) => fail!("found impl in def_like_to_def"),
dl_field => fail!("found field in def_like_to_def")
DlDef(def) => return def,
DlImpl(*) => fail!("found impl in def_like_to_def"),
DlField => fail!("found field in def_like_to_def")
}
}
/// Iterates over the language items in the given crate.
pub fn each_lang_item(cdata: cmd, f: &fn(ast::NodeId, uint) -> bool) -> bool {
pub fn each_lang_item(cdata: Cmd, f: &fn(ast::NodeId, uint) -> bool) -> bool {
let root = reader::Doc(cdata.data);
let lang_items = reader::get_doc(root, tag_lang_items);
do reader::tagged_docs(lang_items, tag_lang_items_item) |item_doc| {
@ -501,10 +501,10 @@ pub fn each_lang_item(cdata: cmd, f: &fn(ast::NodeId, uint) -> bool) -> bool {
struct EachItemContext<'self> {
intr: @ident_interner,
cdata: cmd,
cdata: Cmd,
get_crate_data: GetCrateDataCb<'self>,
path_builder: &'self mut ~str,
callback: &'self fn(&str, def_like, ast::visibility) -> bool,
callback: &'self fn(&str, DefLike, ast::visibility) -> bool,
}
impl<'self> EachItemContext<'self> {
@ -533,7 +533,7 @@ impl<'self> EachItemContext<'self> {
-> bool {
let def_like = item_to_def_like(doc, def_id, self.cdata.cnum);
match def_like {
dl_def(def) => {
DlDef(def) => {
debug!("(iterating over each item of a module) processing \
`%s` (def %?)",
*self.path_builder,
@ -703,10 +703,10 @@ impl<'self> EachItemContext<'self> {
}
fn each_child_of_item_or_crate(intr: @ident_interner,
cdata: cmd,
cdata: Cmd,
item_doc: ebml::Doc,
get_crate_data: GetCrateDataCb,
callback: &fn(def_like, ast::ident)) {
callback: &fn(DefLike, ast::ident)) {
// Iterate over all children.
let _ = do reader::tagged_docs(item_doc, tag_mod_child) |child_info_doc| {
let child_def_id = reader::with_doc_data(child_info_doc,
@ -826,10 +826,10 @@ fn each_child_of_item_or_crate(intr: @ident_interner,
/// Iterates over each child of the given item.
pub fn each_child_of_item(intr: @ident_interner,
cdata: cmd,
cdata: Cmd,
id: ast::NodeId,
get_crate_data: GetCrateDataCb,
callback: &fn(def_like, ast::ident)) {
callback: &fn(DefLike, ast::ident)) {
// Find the item.
let root_doc = reader::Doc(cdata.data);
let items = reader::get_doc(root_doc, tag_items);
@ -847,9 +847,9 @@ pub fn each_child_of_item(intr: @ident_interner,
/// Iterates over all the top-level crate items.
pub fn each_top_level_item_of_crate(intr: @ident_interner,
cdata: cmd,
cdata: Cmd,
get_crate_data: GetCrateDataCb,
callback: &fn(def_like, ast::ident)) {
callback: &fn(DefLike, ast::ident)) {
let root_doc = reader::Doc(cdata.data);
let misc_info_doc = reader::get_doc(root_doc, tag_misc_info);
let crate_items_doc = reader::get_doc(misc_info_doc,
@ -862,7 +862,7 @@ pub fn each_top_level_item_of_crate(intr: @ident_interner,
callback)
}
pub fn get_item_path(cdata: cmd, id: ast::NodeId) -> ast_map::path {
pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> ast_map::path {
item_path(lookup_item(id, cdata.data))
}
@ -872,7 +872,7 @@ pub type decode_inlined_item<'self> = &'self fn(
path: ast_map::path,
par_doc: ebml::Doc) -> Option<ast::inlined_item>;
pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
pub fn maybe_get_item_ast(cdata: Cmd, tcx: ty::ctxt,
id: ast::NodeId,
decode_inlined_item: decode_inlined_item)
-> csearch::found_ast {
@ -900,7 +900,7 @@ pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt,
}
}
pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
pub fn get_enum_variants(intr: @ident_interner, cdata: Cmd, id: ast::NodeId,
tcx: ty::ctxt) -> ~[@ty::VariantInfo] {
let data = cdata.data;
let items = reader::get_doc(reader::Doc(data), tag_items);
@ -964,7 +964,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
}
}
fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc,
fn item_impl_methods(intr: @ident_interner, cdata: Cmd, item: ebml::Doc,
tcx: ty::ctxt) -> ~[@ty::Method] {
let mut rslt = ~[];
do reader::tagged_docs(item, tag_item_impl_method) |doc| {
@ -977,7 +977,7 @@ fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc,
}
/// Returns information about the given implementation.
pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::NodeId,
pub fn get_impl(intr: @ident_interner, cdata: Cmd, impl_id: ast::NodeId,
tcx: ty::ctxt)
-> ty::Impl {
let data = cdata.data;
@ -994,7 +994,7 @@ pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::NodeId,
pub fn get_method_name_and_explicit_self(
intr: @ident_interner,
cdata: cmd,
cdata: Cmd,
id: ast::NodeId) -> (ast::ident, ast::explicit_self_)
{
let method_doc = lookup_item(id, cdata.data);
@ -1003,7 +1003,7 @@ pub fn get_method_name_and_explicit_self(
(name, explicit_self)
}
pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
pub fn get_method(intr: @ident_interner, cdata: Cmd, id: ast::NodeId,
tcx: ty::ctxt) -> ty::Method
{
let method_doc = lookup_item(id, cdata.data);
@ -1042,7 +1042,7 @@ pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId,
)
}
pub fn get_trait_method_def_ids(cdata: cmd,
pub fn get_trait_method_def_ids(cdata: Cmd,
id: ast::NodeId) -> ~[ast::def_id] {
let data = cdata.data;
let item = lookup_item(id, data);
@ -1054,7 +1054,7 @@ pub fn get_trait_method_def_ids(cdata: cmd,
result
}
pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
pub fn get_provided_trait_methods(intr: @ident_interner, cdata: Cmd,
id: ast::NodeId, tcx: ty::ctxt) ->
~[@ty::Method] {
let data = cdata.data;
@ -1075,7 +1075,7 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
}
/// Returns the supertraits of the given trait.
pub fn get_supertraits(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
pub fn get_supertraits(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt)
-> ~[@ty::TraitRef] {
let mut results = ~[];
let item_doc = lookup_item(id, cdata.data);
@ -1092,7 +1092,7 @@ pub fn get_supertraits(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
return results;
}
pub fn get_type_name_if_impl(cdata: cmd,
pub fn get_type_name_if_impl(cdata: Cmd,
node_id: ast::NodeId) -> Option<ast::ident> {
let item = lookup_item(node_id, cdata.data);
if item_family(item) != Impl {
@ -1109,7 +1109,7 @@ pub fn get_type_name_if_impl(cdata: cmd,
}
pub fn get_static_methods_if_impl(intr: @ident_interner,
cdata: cmd,
cdata: Cmd,
node_id: ast::NodeId)
-> Option<~[StaticMethodInfo]> {
let item = lookup_item(node_id, cdata.data);
@ -1156,7 +1156,7 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
return Some(static_impl_methods);
}
pub fn get_item_attrs(cdata: cmd,
pub fn get_item_attrs(cdata: Cmd,
node_id: ast::NodeId,
f: &fn(~[@ast::MetaItem])) {
@ -1179,7 +1179,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::visibility {
}
}
pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::NodeId)
pub fn get_struct_fields(intr: @ident_interner, cdata: Cmd, id: ast::NodeId)
-> ~[ty::field_ty] {
let data = cdata.data;
let item = lookup_item(id, data);
@ -1209,7 +1209,7 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::NodeId)
result
}
pub fn get_item_visibility(cdata: cmd, id: ast::NodeId)
pub fn get_item_visibility(cdata: Cmd, id: ast::NodeId)
-> ast::visibility {
item_visibility(lookup_item(id, cdata.data))
}
@ -1308,7 +1308,7 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::Attribute] {
assert_eq!(meta_items.len(), 1u);
let meta_item = meta_items[0];
attrs.push(
codemap::spanned {
codemap::Spanned {
node: ast::Attribute_ {
style: ast::AttrOuter,
value: meta_item,
@ -1350,15 +1350,15 @@ pub fn get_crate_attributes(data: @~[u8]) -> ~[ast::Attribute] {
}
#[deriving(Clone)]
pub struct crate_dep {
pub struct CrateDep {
cnum: ast::CrateNum,
name: ast::ident,
vers: @str,
hash: @str
}
pub fn get_crate_deps(data: @~[u8]) -> ~[crate_dep] {
let mut deps: ~[crate_dep] = ~[];
pub fn get_crate_deps(data: @~[u8]) -> ~[CrateDep] {
let mut deps: ~[CrateDep] = ~[];
let cratedoc = reader::Doc(data);
let depsdoc = reader::get_doc(cratedoc, tag_crate_deps);
let mut crate_num = 1;
@ -1367,7 +1367,7 @@ pub fn get_crate_deps(data: @~[u8]) -> ~[crate_dep] {
d.as_str_slice().to_managed()
}
do reader::tagged_docs(depsdoc, tag_crate_dep) |depdoc| {
deps.push(crate_dep {cnum: crate_num,
deps.push(CrateDep {cnum: crate_num,
name: token::str_to_ident(docstr(depdoc, tag_crate_dep_name)),
vers: docstr(depdoc, tag_crate_dep_vers),
hash: docstr(depdoc, tag_crate_dep_hash)});
@ -1419,7 +1419,7 @@ pub fn list_crate_metadata(intr: @ident_interner, bytes: @~[u8],
// external crates - if those types further refer to types in other crates
// then we must translate the crate number from that encoded in the external
// crate to the correct local crate number.
pub fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id {
pub fn translate_def_id(cdata: Cmd, did: ast::def_id) -> ast::def_id {
if did.crate == ast::LOCAL_CRATE {
return ast::def_id { crate: cdata.cnum, node: did.node };
}
@ -1430,7 +1430,7 @@ pub fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id {
}
}
pub fn get_link_args_for_crate(cdata: cmd) -> ~[~str] {
pub fn get_link_args_for_crate(cdata: Cmd) -> ~[~str] {
let link_args = reader::get_doc(reader::Doc(cdata.data), tag_link_args);
let mut result = ~[];
do reader::tagged_docs(link_args, tag_link_args_arg) |arg_doc| {
@ -1440,7 +1440,7 @@ pub fn get_link_args_for_crate(cdata: cmd) -> ~[~str] {
result
}
pub fn each_impl(cdata: cmd, callback: &fn(ast::def_id)) {
pub fn each_impl(cdata: Cmd, callback: &fn(ast::def_id)) {
let impls_doc = reader::get_doc(reader::Doc(cdata.data), tag_impls);
let _ = do reader::tagged_docs(impls_doc, tag_impls_impl) |impl_doc| {
callback(item_def_id(impl_doc, cdata));
@ -1448,7 +1448,7 @@ pub fn each_impl(cdata: cmd, callback: &fn(ast::def_id)) {
};
}
pub fn each_implementation_for_type(cdata: cmd,
pub fn each_implementation_for_type(cdata: Cmd,
id: ast::NodeId,
callback: &fn(ast::def_id)) {
let item_doc = lookup_item(id, cdata.data);
@ -1460,7 +1460,7 @@ pub fn each_implementation_for_type(cdata: cmd,
};
}
pub fn each_implementation_for_trait(cdata: cmd,
pub fn each_implementation_for_trait(cdata: Cmd,
id: ast::NodeId,
callback: &fn(ast::def_id)) {
let item_doc = lookup_item(id, cdata.data);
@ -1474,7 +1474,7 @@ pub fn each_implementation_for_trait(cdata: cmd,
};
}
pub fn get_trait_of_method(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt)
pub fn get_trait_of_method(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt)
-> Option<ast::def_id> {
let item_doc = lookup_item(id, cdata.data);
let parent_item_id = match item_parent_item(item_doc) {

View File

@ -1488,13 +1488,13 @@ fn encode_crate_deps(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
cstore: &cstore::CStore) {
fn get_ordered_deps(ecx: &EncodeContext, cstore: &cstore::CStore)
-> ~[decoder::crate_dep] {
type numdep = decoder::crate_dep;
-> ~[decoder::CrateDep] {
type numdep = decoder::CrateDep;
// Pull the cnums and name,vers,hash out of cstore
let mut deps = ~[];
do cstore::iter_crate_data(cstore) |key, val| {
let dep = decoder::crate_dep {cnum: key,
let dep = decoder::CrateDep {cnum: key,
name: ecx.tcx.sess.ident_of(val.name),
vers: decoder::get_crate_vers(val.data),
hash: decoder::get_crate_hash(val.data)};
@ -1645,7 +1645,7 @@ fn encode_misc_info(ecx: &EncodeContext,
fn encode_crate_dep(ecx: &EncodeContext,
ebml_w: &mut writer::Encoder,
dep: decoder::crate_dep) {
dep: decoder::CrateDep) {
ebml_w.start_tag(tag_crate_dep);
ebml_w.start_tag(tag_crate_dep_name);
let s = ecx.tcx.sess.str_of(dep.name);

View File

@ -16,7 +16,7 @@ use metadata::decoder;
use metadata::encoder;
use metadata::filesearch::{FileSearch, FileMatch, FileMatches, FileDoesntMatch};
use metadata::filesearch;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::diagnostic::span_handler;
use syntax::parse::token::ident_interner;
use syntax::print::pprust;
@ -34,22 +34,22 @@ use std::str;
use std::vec;
use extra::flate;
pub enum os {
os_macos,
os_win32,
os_linux,
os_android,
os_freebsd
pub enum Os {
OsMacos,
OsWin32,
OsLinux,
OsAndroid,
OsFreebsd
}
pub struct Context {
diag: @mut span_handler,
filesearch: @FileSearch,
span: span,
span: Span,
ident: @str,
metas: ~[@ast::MetaItem],
hash: @str,
os: os,
os: Os,
is_static: bool,
intr: @ident_interner
}
@ -73,11 +73,11 @@ fn find_library_crate(cx: &Context) -> Option<(~str, @~[u8])> {
fn libname(cx: &Context) -> (~str, ~str) {
if cx.is_static { return (~"lib", ~".rlib"); }
let (dll_prefix, dll_suffix) = match cx.os {
os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
os_macos => (macos::DLL_PREFIX, macos::DLL_SUFFIX),
os_linux => (linux::DLL_PREFIX, linux::DLL_SUFFIX),
os_android => (android::DLL_PREFIX, android::DLL_SUFFIX),
os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
OsWin32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
OsMacos => (macos::DLL_PREFIX, macos::DLL_SUFFIX),
OsLinux => (linux::DLL_PREFIX, linux::DLL_SUFFIX),
OsAndroid => (android::DLL_PREFIX, android::DLL_SUFFIX),
OsFreebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
};
(dll_prefix.to_owned(), dll_suffix.to_owned())
@ -196,7 +196,7 @@ pub fn metadata_matches(extern_metas: &[@ast::MetaItem],
}
}
fn get_metadata_section(os: os,
fn get_metadata_section(os: Os,
filename: &Path) -> Option<@~[u8]> {
unsafe {
let mb = do filename.with_c_str |buf| {
@ -212,7 +212,7 @@ fn get_metadata_section(os: os,
let name_buf = llvm::LLVMGetSectionName(si.llsi);
let name = str::raw::from_c_str(name_buf);
debug!("get_metadata_section: name %s", name);
if name == read_meta_section_name(os) {
if read_meta_section_name(os) == name {
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
let csz = llvm::LLVMGetSectionSize(si.llsi) as uint;
let mut found = None;
@ -245,29 +245,29 @@ fn get_metadata_section(os: os,
}
}
pub fn meta_section_name(os: os) -> ~str {
pub fn meta_section_name(os: Os) -> &'static str {
match os {
os_macos => ~"__DATA,__note.rustc",
os_win32 => ~".note.rustc",
os_linux => ~".note.rustc",
os_android => ~".note.rustc",
os_freebsd => ~".note.rustc"
OsMacos => "__DATA,__note.rustc",
OsWin32 => ".note.rustc",
OsLinux => ".note.rustc",
OsAndroid => ".note.rustc",
OsFreebsd => ".note.rustc"
}
}
pub fn read_meta_section_name(os: os) -> ~str {
pub fn read_meta_section_name(os: Os) -> &'static str {
match os {
os_macos => ~"__note.rustc",
os_win32 => ~".note.rustc",
os_linux => ~".note.rustc",
os_android => ~".note.rustc",
os_freebsd => ~".note.rustc"
OsMacos => "__note.rustc",
OsWin32 => ".note.rustc",
OsLinux => ".note.rustc",
OsAndroid => ".note.rustc",
OsFreebsd => ".note.rustc"
}
}
// A diagnostic function for dumping crate metadata to an output stream
pub fn list_file_metadata(intr: @ident_interner,
os: os,
os: Os,
path: &Path,
out: @io::Writer) {
match get_metadata_section(os, path) {

View File

@ -33,7 +33,7 @@ use syntax::ast;
use syntax::ast_map;
use syntax::ast_util::inlined_item_utils;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::codemap;
use syntax::fold::*;
use syntax::fold;
@ -214,7 +214,7 @@ impl ExtendedDecodeContext {
assert_eq!(did.crate, ast::LOCAL_CRATE);
ast::def_id { crate: ast::LOCAL_CRATE, node: self.tr_id(did.node) }
}
pub fn tr_span(&self, _span: span) -> span {
pub fn tr_span(&self, _span: Span) -> Span {
codemap::dummy_sp() // FIXME (#1972): handle span properly
}
}
@ -231,8 +231,8 @@ impl tr for ast::def_id {
}
}
impl tr for span {
fn tr(&self, xcx: @ExtendedDecodeContext) -> span {
impl tr for Span {
fn tr(&self, xcx: @ExtendedDecodeContext) -> Span {
xcx.tr_span(*self)
}
}
@ -302,9 +302,9 @@ fn simplify_ast(ii: &ast::inlined_item) -> ast::inlined_item {
let stmts_sans_items = do blk.stmts.iter().filter_map |stmt| {
match stmt.node {
ast::stmt_expr(_, _) | ast::stmt_semi(_, _) |
ast::stmt_decl(@codemap::spanned { node: ast::decl_local(_), span: _}, _)
ast::stmt_decl(@codemap::Spanned { node: ast::decl_local(_), span: _}, _)
=> Some(*stmt),
ast::stmt_decl(@codemap::spanned { node: ast::decl_item(_), span: _}, _)
ast::stmt_decl(@codemap::Spanned { node: ast::decl_item(_), span: _}, _)
=> None,
ast::stmt_mac(*) => fail!("unexpanded macro in astencode")
}
@ -1255,7 +1255,7 @@ fn decode_item_ast(par_doc: ebml::Doc) -> @ast::item {
trait fake_ext_ctxt {
fn cfg(&self) -> ast::CrateConfig;
fn parse_sess(&self) -> @mut parse::ParseSess;
fn call_site(&self) -> span;
fn call_site(&self) -> Span;
fn ident_of(&self, st: &str) -> ast::ident;
}
@ -1266,8 +1266,8 @@ type fake_session = @mut parse::ParseSess;
impl fake_ext_ctxt for fake_session {
fn cfg(&self) -> ast::CrateConfig { ~[] }
fn parse_sess(&self) -> @mut parse::ParseSess { *self }
fn call_site(&self) -> span {
codemap::span {
fn call_site(&self) -> Span {
codemap::Span {
lo: codemap::BytePos(0),
hi: codemap::BytePos(0),
expn_info: None

View File

@ -26,7 +26,7 @@ use middle::ty;
use syntax::ast::{m_imm, m_mutbl};
use syntax::ast;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::visit::Visitor;
use syntax::visit;
use util::ppaux::Repr;
@ -56,7 +56,7 @@ impl<'self> Visitor<CheckLoanCtxt<'self>> for CheckLoanVisitor {
check_loans_in_pat(self, p, e);
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:CheckLoanCtxt) {
b:&ast::Block, s:Span, n:ast::NodeId, e:CheckLoanCtxt) {
check_loans_in_fn(self, fk, fd, b, s, n, e);
}
}
@ -82,7 +82,7 @@ pub fn check_loans(bccx: @BorrowckCtxt,
enum MoveError {
MoveOk,
MoveWhileBorrowed(/*loan*/@LoanPath, /*loan*/span)
MoveWhileBorrowed(/*loan*/@LoanPath, /*loan*/Span)
}
impl<'self> CheckLoanCtxt<'self> {
@ -107,7 +107,7 @@ impl<'self> CheckLoanCtxt<'self> {
}
}
fn check_captured_variables(&self, closure_id: ast::NodeId, span: span) {
fn check_captured_variables(&self, closure_id: ast::NodeId, span: Span) {
let cap_vars = self.bccx.capture_map.get(&closure_id);
for cap_var in cap_vars.iter() {
let var_id = ast_util::def_id_of_def(cap_var.def).node;
@ -311,7 +311,7 @@ impl<'self> CheckLoanCtxt<'self> {
pub fn check_if_path_is_moved(&self,
id: ast::NodeId,
span: span,
span: Span,
use_kind: MovedValueUseKind,
lp: @LoanPath) {
/*!
@ -669,7 +669,7 @@ impl<'self> CheckLoanCtxt<'self> {
}
}
fn check_move_out_from_id(&self, id: ast::NodeId, span: span) {
fn check_move_out_from_id(&self, id: ast::NodeId, span: Span) {
do self.move_data.each_path_moved_by(id) |_, move_path| {
match self.analyze_move_out_from(id, move_path) {
MoveOk => {}
@ -713,7 +713,7 @@ impl<'self> CheckLoanCtxt<'self> {
_expr: @ast::expr,
_callee: Option<@ast::expr>,
_callee_id: ast::NodeId,
_callee_span: span,
_callee_span: Span,
_args: &[@ast::expr]) {
// NB: This call to check for conflicting loans is not truly
// necessary, because the callee_id never issues new loans.
@ -729,7 +729,7 @@ fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor,
fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
sp: Span,
id: ast::NodeId,
this: CheckLoanCtxt<'a>) {
match *fk {
@ -749,7 +749,7 @@ fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor,
fn check_captured_variables(this: CheckLoanCtxt,
closure_id: ast::NodeId,
span: span) {
span: Span) {
let cap_vars = this.bccx.capture_map.get(&closure_id);
for cap_var in cap_vars.iter() {
let var_id = ast_util::def_id_of_def(cap_var.def).node;

View File

@ -19,13 +19,13 @@ use middle::moves;
use middle::ty;
use syntax::ast;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap::Span;
use util::ppaux::{UserString};
pub fn gather_decl(bccx: @BorrowckCtxt,
move_data: &mut MoveData,
decl_id: ast::NodeId,
_decl_span: span,
_decl_span: Span,
var_id: ast::NodeId) {
let loan_path = @LpVar(var_id);
move_data.add_move(bccx.tcx, loan_path, decl_id, Declared);
@ -86,7 +86,7 @@ pub fn gather_captures(bccx: @BorrowckCtxt,
pub fn gather_assignment(bccx: @BorrowckCtxt,
move_data: &mut MoveData,
assignment_id: ast::NodeId,
assignment_span: span,
assignment_span: Span,
assignee_loan_path: @LoanPath,
assignee_id: ast::NodeId) {
move_data.add_assignment(bccx.tcx,

View File

@ -17,13 +17,13 @@ use mc = middle::mem_categorization;
use middle::ty;
use syntax::ast::{m_imm, m_mutbl};
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
use util::ppaux::{note_and_explain_region};
pub fn guarantee_lifetime(bccx: @BorrowckCtxt,
item_scope_id: ast::NodeId,
root_scope_id: ast::NodeId,
span: span,
span: Span,
cmt: mc::cmt,
loan_region: ty::Region,
loan_mutbl: LoanMutability) {
@ -52,7 +52,7 @@ struct GuaranteeLifetimeContext {
// longest scope for which we can root managed boxes
root_scope_id: ast::NodeId,
span: span,
span: Span,
loan_region: ty::Region,
loan_mutbl: LoanMutability,
cmt_original: mc::cmt

View File

@ -28,7 +28,7 @@ use util::ppaux::{Repr};
use syntax::ast;
use syntax::ast_util::id_range;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::print::pprust;
use syntax::visit;
use syntax::visit::Visitor;
@ -83,7 +83,7 @@ impl visit::Visitor<@mut GatherLoanCtxt> for GatherLoanVisitor {
gather_loans_in_block(self, b, e);
}
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block,
s:span, n:NodeId, e:@mut GatherLoanCtxt) {
s:Span, n:NodeId, e:@mut GatherLoanCtxt) {
gather_loans_in_fn(self, fk, fd, b, s, n, e);
}
fn visit_stmt(&mut self, s:@stmt, e:@mut GatherLoanCtxt) {
@ -131,7 +131,7 @@ fn gather_loans_in_fn(v: &mut GatherLoanVisitor,
fk: &fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
sp: Span,
id: ast::NodeId,
this: @mut GatherLoanCtxt) {
match fk {
@ -413,7 +413,7 @@ impl GatherLoanCtxt {
// dynamically that they are not freed.
pub fn guarantee_valid(&mut self,
borrow_id: ast::NodeId,
borrow_span: span,
borrow_span: Span,
cmt: mc::cmt,
req_mutbl: LoanMutability,
loan_region: ty::Region) {
@ -538,7 +538,7 @@ impl GatherLoanCtxt {
// }
fn check_mutability(bccx: @BorrowckCtxt,
borrow_span: span,
borrow_span: Span,
cmt: mc::cmt,
req_mutbl: LoanMutability) {
//! Implements the M-* rules in doc.rs.

View File

@ -16,7 +16,7 @@ use middle::borrowck::*;
use mc = middle::mem_categorization;
use middle::ty;
use syntax::ast::{m_imm, m_mutbl};
use syntax::codemap::span;
use syntax::codemap::Span;
pub enum RestrictionResult {
Safe,
@ -24,7 +24,7 @@ pub enum RestrictionResult {
}
pub fn compute_restrictions(bccx: @BorrowckCtxt,
span: span,
span: Span,
cmt: mc::cmt,
restr: RestrictionSet) -> RestrictionResult {
let ctxt = RestrictionsContext {
@ -41,7 +41,7 @@ pub fn compute_restrictions(bccx: @BorrowckCtxt,
struct RestrictionsContext {
bccx: @BorrowckCtxt,
span: span,
span: Span,
cmt_original: mc::cmt
}

View File

@ -26,7 +26,7 @@ use std::ops::{BitOr, BitAnd};
use std::result::{Result};
use syntax::ast;
use syntax::ast_map;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::parse::token;
use syntax::visit;
use syntax::visit::{Visitor,fn_kind};
@ -65,7 +65,7 @@ struct BorrowckVisitor;
impl Visitor<@BorrowckCtxt> for BorrowckVisitor {
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl,
b:&Block, s:span, n:NodeId, e:@BorrowckCtxt) {
b:&Block, s:Span, n:NodeId, e:@BorrowckCtxt) {
borrowck_fn(self, fk, fd, b, s, n, e);
}
}
@ -127,7 +127,7 @@ fn borrowck_fn(v: &mut BorrowckVisitor,
fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
sp: Span,
id: ast::NodeId,
this: @BorrowckCtxt) {
match fk {
@ -277,7 +277,7 @@ pub struct Loan {
restrictions: ~[Restriction],
gen_scope: ast::NodeId,
kill_scope: ast::NodeId,
span: span,
span: Span,
}
#[deriving(Eq, IterBytes)]
@ -454,7 +454,7 @@ pub enum bckerr_code {
// that caused it
#[deriving(Eq)]
pub struct BckError {
span: span,
span: Span,
cmt: mc::cmt,
code: bckerr_code
}
@ -516,7 +516,7 @@ impl BorrowckCtxt {
pub fn cat_def(&self,
id: ast::NodeId,
span: span,
span: Span,
ty: ty::t,
def: ast::def)
-> mc::cmt {
@ -550,7 +550,7 @@ impl BorrowckCtxt {
}
pub fn report_use_of_moved_value(&self,
use_span: span,
use_span: Span,
use_kind: MovedValueUseKind,
lp: &LoanPath,
move: &move_data::Move,
@ -631,7 +631,7 @@ impl BorrowckCtxt {
}
pub fn report_reassigned_immutable_variable(&self,
span: span,
span: Span,
lp: &LoanPath,
assign:
&move_data::Assignment) {
@ -644,11 +644,11 @@ impl BorrowckCtxt {
fmt!("prior assignment occurs here"));
}
pub fn span_err(&self, s: span, m: &str) {
pub fn span_err(&self, s: Span, m: &str) {
self.tcx.sess.span_err(s, m);
}
pub fn span_note(&self, s: span, m: &str) {
pub fn span_note(&self, s: Span, m: &str) {
self.tcx.sess.span_note(s, m);
}
@ -677,7 +677,7 @@ impl BorrowckCtxt {
}
pub fn report_aliasability_violation(&self,
span: span,
span: Span,
kind: AliasableViolationKind,
cause: mc::AliasableReason) {
let prefix = match kind {

View File

@ -25,7 +25,7 @@ use middle::ty;
use middle::typeck;
use syntax::ast;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::opt_vec::OptVec;
use syntax::opt_vec;
use util::ppaux::Repr;
@ -135,7 +135,7 @@ pub struct Assignment {
id: ast::NodeId,
/// span of node where assignment occurs
span: span,
span: Span,
}
pub struct MoveDataFlowOperator;
@ -327,7 +327,7 @@ impl MoveData {
tcx: ty::ctxt,
lp: @LoanPath,
assign_id: ast::NodeId,
span: span,
span: Span,
assignee_id: ast::NodeId) {
/*!
* Adds a new record for an assignment to `lp` that occurs at

View File

@ -85,7 +85,7 @@ pub fn check_pat(v: &mut CheckCrateVisitor, p: @pat, _is_const: bool) {
fn is_str(e: @expr) -> bool {
match e.node {
expr_vstore(
@expr { node: expr_lit(@codemap::spanned {
@expr { node: expr_lit(@codemap::Spanned {
node: lit_str(_),
_}),
_ },
@ -120,7 +120,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
"disallowed operator in constant expression");
return;
}
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
expr_lit(@codemap::Spanned {node: lit_str(_), _}) => { }
expr_binary(*) | expr_unary(*) => {
if method_map.contains_key(&e.id) {
sess.span_err(e.span, "user-defined operators are not \
@ -200,7 +200,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
}
}
match e.node {
expr_lit(@codemap::spanned {node: lit_int(v, t), _}) => {
expr_lit(@codemap::Spanned {node: lit_int(v, t), _}) => {
if t != ty_char {
if (v as u64) > ast_util::int_ty_max(
if t == ty_i { sess.targ_cfg.int_type } else { t }) {
@ -208,7 +208,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
}
}
}
expr_lit(@codemap::spanned {node: lit_uint(v, t), _}) => {
expr_lit(@codemap::Spanned {node: lit_uint(v, t), _}) => {
if v > ast_util::uint_ty_max(
if t == ty_u { sess.targ_cfg.uint_type } else { t }) {
sess.span_err(e.span, "literal out of range for its type");

View File

@ -24,7 +24,7 @@ use std::vec;
use extra::sort;
use syntax::ast::*;
use syntax::ast_util::{unguarded_pat, walk_pat};
use syntax::codemap::{span, dummy_sp, spanned};
use syntax::codemap::{Span, dummy_sp, Spanned};
use syntax::visit;
use syntax::visit::{Visitor,fn_kind};
@ -45,7 +45,7 @@ impl Visitor<()> for CheckMatchVisitor {
fn visit_local(&mut self, l:@Local, e:()) {
check_local(self, self.cx, l, e);
}
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:()) {
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:()) {
check_fn(self, self.cx, fk, fd, b, s, n, e);
}
}
@ -160,7 +160,7 @@ pub fn raw_pat(p: @pat) -> @pat {
}
}
pub fn check_exhaustive(cx: &MatchCheckCtxt, sp: span, pats: ~[@pat]) {
pub fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@pat]) {
assert!((!pats.is_empty()));
let ext = match is_useful(cx, &pats.map(|p| ~[*p]), [wild()]) {
not_useful => {
@ -821,7 +821,7 @@ pub fn check_fn(v: &mut CheckMatchVisitor,
kind: &visit::fn_kind,
decl: &fn_decl,
body: &Block,
sp: span,
sp: Span,
id: NodeId,
s: ()) {
visit::walk_fn(v, kind, decl, body, sp, id, s);
@ -850,7 +850,7 @@ pub fn is_refutable(cx: &MatchCheckCtxt, pat: &pat) -> bool {
is_refutable(cx, sub)
}
pat_wild | pat_ident(_, _, None) => { false }
pat_lit(@expr {node: expr_lit(@spanned { node: lit_nil, _}), _}) => {
pat_lit(@expr {node: expr_lit(@Spanned { node: lit_nil, _}), _}) => {
// "()"
false
}

View File

@ -19,7 +19,7 @@ use util::ppaux;
use syntax::ast::{deref, expr_call, expr_inline_asm, expr_method_call};
use syntax::ast::{expr_unary, unsafe_fn, expr_path};
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::visit::{fk_item_fn, fk_method};
use syntax::visit;
use syntax::visit::{Visitor,fn_kind};
@ -53,7 +53,7 @@ struct EffectCheckVisitor {
}
impl EffectCheckVisitor {
fn require_unsafe(&mut self, span: span, description: &str) {
fn require_unsafe(&mut self, span: Span, description: &str) {
match self.context.unsafe_context {
SafeContext => {
// Report an error.
@ -73,7 +73,7 @@ impl EffectCheckVisitor {
impl Visitor<()> for EffectCheckVisitor {
fn visit_fn(&mut self, fn_kind:&fn_kind, fn_decl:&fn_decl,
block:&Block, span:span, node_id:NodeId, _:()) {
block:&Block, span:Span, node_id:NodeId, _:()) {
let (is_item_fn, is_unsafe_fn) = match *fn_kind {
fk_item_fn(_, _, purity, _) => (true, purity == unsafe_fn),

View File

@ -14,7 +14,7 @@ use driver::session::Session;
use syntax::ast::{Crate, NodeId, item, item_fn};
use syntax::ast_map;
use syntax::attr;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::parse::token::special_idents;
use syntax::visit;
use syntax::visit::Visitor;
@ -26,17 +26,17 @@ struct EntryContext {
ast_map: ast_map::map,
// The top-level function called 'main'
main_fn: Option<(NodeId, span)>,
main_fn: Option<(NodeId, Span)>,
// The function that has attribute named 'main'
attr_main_fn: Option<(NodeId, span)>,
attr_main_fn: Option<(NodeId, Span)>,
// The function that has the attribute 'start' on it
start_fn: Option<(NodeId, span)>,
start_fn: Option<(NodeId, Span)>,
// The functions that one might think are 'main' but aren't, e.g.
// main functions not defined at the top level. For diagnostics.
non_main_fns: ~[(NodeId, span)],
non_main_fns: ~[(NodeId, Span)],
}
struct EntryVisitor;
@ -51,7 +51,7 @@ pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map)
// FIXME #4404 android JNI hacks
if *session.building_library &&
session.targ_cfg.os != session::os_android {
session.targ_cfg.os != session::OsAndroid {
// No need to find a main function
return;
}
@ -157,7 +157,7 @@ fn configure_main(ctxt: @mut EntryContext) {
} else {
// If we *are* building a library, then we're on android where we still might
// optionally want to translate main $4404
assert_eq!(this.session.targ_cfg.os, session::os_android);
assert_eq!(this.session.targ_cfg.os, session::OsAndroid);
}
}
}

View File

@ -16,7 +16,7 @@ use middle::resolve;
use middle::ty;
use std::hashmap::HashMap;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::{ast, ast_util};
use syntax::visit;
use syntax::visit::Visitor;
@ -27,7 +27,7 @@ use syntax::ast::{item};
#[deriving(Encodable, Decodable)]
pub struct freevar_entry {
def: ast::def, //< The variable being accessed free.
span: span //< First span where it is accessed (there can be multiple)
span: Span //< First span where it is accessed (there can be multiple)
}
pub type freevar_info = @~[@freevar_entry];
pub type freevar_map = @mut HashMap<ast::NodeId, freevar_info>;
@ -110,7 +110,7 @@ struct AnnotateFreevarsVisitor {
impl Visitor<()> for AnnotateFreevarsVisitor {
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
blk:&ast::Block, s:span, nid:ast::NodeId, _:()) {
blk:&ast::Block, s:Span, nid:ast::NodeId, _:()) {
let vars = collect_freevars(self.def_map, blk);
self.freevars.insert(nid, vars);
visit::walk_fn(self, fk, fd, blk, s, nid, ());

View File

@ -18,7 +18,7 @@ use util::ppaux::UserString;
use syntax::ast::*;
use syntax::attr;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::opt_vec;
use syntax::print::pprust::expr_to_str;
use syntax::{visit,ast_util};
@ -65,7 +65,7 @@ impl Visitor<Context> for KindAnalysisVisitor {
check_expr(self, ex, e);
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:Context) {
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:Context) {
check_fn(self, fk, fd, b, s, n, e);
}
@ -91,7 +91,7 @@ pub fn check_crate(tcx: ty::ctxt,
}
fn check_struct_safe_for_destructor(cx: Context,
span: span,
span: Span,
struct_did: def_id) {
let struct_tpt = ty::lookup_item_type(cx.tcx, struct_did);
if !struct_tpt.generics.has_type_params() {
@ -245,7 +245,7 @@ fn check_fn(
fk: &visit::fn_kind,
decl: &fn_decl,
body: &Block,
sp: span,
sp: Span,
fn_id: NodeId,
cx: Context) {
@ -364,7 +364,7 @@ pub fn check_builtin_bounds(cx: Context, ty: ty::t, bounds: ty::BuiltinBounds,
pub fn check_typaram_bounds(cx: Context,
_type_parameter_id: NodeId,
sp: span,
sp: Span,
ty: ty::t,
type_param_def: &ty::TypeParameterDef)
{
@ -378,7 +378,7 @@ pub fn check_typaram_bounds(cx: Context,
}
}
pub fn check_freevar_bounds(cx: Context, sp: span, ty: ty::t,
pub fn check_freevar_bounds(cx: Context, sp: Span, ty: ty::t,
bounds: ty::BuiltinBounds, referenced_ty: Option<ty::t>)
{
do check_builtin_bounds(cx, ty, bounds) |missing| {
@ -401,7 +401,7 @@ pub fn check_freevar_bounds(cx: Context, sp: span, ty: ty::t,
}
}
pub fn check_trait_cast_bounds(cx: Context, sp: span, ty: ty::t,
pub fn check_trait_cast_bounds(cx: Context, sp: Span, ty: ty::t,
bounds: ty::BuiltinBounds) {
do check_builtin_bounds(cx, ty, bounds) |missing| {
cx.tcx.sess.span_err(sp,
@ -426,7 +426,7 @@ fn is_nullary_variant(cx: Context, ex: @expr) -> bool {
}
}
fn check_imm_free_var(cx: Context, def: def, sp: span) {
fn check_imm_free_var(cx: Context, def: def, sp: Span) {
match def {
def_local(_, is_mutbl) => {
if is_mutbl {
@ -446,7 +446,7 @@ fn check_imm_free_var(cx: Context, def: def, sp: span) {
}
}
fn check_copy(cx: Context, ty: ty::t, sp: span, reason: &str) {
fn check_copy(cx: Context, ty: ty::t, sp: Span, reason: &str) {
debug!("type_contents(%s)=%s",
ty_to_str(cx.tcx, ty),
ty::type_contents(cx.tcx, ty).to_str());
@ -458,7 +458,7 @@ fn check_copy(cx: Context, ty: ty::t, sp: span, reason: &str) {
}
}
pub fn check_send(cx: Context, ty: ty::t, sp: span) -> bool {
pub fn check_send(cx: Context, ty: ty::t, sp: Span) -> bool {
if !ty::type_is_sendable(cx.tcx, ty) {
cx.tcx.sess.span_err(
sp, fmt!("value has non-sendable type `%s`",
@ -470,7 +470,7 @@ pub fn check_send(cx: Context, ty: ty::t, sp: span) -> bool {
}
// note: also used from middle::typeck::regionck!
pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool {
pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: Span) -> bool {
if !ty::type_is_static(tcx, ty) {
match ty::get(ty).sty {
ty::ty_param(*) => {

View File

@ -28,7 +28,7 @@ use extra::smallintmap::SmallIntMap;
use syntax::ast_map;
use syntax::attr;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::codemap;
use syntax::parse::token;
use syntax::{ast, ast_util, visit};
@ -135,7 +135,7 @@ enum AttributedNode<'self> {
#[deriving(Eq)]
enum LintSource {
Node(span),
Node(Span),
Default,
CommandLine
}
@ -304,7 +304,7 @@ pub fn get_lint_dict() -> LintDict {
trait OuterLint {
fn process_item(@mut self, i:@ast::item, e:@mut Context);
fn process_fn(@mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context);
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context);
// Returned inner variant will not proceed past subitems.
// Supports decomposition of simple lints into subitem-traversing
@ -319,7 +319,7 @@ trait InnerLint {
function_kind: &visit::fn_kind,
function_declaration: &ast::fn_decl,
function_body: &ast::Block,
sp: span,
sp: Span,
id: ast::NodeId,
env: @mut Context);
}
@ -332,7 +332,7 @@ impl<V:Visitor<@mut Context>> InnerLint for V {
visit::walk_crate(self, crate, env);
}
fn descend_fn(@mut self, fk: &visit::fn_kind, fd: &ast::fn_decl, fb: &ast::Block,
sp: span, id: ast::NodeId, env: @mut Context) {
sp: Span, id: ast::NodeId, env: @mut Context) {
visit::walk_fn(self, fk, fd, fb, sp, id, env);
}
}
@ -409,7 +409,7 @@ impl Context {
fail!("unregistered lint %?", lint);
}
fn span_lint(&self, lint: lint, span: span, msg: &str) {
fn span_lint(&self, lint: lint, span: Span, msg: &str) {
let (level, src) = match self.curr.find(&(lint as uint)) {
None => { return }
Some(&(warn, src)) => (self.get_level(warnings), src),
@ -617,7 +617,7 @@ trait SubitemStoppableVisitor : Visitor<@mut Context> {
}
fn visit_fn_action(&mut self, _fk:&visit::fn_kind, _fd:&ast::fn_decl,
_b:&ast::Block, _s:span, _n:ast::NodeId, _e:@mut Context) {
_b:&ast::Block, _s:Span, _n:ast::NodeId, _e:@mut Context) {
// fill in with particular action without recursion if desired
}
@ -641,7 +641,7 @@ trait SubitemStoppableVisitor : Visitor<@mut Context> {
}
fn OVERRIDE_visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
if self.is_running_on_items() {
self.visit_fn_action(fk, fd, b, s, n, e);
visit::walk_fn(self, fk, fd, b, s, n, e);
@ -670,7 +670,7 @@ impl Visitor<@mut Context> for WhileTrueLintVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.OVERRIDE_visit_fn(fk, fd, b, s, n, e);
}
@ -679,7 +679,7 @@ impl Visitor<@mut Context> for WhileTrueLintVisitor {
match e.node {
ast::expr_while(cond, _) => {
match cond.node {
ast::expr_lit(@codemap::spanned {
ast::expr_lit(@codemap::Spanned {
node: ast::lit_bool(true), _}) =>
{
cx.span_lint(while_true, e.span,
@ -703,7 +703,7 @@ macro_rules! outer_lint_boilerplate_impl(
self.visit_item_action(i, e);
}
fn process_fn(@mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.visit_fn_action(fk, fd, b, s, n, e);
}
fn inner_variant(@mut self) -> @mut InnerLint {
@ -834,7 +834,7 @@ impl Visitor<@mut Context> for TypeLimitsLintVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.OVERRIDE_visit_fn(fk, fd, b, s, n, e);
}
@ -905,7 +905,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) {
}
}
fn check_type_for_lint(cx: &Context, lint: lint, span: span, ty: ty::t) {
fn check_type_for_lint(cx: &Context, lint: lint, span: Span, ty: ty::t) {
if cx.get_level(lint) == allow { return }
let mut n_box = 0;
@ -932,7 +932,7 @@ fn check_type_for_lint(cx: &Context, lint: lint, span: span, ty: ty::t) {
}
}
fn check_type(cx: &Context, span: span, ty: ty::t) {
fn check_type(cx: &Context, span: Span, ty: ty::t) {
let xs = [managed_heap_memory, owned_heap_memory, heap_memory];
for lint in xs.iter() {
check_type_for_lint(cx, *lint, span, ty);
@ -975,7 +975,7 @@ impl Visitor<@mut Context> for HeapLintVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.OVERRIDE_visit_fn(fk, fd, b, s, n, e);
}
@ -1006,7 +1006,7 @@ impl Visitor<@mut Context> for PathStatementLintVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.OVERRIDE_visit_fn(fk, fd, b, s, n, e);
}
@ -1044,7 +1044,7 @@ fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) {
!ident.contains_char('_')
}
fn check_case(cx: &Context, sort: &str, ident: ast::ident, span: span) {
fn check_case(cx: &Context, sort: &str, ident: ast::ident, span: Span) {
if !is_camel_case(cx.tcx, ident) {
cx.span_lint(
non_camel_case_types, span,
@ -1099,7 +1099,7 @@ impl Visitor<@mut Context> for UnusedUnsafeLintVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.OVERRIDE_visit_fn(fk, fd, b, s, n, e);
}
@ -1157,7 +1157,7 @@ impl SubitemStoppableVisitor for UnusedMutLintVisitor {
fn is_running_on_items(&mut self) -> bool { !self.stopping_on_items }
fn visit_fn_action(&mut self, _a:&visit::fn_kind, fd:&ast::fn_decl,
_b:&ast::Block, _c:span, _d:ast::NodeId, cx:@mut Context) {
_b:&ast::Block, _c:Span, _d:ast::NodeId, cx:@mut Context) {
self.visit_fn_decl(cx, fd);
}
}
@ -1168,7 +1168,7 @@ impl Visitor<@mut Context> for UnusedMutLintVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.OVERRIDE_visit_fn(fk, fd, b, s, n, e);
}
@ -1225,7 +1225,7 @@ impl Visitor<@mut Context> for UnnecessaryAllocationLintVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.OVERRIDE_visit_fn(fk, fd, b, s, n, e);
}
@ -1243,7 +1243,7 @@ impl UnnecessaryAllocationLintVisitor {
ast::expr_vstore(e2, ast::expr_vstore_uniq) |
ast::expr_vstore(e2, ast::expr_vstore_box) => {
match e2.node {
ast::expr_lit(@codemap::spanned{
ast::expr_lit(@codemap::Spanned{
node: ast::lit_str(*), _}) |
ast::expr_vec(*) => {}
_ => return
@ -1278,7 +1278,7 @@ impl MissingDocLintVisitor {
fn check_attrs(&mut self,
cx: @mut Context,
attrs: &[ast::Attribute],
sp: span,
sp: Span,
msg: &str) {
// If we're building a test harness, then warning about documentation is
// probably not really relevant right now
@ -1299,7 +1299,7 @@ impl Visitor<@mut Context> for MissingDocLintVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) {
self.OVERRIDE_visit_fn(fk, fd, b, s, n, e);
}
@ -1316,7 +1316,7 @@ impl SubitemStoppableVisitor for MissingDocLintVisitor {
fn is_running_on_items(&mut self) -> bool { !self.stopping_on_items }
fn visit_fn_action(&mut self, fk:&visit::fn_kind, _d:&ast::fn_decl,
_b:&ast::Block, sp:span, _id:ast::NodeId, cx:@mut Context) {
_b:&ast::Block, sp:Span, _id:ast::NodeId, cx:@mut Context) {
// Only warn about explicitly public methods. Soon implicit
// public-ness will hopefully be going away.
@ -1400,7 +1400,7 @@ impl Visitor<@mut Context> for LintCheckVisitor {
}
fn visit_fn(&mut self, fk:&visit::fn_kind, decl:&ast::fn_decl,
body:&ast::Block, span:span, id:ast::NodeId, cx:@mut Context) {
body:&ast::Block, span:Span, id:ast::NodeId, cx:@mut Context) {
match *fk {
visit::fk_method(_, _, m) => {

View File

@ -116,7 +116,7 @@ use std::to_str;
use std::uint;
use std::vec;
use syntax::ast::*;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::parse::token::special_idents;
use syntax::print::pprust::{expr_to_str, block_to_str};
use syntax::{visit, ast_util};
@ -135,9 +135,9 @@ impl Clone for LiveNode {
#[deriving(Eq)]
enum LiveNodeKind {
FreeVarNode(span),
ExprNode(span),
VarDefNode(span),
FreeVarNode(Span),
ExprNode(Span),
VarDefNode(Span),
ExitNode
}
@ -154,7 +154,7 @@ fn live_node_kind_to_str(lnk: LiveNodeKind, cx: ty::ctxt) -> ~str {
struct LivenessVisitor;
impl Visitor<@mut IrMaps> for LivenessVisitor {
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:@mut IrMaps) {
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:@mut IrMaps) {
visit_fn(self, fk, fd, b, s, n, e);
}
fn visit_local(&mut self, l:@Local, e:@mut IrMaps) { visit_local(self, l, e); }
@ -308,7 +308,7 @@ impl IrMaps {
v
}
pub fn variable(&mut self, node_id: NodeId, span: span) -> Variable {
pub fn variable(&mut self, node_id: NodeId, span: Span) -> Variable {
match self.variable_map.find(&node_id) {
Some(&var) => var,
None => {
@ -348,7 +348,7 @@ impl IrMaps {
struct ErrorCheckVisitor;
impl Visitor<@Liveness> for ErrorCheckVisitor {
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:@Liveness) {
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:@Liveness) {
check_fn(self, fk, fd, b, s, n, e);
}
fn visit_local(&mut self, l:@Local, e:@Liveness) {
@ -366,7 +366,7 @@ fn visit_fn(v: &mut LivenessVisitor,
fk: &visit::fn_kind,
decl: &fn_decl,
body: &Block,
sp: span,
sp: Span,
id: NodeId,
this: @mut IrMaps) {
debug!("visit_fn: id=%d", id);
@ -602,7 +602,7 @@ fn Liveness(ir: @mut IrMaps, specials: Specials) -> Liveness {
}
impl Liveness {
pub fn live_node(&self, node_id: NodeId, span: span) -> LiveNode {
pub fn live_node(&self, node_id: NodeId, span: Span) -> LiveNode {
let ir: &mut IrMaps = self.ir;
match ir.live_node_map.find(&node_id) {
Some(&ln) => ln,
@ -630,11 +630,11 @@ impl Liveness {
}
}
pub fn variable(&self, node_id: NodeId, span: span) -> Variable {
pub fn variable(&self, node_id: NodeId, span: Span) -> Variable {
self.ir.variable(node_id, span)
}
pub fn variable_from_def_map(&self, node_id: NodeId, span: span)
pub fn variable_from_def_map(&self, node_id: NodeId, span: Span)
-> Option<Variable> {
match self.tcx.def_map.find(&node_id) {
Some(&def) => {
@ -651,7 +651,7 @@ impl Liveness {
pub fn pat_bindings(&self,
pat: @pat,
f: &fn(LiveNode, Variable, span, NodeId)) {
f: &fn(LiveNode, Variable, Span, NodeId)) {
let def_map = self.tcx.def_map;
do pat_util::pat_bindings(def_map, pat) |_bm, p_id, sp, _n| {
let ln = self.live_node(p_id, sp);
@ -662,7 +662,7 @@ impl Liveness {
pub fn arm_pats_bindings(&self,
pats: &[@pat],
f: &fn(LiveNode, Variable, span, NodeId)) {
f: &fn(LiveNode, Variable, Span, NodeId)) {
// only consider the first pattern; any later patterns must have
// the same bindings, and we also consider the first pattern to be
// the "authoratative" set of ids
@ -758,7 +758,7 @@ impl Liveness {
pub fn find_loop_scope(&self,
opt_label: Option<ident>,
id: NodeId,
sp: span)
sp: Span)
-> NodeId {
match opt_label {
Some(_) => // Refers to a labeled loop. Use the results of resolve
@ -1512,7 +1512,7 @@ fn check_fn(_v: &mut ErrorCheckVisitor,
_fk: &visit::fn_kind,
_decl: &fn_decl,
_body: &Block,
_sp: span,
_sp: Span,
_id: NodeId,
_self: @Liveness) {
// do not check contents of nested fns
@ -1528,7 +1528,7 @@ enum ReadKind {
impl Liveness {
pub fn check_ret(&self,
id: NodeId,
sp: span,
sp: Span,
_fk: &visit::fn_kind,
entry_ln: LiveNode) {
if self.live_on_entry(entry_ln, self.s.no_ret_var).is_some() {
@ -1584,7 +1584,7 @@ impl Liveness {
}
pub fn report_illegal_read(&self,
chk_span: span,
chk_span: Span,
lnk: LiveNodeKind,
var: Variable,
rk: ReadKind) {
@ -1639,7 +1639,7 @@ impl Liveness {
}
pub fn warn_about_unused(&self,
sp: span,
sp: Span,
id: NodeId,
ln: LiveNode,
var: Variable)
@ -1673,7 +1673,7 @@ impl Liveness {
}
pub fn warn_about_dead_assign(&self,
sp: span,
sp: Span,
id: NodeId,
ln: LiveNode,
var: Variable) {

View File

@ -54,7 +54,7 @@ use util::common::indenter;
use syntax::ast::{m_imm, m_mutbl};
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::print::pprust;
#[deriving(Eq)]
@ -134,7 +134,7 @@ pub enum MutabilityCategory {
#[deriving(Eq)]
pub struct cmt_ {
id: ast::NodeId, // id of expr/pat producing this value
span: span, // span of same expr/pat
span: Span, // span of same expr/pat
cat: categorization, // categorization of expr
mutbl: MutabilityCategory, // mutability of expr as lvalue
ty: ty::t // type of the expr (*see WARNING above*)
@ -256,7 +256,7 @@ pub fn cat_def(
tcx: ty::ctxt,
method_map: typeck::method_map,
expr_id: ast::NodeId,
expr_span: span,
expr_span: Span,
expr_ty: ty::t,
def: ast::def) -> cmt {
@ -268,17 +268,17 @@ pub fn cat_def(
pub trait ast_node {
fn id(&self) -> ast::NodeId;
fn span(&self) -> span;
fn span(&self) -> Span;
}
impl ast_node for @ast::expr {
fn id(&self) -> ast::NodeId { self.id }
fn span(&self) -> span { self.span }
fn span(&self) -> Span { self.span }
}
impl ast_node for @ast::pat {
fn id(&self) -> ast::NodeId { self.id }
fn span(&self) -> span { self.span }
fn span(&self) -> Span { self.span }
}
pub struct mem_categorization_ctxt {
@ -442,7 +442,7 @@ impl mem_categorization_ctxt {
pub fn cat_def(&self,
id: ast::NodeId,
span: span,
span: Span,
expr_ty: ty::t,
def: ast::def)
-> cmt {
@ -584,7 +584,7 @@ impl mem_categorization_ctxt {
pub fn cat_rvalue(&self,
cmt_id: ast::NodeId,
span: span,
span: Span,
cleanup_scope_id: ast::NodeId,
expr_ty: ty::t) -> cmt {
@cmt_ {

View File

@ -141,7 +141,7 @@ use syntax::ast::*;
use syntax::ast_util;
use syntax::visit;
use syntax::visit::Visitor;
use syntax::codemap::span;
use syntax::codemap::Span;
#[deriving(Encodable, Decodable)]
pub enum CaptureMode {
@ -153,7 +153,7 @@ pub enum CaptureMode {
#[deriving(Encodable, Decodable)]
pub struct CaptureVar {
def: def, // Variable being accessed free
span: span, // Location of an access to this variable
span: Span, // Location of an access to this variable
mode: CaptureMode // How variable is being accessed
}
@ -194,7 +194,7 @@ struct ComputeModesVisitor;
impl visit::Visitor<VisitContext> for ComputeModesVisitor {
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&fn_decl,
b:&Block, s:span, n:NodeId, e:VisitContext) {
b:&Block, s:Span, n:NodeId, e:VisitContext) {
compute_modes_for_fn(*self, fk, fd, b, s, n, e);
}
fn visit_expr(&mut self, ex:@expr, e:VisitContext) {
@ -250,7 +250,7 @@ fn compute_modes_for_fn(v: ComputeModesVisitor,
fk: &visit::fn_kind,
decl: &fn_decl,
body: &Block,
span: span,
span: Span,
id: NodeId,
cx: VisitContext) {
let mut v = v;

View File

@ -14,7 +14,7 @@ use middle::resolve;
use std::hashmap::HashMap;
use syntax::ast::*;
use syntax::ast_util::{path_to_ident, walk_pat};
use syntax::codemap::span;
use syntax::codemap::Span;
pub type PatIdMap = HashMap<ident, NodeId>;
@ -71,7 +71,7 @@ pub fn pat_is_binding_or_wild(dm: resolve::DefMap, pat: @pat) -> bool {
}
pub fn pat_bindings(dm: resolve::DefMap, pat: @pat,
it: &fn(binding_mode, NodeId, span, &Path)) {
it: &fn(binding_mode, NodeId, Span, &Path)) {
do walk_pat(pat) |p| {
match p.node {
pat_ident(binding_mode, ref pth, _) if pat_is_binding(dm, p) => {

View File

@ -31,7 +31,7 @@ use syntax::ast_map;
use syntax::ast_util::{Private, Public, is_local};
use syntax::ast_util::{variant_visibility_to_privacy, visibility_to_privacy};
use syntax::attr;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::parse::token;
use syntax::visit;
use syntax::visit::Visitor;
@ -79,7 +79,7 @@ impl PrivacyVisitor {
}
// Checks that an enum variant is in scope
fn check_variant(&mut self, span: span, enum_id: ast::def_id) {
fn check_variant(&mut self, span: Span, enum_id: ast::def_id) {
let variant_info = ty::enum_variants(self.tcx, enum_id)[0];
let parental_privacy = if is_local(enum_id) {
let parent_vis = ast_map::node_item_query(self.tcx.items,
@ -108,7 +108,7 @@ impl PrivacyVisitor {
}
// Returns true if a crate-local method is private and false otherwise.
fn method_is_private(&mut self, span: span, method_id: NodeId) -> bool {
fn method_is_private(&mut self, span: Span, method_id: NodeId) -> bool {
let check = |vis: visibility, container_id: def_id| {
let mut is_private = false;
if vis == private {
@ -171,7 +171,7 @@ impl PrivacyVisitor {
}
// Returns true if the given local item is private and false otherwise.
fn local_item_is_private(&mut self, span: span, item_id: NodeId) -> bool {
fn local_item_is_private(&mut self, span: Span, item_id: NodeId) -> bool {
let mut f: &fn(NodeId) -> bool = |_| false;
f = |item_id| {
match self.tcx.items.find(&item_id) {
@ -203,7 +203,7 @@ impl PrivacyVisitor {
}
// Checks that a private field is in scope.
fn check_field(&mut self, span: span, id: ast::def_id, ident: ast::ident) {
fn check_field(&mut self, span: Span, id: ast::def_id, ident: ast::ident) {
let fields = ty::lookup_struct_fields(self.tcx, id);
for field in fields.iter() {
if field.ident != ident { loop; }
@ -216,7 +216,7 @@ impl PrivacyVisitor {
}
// Given the ID of a method, checks to ensure it's in scope.
fn check_method_common(&mut self, span: span, method_id: def_id, name: &ident) {
fn check_method_common(&mut self, span: Span, method_id: def_id, name: &ident) {
// If the method is a default method, we need to use the def_id of
// the default implementation.
// Having to do this this is really unfortunate.
@ -245,7 +245,7 @@ impl PrivacyVisitor {
}
// Checks that a private path is in scope.
fn check_path(&mut self, span: span, def: def, path: &Path) {
fn check_path(&mut self, span: Span, def: def, path: &Path) {
debug!("checking path");
match def {
def_static_method(method_id, _, _) => {
@ -280,7 +280,7 @@ impl PrivacyVisitor {
}
// Checks that a private method is in scope.
fn check_method(&mut self, span: span, origin: &method_origin, ident: ast::ident) {
fn check_method(&mut self, span: Span, origin: &method_origin, ident: ast::ident) {
match *origin {
method_static(method_id) => {
self.check_method_common(span, method_id, &ident)
@ -343,7 +343,7 @@ impl PrivacyVisitor {
impl<'self> Visitor<&'self method_map> for PrivacyVisitor {
fn visit_mod<'mm>(&mut self, the_module:&_mod, _:span, _:NodeId,
fn visit_mod<'mm>(&mut self, the_module:&_mod, _:Span, _:NodeId,
method_map:&'mm method_map) {
let n_added = self.add_privileged_items(the_module.items);

View File

@ -30,7 +30,7 @@ use middle::ty;
use std::hashmap::{HashMap, HashSet};
use syntax::ast_map;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::print::pprust;
use syntax::parse::token;
use syntax::parse::token::special_idents;
@ -318,7 +318,7 @@ impl RegionMaps {
}
/// Records the current parent (if any) as the parent of `child_id`.
fn parent_to_expr(cx: Context, child_id: ast::NodeId, sp: span) {
fn parent_to_expr(cx: Context, child_id: ast::NodeId, sp: Span) {
debug!("region::parent_to_expr(span=%?)",
cx.sess.codemap.span_to_str(sp));
for parent_id in cx.parent.iter() {
@ -431,7 +431,7 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
sp: Span,
id: ast::NodeId,
cx: Context) {
debug!("region::resolve_fn(id=%?, \
@ -482,7 +482,7 @@ impl Visitor<Context> for RegionResolutionVisitor {
resolve_item(self, i, cx);
}
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, cx:Context) {
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, cx:Context) {
resolve_fn(self, fk, fd, b, s, n, cx);
}
fn visit_arm(&mut self, a:&arm, cx:Context) {
@ -744,7 +744,7 @@ fn determine_rp_in_fn(visitor: &mut DetermineRpVisitor,
fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
_: span,
_: Span,
_: ast::NodeId,
cx: @mut DetermineRpCtxt) {
do cx.with(cx.item_id, false) {
@ -911,7 +911,7 @@ struct DetermineRpVisitor;
impl Visitor<@mut DetermineRpCtxt> for DetermineRpVisitor {
fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl,
b:&Block, s:span, n:NodeId, e:@mut DetermineRpCtxt) {
b:&Block, s:Span, n:NodeId, e:@mut DetermineRpCtxt) {
determine_rp_in_fn(self, fk, fd, b, s, n, e);
}
fn visit_item(&mut self, i:@item, e:@mut DetermineRpCtxt) {

View File

@ -16,7 +16,7 @@ use metadata::csearch::get_static_methods_if_impl;
use metadata::csearch::{get_type_name_if_impl, get_struct_fields};
use metadata::csearch;
use metadata::cstore::find_extern_mod_stmt_cnum;
use metadata::decoder::{def_like, dl_def, dl_field, dl_impl};
use metadata::decoder::{DefLike, DlDef, DlField, DlImpl};
use middle::lang_items::LanguageItems;
use middle::lint::{unnecessary_qualification, unused_imports};
use middle::pat_util::pat_bindings;
@ -32,7 +32,7 @@ use syntax::parse::token;
use syntax::parse::token::ident_interner;
use syntax::parse::token::special_idents;
use syntax::print::pprust::path_to_str;
use syntax::codemap::{span, dummy_sp, BytePos};
use syntax::codemap::{Span, dummy_sp, BytePos};
use syntax::opt_vec::OptVec;
use syntax::visit;
use syntax::visit::Visitor;
@ -46,7 +46,7 @@ use std::util;
pub type DefMap = @mut HashMap<NodeId,def>;
pub struct binding_info {
span: span,
span: Span,
binding_mode: binding_mode,
}
@ -311,41 +311,44 @@ pub enum DuplicateCheckingMode {
/// One local scope.
pub struct Rib {
bindings: @mut HashMap<ident,def_like>,
self_binding: @mut Option<def_like>,
bindings: @mut HashMap<ident, DefLike>,
self_binding: @mut Option<DefLike>,
kind: RibKind,
}
pub fn Rib(kind: RibKind) -> Rib {
Rib {
bindings: @mut HashMap::new(),
self_binding: @mut None,
kind: kind
impl Rib {
pub fn new(kind: RibKind) -> Rib {
Rib {
bindings: @mut HashMap::new(),
self_binding: @mut None,
kind: kind
}
}
}
/// One import directive.
pub struct ImportDirective {
privacy: Privacy,
module_path: ~[ident],
subclass: @ImportDirectiveSubclass,
span: span,
span: Span,
id: NodeId,
}
pub fn ImportDirective(privacy: Privacy,
module_path: ~[ident],
subclass: @ImportDirectiveSubclass,
span: span,
id: NodeId)
-> ImportDirective {
ImportDirective {
privacy: privacy,
module_path: module_path,
subclass: subclass,
span: span,
id: id
impl ImportDirective {
pub fn new(privacy: Privacy,
module_path: ~[ident],
subclass: @ImportDirectiveSubclass,
span: Span,
id: NodeId)
-> ImportDirective {
ImportDirective {
privacy: privacy,
module_path: module_path,
subclass: subclass,
span: span,
id: id
}
}
}
@ -355,12 +358,14 @@ pub struct Target {
bindings: @mut NameBindings,
}
pub fn Target(target_module: @mut Module,
bindings: @mut NameBindings)
-> Target {
Target {
target_module: target_module,
bindings: bindings
impl Target {
pub fn new(target_module: @mut Module,
bindings: @mut NameBindings)
-> Target {
Target {
target_module: target_module,
bindings: bindings
}
}
}
@ -388,19 +393,19 @@ pub struct ImportResolution {
type_id: NodeId,
}
pub fn ImportResolution(privacy: Privacy,
id: NodeId) -> ImportResolution {
ImportResolution {
privacy: privacy,
type_id: id,
value_id: id,
outstanding_references: 0,
value_target: None,
type_target: None,
}
}
impl ImportResolution {
pub fn new(privacy: Privacy,
id: NodeId) -> ImportResolution {
ImportResolution {
privacy: privacy,
type_id: id,
value_id: id,
outstanding_references: 0,
value_target: None,
type_target: None,
}
}
pub fn target_for_namespace(&self, namespace: Namespace)
-> Option<Target> {
match namespace {
@ -478,27 +483,27 @@ pub struct Module {
populated: bool,
}
pub fn Module(parent_link: ParentLink,
def_id: Option<def_id>,
kind: ModuleKind,
external: bool)
-> Module {
Module {
parent_link: parent_link,
def_id: def_id,
kind: kind,
children: @mut HashMap::new(),
imports: @mut ~[],
external_module_children: @mut HashMap::new(),
anonymous_children: @mut HashMap::new(),
import_resolutions: @mut HashMap::new(),
glob_count: 0,
resolved_import_count: 0,
populated: !external,
}
}
impl Module {
pub fn new(parent_link: ParentLink,
def_id: Option<def_id>,
kind: ModuleKind,
external: bool)
-> Module {
Module {
parent_link: parent_link,
def_id: def_id,
kind: kind,
children: @mut HashMap::new(),
imports: @mut ~[],
external_module_children: @mut HashMap::new(),
anonymous_children: @mut HashMap::new(),
import_resolutions: @mut HashMap::new(),
glob_count: 0,
resolved_import_count: 0,
populated: !external,
}
}
pub fn all_imports_resolved(&self) -> bool {
let imports = &mut *self.imports;
return imports.len() == self.resolved_import_count;
@ -510,14 +515,14 @@ pub struct TypeNsDef {
privacy: Privacy,
module_def: Option<@mut Module>,
type_def: Option<def>,
type_span: Option<span>
type_span: Option<Span>
}
// Records a possibly-private value definition.
pub struct ValueNsDef {
privacy: Privacy,
def: def,
value_span: Option<span>,
value_span: Option<Span>,
}
// Records the definitions (at most one for each namespace) that a name is
@ -542,9 +547,9 @@ impl NameBindings {
def_id: Option<def_id>,
kind: ModuleKind,
external: bool,
sp: span) {
sp: Span) {
// Merges the module with the existing type def or creates a new one.
let module_ = @mut Module(parent_link, def_id, kind, external);
let module_ = @mut Module::new(parent_link, def_id, kind, external);
match self.type_def {
None => {
self.type_def = Some(TypeNsDef {
@ -572,10 +577,10 @@ impl NameBindings {
def_id: Option<def_id>,
kind: ModuleKind,
external: bool,
_sp: span) {
_sp: Span) {
match self.type_def {
None => {
let module = @mut Module(parent_link, def_id, kind, external);
let module = @mut Module::new(parent_link, def_id, kind, external);
self.type_def = Some(TypeNsDef {
privacy: privacy,
module_def: Some(module),
@ -586,7 +591,7 @@ impl NameBindings {
Some(type_def) => {
match type_def.module_def {
None => {
let module = @mut Module(parent_link,
let module = @mut Module::new(parent_link,
def_id,
kind,
external);
@ -604,7 +609,7 @@ impl NameBindings {
}
/// Records a type definition.
pub fn define_type(@mut self, privacy: Privacy, def: def, sp: span) {
pub fn define_type(@mut self, privacy: Privacy, def: def, sp: Span) {
// Merges the type with the existing type def or creates a new one.
match self.type_def {
None => {
@ -627,7 +632,7 @@ impl NameBindings {
}
/// Records a value definition.
pub fn define_value(@mut self, privacy: Privacy, def: def, sp: span) {
pub fn define_value(@mut self, privacy: Privacy, def: def, sp: Span) {
self.value_def = Some(ValueNsDef { privacy: privacy, def: def, value_span: Some(sp) });
}
@ -723,7 +728,7 @@ impl NameBindings {
}
}
pub fn span_for_namespace(&self, namespace: Namespace) -> Option<span> {
pub fn span_for_namespace(&self, namespace: Namespace) -> Option<Span> {
if self.defined_in_namespace(namespace) {
match namespace {
TypeNS => {
@ -1016,7 +1021,7 @@ impl Resolver {
reduced_graph_parent: ReducedGraphParent,
duplicate_checking_mode: DuplicateCheckingMode,
// For printing errors
sp: span)
sp: Span)
-> (@mut NameBindings, ReducedGraphParent) {
// If this is the immediate descendant of a module, then we add the
// child name directly. Otherwise, we create or reuse an anonymous
@ -1571,7 +1576,7 @@ impl Resolver {
let def_id = def_id { crate: crate_id, node: 0 };
let parent_link = ModuleParentLink
(self.get_module_from_parent(parent), name);
let external_module = @mut Module(parent_link,
let external_module = @mut Module::new(parent_link,
Some(def_id),
NormalModuleKind,
false);
@ -1635,7 +1640,7 @@ impl Resolver {
block_id);
let parent_module = self.get_module_from_parent(parent);
let new_module = @mut Module(
let new_module = @mut Module::new(
BlockParentLink(parent_module, block_id),
None,
AnonymousModuleKind,
@ -1777,10 +1782,10 @@ impl Resolver {
/// Builds the reduced graph for a single item in an external crate.
fn build_reduced_graph_for_external_crate_def(@mut self,
root: @mut Module,
def_like: def_like,
def_like: DefLike,
ident: ident) {
match def_like {
dl_def(def) => {
DlDef(def) => {
// Add the new child item, if necessary.
match def {
def_foreign_mod(def_id) => {
@ -1811,7 +1816,7 @@ impl Resolver {
}
}
}
dl_impl(def) => {
DlImpl(def) => {
// We only process static methods of impls here.
match get_type_name_if_impl(self.session.cstore, def) {
None => {}
@ -1900,7 +1905,7 @@ impl Resolver {
}
}
}
dl_field => {
DlField => {
debug!("(building reduced graph for external crate) \
ignoring field");
}
@ -1959,9 +1964,9 @@ impl Resolver {
module_: @mut Module,
module_path: ~[ident],
subclass: @ImportDirectiveSubclass,
span: span,
span: Span,
id: NodeId) {
let directive = @ImportDirective(privacy, module_path,
let directive = @ImportDirective::new(privacy, module_path,
subclass, span, id);
module_.imports.push(directive);
@ -1989,7 +1994,7 @@ impl Resolver {
}
None => {
debug!("(building import directive) creating new");
let resolution = @mut ImportResolution(privacy, id);
let resolution = @mut ImportResolution::new(privacy, id);
resolution.outstanding_references = 1;
module_.import_resolutions.insert(target, resolution);
}
@ -2402,7 +2407,7 @@ impl Resolver {
BoundResult(target_module, name_bindings) => {
debug!("(resolving single import) found value target");
import_resolution.value_target =
Some(Target(target_module, name_bindings));
Some(Target::new(target_module, name_bindings));
import_resolution.value_id = directive.id;
}
UnboundResult => { /* Continue. */ }
@ -2415,7 +2420,7 @@ impl Resolver {
debug!("(resolving single import) found type target: %?",
name_bindings.type_def.unwrap().type_def);
import_resolution.type_target =
Some(Target(target_module, name_bindings));
Some(Target::new(target_module, name_bindings));
import_resolution.type_id = directive.id;
}
UnboundResult => { /* Continue. */ }
@ -2522,7 +2527,7 @@ impl Resolver {
None if target_import_resolution.privacy == Public => {
// Simple: just copy the old import resolution.
let new_import_resolution =
@mut ImportResolution(privacy, id);
@mut ImportResolution::new(privacy, id);
new_import_resolution.value_target =
target_import_resolution.value_target;
new_import_resolution.type_target =
@ -2564,7 +2569,7 @@ impl Resolver {
match module_.import_resolutions.find(&ident) {
None => {
// Create a new import resolution from this child.
dest_import_resolution = @mut ImportResolution(privacy, id);
dest_import_resolution = @mut ImportResolution::new(privacy, id);
module_.import_resolutions.insert
(ident, dest_import_resolution);
}
@ -2584,13 +2589,13 @@ impl Resolver {
if name_bindings.defined_in_public_namespace(ValueNS) {
debug!("(resolving glob import) ... for value target");
dest_import_resolution.value_target =
Some(Target(containing_module, name_bindings));
Some(Target::new(containing_module, name_bindings));
dest_import_resolution.value_id = id;
}
if name_bindings.defined_in_public_namespace(TypeNS) {
debug!("(resolving glob import) ... for type target");
dest_import_resolution.type_target =
Some(Target(containing_module, name_bindings));
Some(Target::new(containing_module, name_bindings));
dest_import_resolution.type_id = id;
}
};
@ -2617,7 +2622,7 @@ impl Resolver {
module_: @mut Module,
module_path: &[ident],
index: uint,
span: span,
span: Span,
mut name_search_type: NameSearchType)
-> ResolveResult<@mut Module> {
let mut search_module = module_;
@ -2637,7 +2642,7 @@ impl Resolver {
let segment_name = self.session.str_of(name);
let module_name = self.module_to_str(search_module);
if "???" == module_name {
let span = span {
let span = Span {
lo: span.lo,
hi: span.lo + BytePos(segment_name.len()),
expn_info: span.expn_info,
@ -2726,7 +2731,7 @@ impl Resolver {
module_: @mut Module,
module_path: &[ident],
use_lexical_scope: UseLexicalScopeFlag,
span: span,
span: Span,
name_search_type: NameSearchType)
-> ResolveResult<@mut Module> {
let module_path_len = module_path.len();
@ -2834,7 +2839,7 @@ impl Resolver {
match module_.children.find(&name) {
Some(name_bindings)
if name_bindings.defined_in_namespace(namespace) => {
return Success(Target(module_, *name_bindings));
return Success(Target::new(module_, *name_bindings));
}
Some(_) | None => { /* Not found; continue. */ }
}
@ -2873,7 +2878,7 @@ impl Resolver {
let name_bindings =
@mut Resolver::create_name_bindings_from_module(
*module);
return Success(Target(module_, name_bindings));
return Success(Target::new(module_, name_bindings));
}
}
}
@ -3090,7 +3095,7 @@ impl Resolver {
Some(name_bindings)
if name_bindings.defined_in_namespace(namespace) => {
debug!("(resolving name in module) found node as child");
return Success(Target(module_, *name_bindings));
return Success(Target::new(module_, *name_bindings));
}
Some(_) | None => {
// Continue.
@ -3148,7 +3153,7 @@ impl Resolver {
let name_bindings =
@mut Resolver::create_name_bindings_from_module(
*module);
return Success(Target(module_, name_bindings));
return Success(Target::new(module_, name_bindings));
}
}
}
@ -3382,24 +3387,24 @@ impl Resolver {
pub fn upvarify(@mut self,
ribs: &mut ~[@Rib],
rib_index: uint,
def_like: def_like,
span: span,
def_like: DefLike,
span: Span,
allow_capturing_self: AllowCapturingSelfFlag)
-> Option<def_like> {
-> Option<DefLike> {
let mut def;
let is_ty_param;
match def_like {
dl_def(d @ def_local(*)) | dl_def(d @ def_upvar(*)) |
dl_def(d @ def_arg(*)) | dl_def(d @ def_binding(*)) => {
DlDef(d @ def_local(*)) | DlDef(d @ def_upvar(*)) |
DlDef(d @ def_arg(*)) | DlDef(d @ def_binding(*)) => {
def = d;
is_ty_param = false;
}
dl_def(d @ def_ty_param(*)) => {
DlDef(d @ def_ty_param(*)) => {
def = d;
is_ty_param = true;
}
dl_def(d @ def_self(*))
DlDef(d @ def_self(*))
if allow_capturing_self == DontAllowCapturingSelf => {
def = d;
is_ty_param = false;
@ -3488,15 +3493,15 @@ impl Resolver {
rib_index += 1;
}
return Some(dl_def(def));
return Some(DlDef(def));
}
pub fn search_ribs(@mut self,
ribs: &mut ~[@Rib],
name: ident,
span: span,
span: Span,
allow_capturing_self: AllowCapturingSelfFlag)
-> Option<def_like> {
-> Option<DefLike> {
// FIXME #4950: This should not use a while loop.
// FIXME #4950: Try caching?
@ -3584,10 +3589,10 @@ impl Resolver {
item_trait(ref generics, ref traits, ref methods) => {
// Create a new rib for the self type.
let self_type_rib = @Rib(NormalRibKind);
let self_type_rib = @Rib::new(NormalRibKind);
self.type_ribs.push(self_type_rib);
self_type_rib.bindings.insert(self.type_self_ident,
dl_def(def_self_ty(item.id)));
DlDef(def_self_ty(item.id)));
// Create a new rib for the trait-wide type parameters.
do self.with_type_parameter_rib
@ -3714,14 +3719,14 @@ impl Resolver {
HasTypeParameters(generics, node_id, initial_index,
rib_kind) => {
let function_type_rib = @Rib(rib_kind);
let function_type_rib = @Rib::new(rib_kind);
self.type_ribs.push(function_type_rib);
for (index, type_parameter) in generics.ty_params.iter().enumerate() {
let name = type_parameter.ident;
debug!("with_type_parameter_rib: %d %d", node_id,
type_parameter.id);
let def_like = dl_def(def_ty_param
let def_like = DlDef(def_ty_param
(local_def(type_parameter.id),
index + initial_index));
// Associate this type parameter with
@ -3751,13 +3756,13 @@ impl Resolver {
}
pub fn with_label_rib(@mut self, f: &fn()) {
self.label_ribs.push(@Rib(NormalRibKind));
self.label_ribs.push(@Rib::new(NormalRibKind));
f();
self.label_ribs.pop();
}
pub fn with_constant_rib(@mut self, f: &fn()) {
self.value_ribs.push(@Rib(ConstantItemRibKind));
self.value_ribs.push(@Rib::new(ConstantItemRibKind));
f();
self.value_ribs.pop();
}
@ -3770,11 +3775,11 @@ impl Resolver {
self_binding: SelfBinding,
visitor: &mut ResolveVisitor) {
// Create a value rib for the function.
let function_value_rib = @Rib(rib_kind);
let function_value_rib = @Rib::new(rib_kind);
self.value_ribs.push(function_value_rib);
// Create a label rib for the function.
let function_label_rib = @Rib(rib_kind);
let function_label_rib = @Rib::new(rib_kind);
self.label_ribs.push(function_label_rib);
// If this function has type parameters, add them now.
@ -3796,7 +3801,7 @@ impl Resolver {
// Nothing to do.
}
HasSelfBinding(self_node_id) => {
let def_like = dl_def(def_self(self_node_id));
let def_like = DlDef(def_self(self_node_id));
*function_value_rib.self_binding = Some(def_like);
}
}
@ -4029,7 +4034,7 @@ impl Resolver {
pub fn resolve_module(@mut self,
module_: &_mod,
_span: span,
_span: Span,
_name: ident,
id: NodeId,
visitor: &mut ResolveVisitor) {
@ -4110,7 +4115,7 @@ impl Resolver {
}
pub fn resolve_arm(@mut self, arm: &arm, visitor: &mut ResolveVisitor) {
self.value_ribs.push(@Rib(NormalRibKind));
self.value_ribs.push(@Rib::new(NormalRibKind));
let bindings_list = @mut HashMap::new();
for pattern in arm.pats.iter() {
@ -4130,7 +4135,7 @@ impl Resolver {
pub fn resolve_block(@mut self, block: &Block, visitor: &mut ResolveVisitor) {
debug!("(resolving block) entering block");
self.value_ribs.push(@Rib(NormalRibKind));
self.value_ribs.push(@Rib::new(NormalRibKind));
// Move down in the graph, if there's an anonymous module rooted here.
let orig_module = self.current_module;
@ -4366,7 +4371,7 @@ impl Resolver {
let last_rib = this.value_ribs[
this.value_ribs.len() - 1];
last_rib.bindings.insert(ident,
dl_def(def));
DlDef(def));
bindings_list.insert(ident, pat_id);
}
Some(b) => {
@ -4387,7 +4392,7 @@ impl Resolver {
let last_rib = this.value_ribs[
this.value_ribs.len() - 1];
last_rib.bindings.insert(ident,
dl_def(def));
DlDef(def));
}
}
}
@ -4602,7 +4607,7 @@ impl Resolver {
identifier: ident,
namespace: Namespace,
check_ribs: bool,
span: span)
span: Span)
-> Option<def> {
if check_ribs {
match self.resolve_identifier_in_local_ribs(identifier,
@ -4826,7 +4831,7 @@ impl Resolver {
pub fn resolve_identifier_in_local_ribs(@mut self,
ident: ident,
namespace: Namespace,
span: span)
span: Span)
-> Option<def> {
// Check the local set of ribs.
let search_result;
@ -4843,20 +4848,20 @@ impl Resolver {
}
match search_result {
Some(dl_def(def)) => {
Some(DlDef(def)) => {
debug!("(resolving path in local ribs) resolved `%s` to \
local: %?",
self.session.str_of(ident),
def);
return Some(def);
}
Some(dl_field) | Some(dl_impl(_)) | None => {
Some(DlField) | Some(DlImpl(_)) | None => {
return None;
}
}
}
pub fn resolve_self_value_in_local_ribs(@mut self, span: span)
pub fn resolve_self_value_in_local_ribs(@mut self, span: Span)
-> Option<def> {
// FIXME #4950: This should not use a while loop.
let ribs = &mut self.value_ribs;
@ -4870,7 +4875,7 @@ impl Resolver {
def_like,
span,
DontAllowCapturingSelf) {
Some(dl_def(def)) => return Some(def),
Some(DlDef(def)) => return Some(def),
_ => {
if self.session.has_errors() {
// May happen inside a nested fn item, cf #6642.
@ -4929,7 +4934,7 @@ impl Resolver {
rs
}
fn resolve_error(@mut self, span: span, s: &str) {
fn resolve_error(@mut self, span: Span, s: &str) {
if self.emit_errors {
self.session.span_err(span, s);
}
@ -5135,7 +5140,7 @@ impl Resolver {
do self.with_label_rib {
{
let this = &mut *self;
let def_like = dl_def(def_label(expr.id));
let def_like = DlDef(def_label(expr.id));
let rib = this.label_ribs[this.label_ribs.len() - 1];
rib.bindings.insert(label, def_like);
}
@ -5155,7 +5160,7 @@ impl Resolver {
`%s`",
self.session.str_of(
label))),
Some(dl_def(def @ def_label(_))) => {
Some(DlDef(def @ def_label(_))) => {
self.record_def(expr.id, def)
}
Some(_) => {

View File

@ -21,7 +21,7 @@ use middle::ty;
use syntax::ast;
use syntax::ast_map;
use syntax::attr;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::visit;
use syntax::visit::Visitor;
use util::ppaux::Repr;
@ -39,7 +39,7 @@ impl Visitor<Context> for StackCheckVisitor {
stack_check_item(*self, i, e);
}
fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl,
b:&ast::Block, s:span, n:ast::NodeId, e:Context) {
b:&ast::Block, s:Span, n:ast::NodeId, e:Context) {
stack_check_fn(*self, fk, fd, b, s, n, e);
}
fn visit_expr(&mut self, ex:@ast::expr, e:Context) {
@ -94,7 +94,7 @@ fn stack_check_fn<'a>(v: StackCheckVisitor,
fk: &visit::fn_kind,
decl: &ast::fn_decl,
body: &ast::Block,
sp: span,
sp: Span,
id: ast::NodeId,
in_cx: Context) {
let safe_stack = match *fk {

View File

@ -225,7 +225,7 @@ use syntax::ast;
use syntax::ast::ident;
use syntax::ast_util::path_to_ident;
use syntax::ast_util;
use syntax::codemap::{span, dummy_sp};
use syntax::codemap::{Span, dummy_sp};
// An option identifying a literal: either a unit-like struct or an
// expression.
@ -386,7 +386,7 @@ struct BindingInfo {
llmatch: ValueRef,
trmode: TransBindingMode,
id: ast::NodeId,
span: span,
span: Span,
ty: ty::t,
}
@ -1014,7 +1014,7 @@ fn match_datum(bcx: @mut Block, val: ValueRef, pat_id: ast::NodeId) -> Datum {
fn extract_vec_elems(bcx: @mut Block,
pat_span: span,
pat_span: Span,
pat_id: ast::NodeId,
elem_count: uint,
slice: Option<uint>,
@ -1891,7 +1891,7 @@ fn trans_match_inner(scope_cx: @mut Block,
bcx = controlflow::join_blocks(scope_cx, arm_cxs);
return bcx;
fn mk_fail(bcx: @mut Block, sp: span, msg: @str,
fn mk_fail(bcx: @mut Block, sp: Span, msg: @str,
finished: @mut Option<BasicBlockRef>) -> BasicBlockRef {
match *finished { Some(bb) => return bb, _ => () }
let fail_cx = sub_block(bcx, "case_fallthrough");

View File

@ -81,7 +81,7 @@ use syntax::ast_map::{path, path_elt_to_str, path_name};
use syntax::ast_util::{local_def};
use syntax::attr;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::parse::token;
use syntax::parse::token::{special_idents};
use syntax::print::pprust::stmt_to_str;
@ -138,7 +138,7 @@ fn fcx_has_nonzero_span(fcx: &FunctionContext) -> bool {
}
}
fn span_is_empty(opt_span: &Option<span>) -> bool {
fn span_is_empty(opt_span: &Option<Span>) -> bool {
match *opt_span {
None => true,
Some(span) => *span.lo == 0 && *span.hi == 0
@ -791,7 +791,7 @@ pub fn cast_shift_rhs(op: ast::binop,
}
}
pub fn fail_if_zero(cx: @mut Block, span: span, divrem: ast::binop,
pub fn fail_if_zero(cx: @mut Block, span: Span, divrem: ast::binop,
rhs: ValueRef, rhs_t: ty::t) -> @mut Block {
let text = if divrem == ast::div {
@"attempted to divide by zero"
@ -1064,7 +1064,7 @@ pub fn load_if_immediate(cx: @mut Block, v: ValueRef, t: ty::t) -> ValueRef {
return v;
}
pub fn trans_trace(bcx: @mut Block, sp_opt: Option<span>, trace_str: @str) {
pub fn trans_trace(bcx: @mut Block, sp_opt: Option<Span>, trace_str: @str) {
if !bcx.sess().trace() { return; }
let _icx = push_ctxt("trans_trace");
add_comment(bcx, trace_str);
@ -1615,7 +1615,7 @@ pub fn new_fn_ctxt_w_id(ccx: @mut CrateContext,
skip_retptr: bool,
param_substs: Option<@param_substs>,
opt_node_info: Option<NodeInfo>,
sp: Option<span>)
sp: Option<Span>)
-> @mut FunctionContext {
for p in param_substs.iter() { p.validate(); }
@ -1690,7 +1690,7 @@ pub fn new_fn_ctxt(ccx: @mut CrateContext,
path: path,
llfndecl: ValueRef,
output_type: ty::t,
sp: Option<span>)
sp: Option<Span>)
-> @mut FunctionContext {
new_fn_ctxt_w_id(ccx, path, llfndecl, -1, output_type, false, None, None, sp)
}
@ -2283,7 +2283,7 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) {
}
pub fn register_fn(ccx: @mut CrateContext,
sp: span,
sp: Span,
sym: ~str,
node_id: ast::NodeId,
node_type: ty::t)
@ -2293,7 +2293,7 @@ pub fn register_fn(ccx: @mut CrateContext,
}
pub fn register_fn_llvmty(ccx: @mut CrateContext,
sp: span,
sp: Span,
sym: ~str,
node_id: ast::NodeId,
cc: lib::llvm::CallConv,
@ -2309,7 +2309,7 @@ pub fn register_fn_llvmty(ccx: @mut CrateContext,
// FIXME #4404 android JNI hacks
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
(*ccx.sess.building_library &&
ccx.sess.targ_cfg.os == session::os_android));
ccx.sess.targ_cfg.os == session::OsAndroid));
if is_entry {
create_entry_wrapper(ccx, sp, llfn);
}
@ -2326,7 +2326,7 @@ pub fn is_entry_fn(sess: &Session, node_id: ast::NodeId) -> bool {
// Create a _rust_main(args: ~[str]) function which will be called from the
// runtime rust_start function
pub fn create_entry_wrapper(ccx: @mut CrateContext,
_sp: span,
_sp: Span,
main_llfn: ValueRef) {
let et = ccx.sess.entry_type.unwrap();
match et {

View File

@ -15,7 +15,7 @@ use lib::llvm::{Opcode, IntPredicate, RealPredicate};
use lib::llvm::{ValueRef, BasicBlockRef};
use lib;
use middle::trans::common::*;
use syntax::codemap::span;
use syntax::codemap::Span;
use middle::trans::builder::Builder;
use middle::trans::type_::Type;
@ -629,7 +629,7 @@ pub fn _UndefReturn(cx: @mut Block, Fn: ValueRef) -> ValueRef {
}
}
pub fn add_span_comment(cx: @mut Block, sp: span, text: &str) {
pub fn add_span_comment(cx: @mut Block, sp: Span, text: &str) {
B(cx).add_span_comment(sp, text)
}

View File

@ -21,7 +21,7 @@ use std::cast;
use std::hashmap::HashMap;
use std::libc::{c_uint, c_ulonglong, c_char};
use std::vec;
use syntax::codemap::span;
use syntax::codemap::Span;
use std::ptr::is_not_null;
pub struct Builder {
@ -728,7 +728,7 @@ impl Builder {
}
}
pub fn add_span_comment(&self, sp: span, text: &str) {
pub fn add_span_comment(&self, sp: Span, text: &str) {
if self.ccx.sess.asm_comments() {
let s = fmt!("%s (%s)", text, self.ccx.sess.codemap.span_to_str(sp));
debug!("%s", s);

View File

@ -9,7 +9,7 @@
// except according to those terms.
use driver::session::{os_win32, os_macos};
use driver::session::{OsWin32, OsMacos};
use lib::llvm::*;
use super::cabi::*;
use super::common::*;
@ -42,7 +42,7 @@ pub fn compute_abi_info(ccx: &mut CrateContext,
enum Strategy { RetValue(Type), RetPointer }
let strategy = match ccx.sess.targ_cfg.os {
os_win32 | os_macos => {
OsWin32 | OsMacos => {
match llsize_of_alloc(ccx, rty) {
1 => RetValue(Type::i8()),
2 => RetValue(Type::i16()),

View File

@ -40,7 +40,7 @@ use std::libc::{c_uint, c_longlong, c_ulonglong, c_char};
use std::vec;
use syntax::ast::ident;
use syntax::ast_map::{path, path_elt};
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::parse::token;
use syntax::{ast, ast_map};
@ -220,7 +220,7 @@ pub struct FunctionContext {
// The source span and nesting context where this function comes from, for
// error reporting and symbol generation.
span: Option<span>,
span: Option<Span>,
path: path,
// This function's enclosing crate context.
@ -509,7 +509,7 @@ impl get_node_info for Option<@ast::expr> {
pub struct NodeInfo {
id: ast::NodeId,
callee_id: Option<ast::NodeId>,
span: span
span: Span
}
// Basic block context. We create a block context for each basic block
@ -1110,7 +1110,7 @@ pub fn dummy_substs(tps: ~[ty::t]) -> ty::substs {
}
pub fn filename_and_line_num_from_span(bcx: @mut Block,
span: span) -> (ValueRef, ValueRef) {
span: Span) -> (ValueRef, ValueRef) {
let loc = bcx.sess().parse_sess.cm.lookup_char_pos(span.lo);
let filename_cstr = C_cstr(bcx.ccx(), loc.file.name);
let filename = build::PointerCast(bcx, filename_cstr, Type::i8p());
@ -1123,7 +1123,7 @@ pub fn bool_to_i1(bcx: @mut Block, llval: ValueRef) -> ValueRef {
build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(false))
}
pub fn langcall(bcx: @mut Block, span: Option<span>, msg: &str,
pub fn langcall(bcx: @mut Block, span: Option<Span>, msg: &str,
li: LangItem) -> ast::def_id {
match bcx.tcx().lang_items.require(li) {
Ok(id) => id,

View File

@ -30,7 +30,7 @@ use syntax::ast;
use syntax::ast::ident;
use syntax::ast_map::path_mod;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap::Span;
pub fn trans_block(bcx: @mut Block, b: &ast::Block, dest: expr::Dest) -> @mut Block {
let _icx = push_ctxt("trans_block");
@ -353,7 +353,7 @@ pub fn trans_ret(bcx: @mut Block, e: Option<@ast::expr>) -> @mut Block {
}
pub fn trans_fail_expr(bcx: @mut Block,
sp_opt: Option<span>,
sp_opt: Option<Span>,
fail_expr: Option<@ast::expr>)
-> @mut Block {
let _icx = push_ctxt("trans_fail_expr");
@ -381,7 +381,7 @@ pub fn trans_fail_expr(bcx: @mut Block,
}
pub fn trans_fail(bcx: @mut Block,
sp_opt: Option<span>,
sp_opt: Option<Span>,
fail_str: @str)
-> @mut Block {
let _icx = push_ctxt("trans_fail");
@ -390,7 +390,7 @@ pub fn trans_fail(bcx: @mut Block,
}
fn trans_fail_value(bcx: @mut Block,
sp_opt: Option<span>,
sp_opt: Option<Span>,
V_fail_str: ValueRef)
-> @mut Block {
let _icx = push_ctxt("trans_fail_value");
@ -415,7 +415,7 @@ fn trans_fail_value(bcx: @mut Block,
return bcx;
}
pub fn trans_fail_bounds_check(bcx: @mut Block, sp: span,
pub fn trans_fail_bounds_check(bcx: @mut Block, sp: Span,
index: ValueRef, len: ValueRef) -> @mut Block {
let _icx = push_ctxt("trans_fail_bounds_check");
let (filename, line) = filename_and_line_num_from_span(bcx, sp);

View File

@ -106,7 +106,7 @@ use util::ppaux::ty_to_str;
use std::uint;
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::parse::token::special_idents;
#[deriving(Eq)]
@ -613,7 +613,7 @@ impl Datum {
/// is_auto: If true, only deref if auto-derefable.
pub fn try_deref(&self,
bcx: @mut Block,
span: span,
span: Span,
expr_id: ast::NodeId,
derefs: uint,
is_auto: bool)
@ -739,7 +739,7 @@ impl Datum {
pub fn autoderef(&self,
bcx: @mut Block,
span: span,
span: Span,
expr_id: ast::NodeId,
max: uint)
-> DatumBlock {
@ -772,7 +772,7 @@ impl Datum {
pub fn get_vec_base_and_len(&self,
mut bcx: @mut Block,
span: span,
span: Span,
expr_id: ast::NodeId,
derefs: uint)
-> (@mut Block, ValueRef, ValueRef) {
@ -796,7 +796,7 @@ impl Datum {
pub fn root_and_write_guard(&self,
bcx: @mut Block,
span: span,
span: Span,
expr_id: ast::NodeId,
derefs: uint)
-> @mut Block {

View File

@ -68,7 +68,7 @@ use std::hashmap::HashMap;
use std::libc::{c_uint, c_ulonglong, c_longlong};
use std::ptr;
use std::vec;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::{ast, codemap, ast_util, ast_map, opt_vec};
use syntax::parse::token::special_idents;
@ -158,7 +158,7 @@ pub fn create_match_binding_metadata(bcx: @mut Block,
variable_ident: ast::ident,
node_id: ast::NodeId,
variable_type: ty::t,
span: span) {
span: Span) {
declare_local(bcx, variable_ident, node_id, variable_type, span);
}
@ -296,7 +296,7 @@ pub fn create_argument_metadata(bcx: @mut Block,
/// reliably find the correct visibility scope for the code position.
pub fn set_source_location(fcx: &FunctionContext,
node_id: ast::NodeId,
span: span) {
span: Span) {
let cx: &mut CrateContext = fcx.ccx;
if !cx.sess.opts.debuginfo || (*span.lo == 0 && *span.hi == 0) {
@ -643,7 +643,7 @@ fn declare_local(bcx: @mut Block,
variable_ident: ast::ident,
node_id: ast::NodeId,
variable_type: ty::t,
span: span) {
span: Span) {
let cx: &mut CrateContext = bcx.ccx();
let filename = span_start(cx, span).file.name;
@ -720,7 +720,7 @@ fn file_metadata(cx: &mut CrateContext, full_path: &str) -> DIFile {
/// Finds the scope metadata node for the given AST node.
fn scope_metadata(fcx: &FunctionContext,
node_id: ast::NodeId,
span: span) -> DIScope {
span: Span) -> DIScope {
if fcx.debug_context.is_none() {
fcx.ccx.sess.span_bug(span, "debuginfo: FunctionDebugContext should be initialized \
but is not!");
@ -808,7 +808,7 @@ fn pointer_type_metadata(cx: &mut CrateContext,
fn struct_metadata(cx: &mut CrateContext,
struct_type: ty::t,
fields: ~[ty::field],
span: span)
span: Span)
-> DICompositeType {
let struct_name = ty_to_str(cx.tcx, struct_type);
debug!("struct_metadata: %s", struct_name);
@ -840,7 +840,7 @@ fn struct_metadata(cx: &mut CrateContext,
fn tuple_metadata(cx: &mut CrateContext,
tuple_type: ty::t,
component_types: &[ty::t],
span: span)
span: Span)
-> DICompositeType {
let tuple_name = ty_to_str(cx.tcx, tuple_type);
@ -865,7 +865,7 @@ fn tuple_metadata(cx: &mut CrateContext,
fn enum_metadata(cx: &mut CrateContext,
enum_type: ty::t,
enum_def_id: ast::def_id,
span: span)
span: Span)
-> DIType {
let enum_name = ty_to_str(cx.tcx, enum_type);
@ -987,7 +987,7 @@ fn enum_metadata(cx: &mut CrateContext,
struct_def: &adt::Struct,
variant_info: &ty::VariantInfo,
discriminant_type_metadata: Option<DIType>,
span: span)
span: Span)
-> DICompositeType
{
let arg_llvm_types: ~[Type] = do struct_def.fields.map |&ty| { type_of::type_of(cx, ty) };
@ -1031,7 +1031,7 @@ fn composite_type_metadata(cx: &mut CrateContext,
member_llvm_types: &[Type],
member_names: &[~str],
member_type_metadata: &[DIType],
span: span)
span: Span)
-> DICompositeType {
let loc = span_start(cx, span);
@ -1088,7 +1088,7 @@ fn boxed_type_metadata(cx: &mut CrateContext,
content_type_name: Option<&str>,
content_llvm_type: Type,
content_type_metadata: DIType,
span: span)
span: Span)
-> DICompositeType {
let box_type_name = match content_type_name {
@ -1140,7 +1140,7 @@ fn boxed_type_metadata(cx: &mut CrateContext,
fn fixed_vec_metadata(cx: &mut CrateContext,
element_type: ty::t,
len: uint,
span: span)
span: Span)
-> DIType {
let element_type_metadata = type_metadata(cx, element_type, span);
let element_llvm_type = type_of::type_of(cx, element_type);
@ -1166,7 +1166,7 @@ fn fixed_vec_metadata(cx: &mut CrateContext,
fn vec_metadata(cx: &mut CrateContext,
element_type: ty::t,
span: span)
span: Span)
-> DICompositeType {
let element_type_metadata = type_metadata(cx, element_type, span);
@ -1204,7 +1204,7 @@ fn vec_metadata(cx: &mut CrateContext,
fn boxed_vec_metadata(cx: &mut CrateContext,
element_type: ty::t,
span: span)
span: Span)
-> DICompositeType {
let element_llvm_type = type_of::type_of(cx, element_type);
@ -1223,7 +1223,7 @@ fn boxed_vec_metadata(cx: &mut CrateContext,
fn vec_slice_metadata(cx: &mut CrateContext,
vec_type: ty::t,
element_type: ty::t,
span: span)
span: Span)
-> DICompositeType {
debug!("vec_slice_metadata: %?", ty::get(vec_type));
@ -1264,7 +1264,7 @@ fn bare_fn_metadata(cx: &mut CrateContext,
_fn_ty: ty::t,
inputs: ~[ty::t],
output: ty::t,
span: span)
span: Span)
-> DICompositeType {
debug!("bare_fn_metadata: %?", ty::get(_fn_ty));
@ -1307,7 +1307,7 @@ fn unimplemented_type_metadata(cx: &mut CrateContext, t: ty::t) -> DIType {
fn type_metadata(cx: &mut CrateContext,
t: ty::t,
span: span)
span: Span)
-> DIType {
let type_id = ty::type_id(t);
match dbg_cx(cx).created_types.find(&type_id) {
@ -1493,7 +1493,7 @@ fn roundup(x: uint, a: uint) -> uint {
}
/// Return codemap::Loc corresponding to the beginning of the span
fn span_start(cx: &CrateContext, span: span) -> codemap::Loc {
fn span_start(cx: &CrateContext, span: Span) -> codemap::Loc {
cx.sess.codemap.lookup_char_pos(span.lo)
}
@ -1561,7 +1561,7 @@ fn populate_scope_map(cx: &mut CrateContext,
// local helper functions for walking the AST.
fn with_new_scope(cx: &mut CrateContext,
scope_span: span,
scope_span: Span,
scope_stack: &mut ~[ScopeStackEntry],
scope_map: &mut HashMap<ast::NodeId, DIScope>,
inner_walk: &fn(&mut CrateContext,
@ -1625,7 +1625,7 @@ fn populate_scope_map(cx: &mut CrateContext,
scope_stack: &mut ~[ScopeStackEntry],
scope_map: &mut HashMap<ast::NodeId, DIScope>) {
match *decl {
codemap::spanned { node: ast::decl_local(@ref local), _ } => {
codemap::Spanned { node: ast::decl_local(@ref local), _ } => {
scope_map.insert(local.id, scope_stack.last().scope_metadata);
walk_pattern(cx, local.pat, scope_stack, scope_map);

View File

@ -680,7 +680,7 @@ fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: @ast::expr,
args.iter().enumerate().map(|(i, arg)| (i, *arg)).collect();
return trans_adt(bcx, repr, 0, numbered_fields, None, dest);
}
ast::expr_lit(@codemap::spanned {node: ast::lit_str(s), _}) => {
ast::expr_lit(@codemap::Spanned {node: ast::lit_str(s), _}) => {
return tvec::trans_lit_str(bcx, expr, s, dest);
}
ast::expr_vstore(contents, ast::expr_vstore_slice) |
@ -1163,7 +1163,7 @@ pub fn with_field_tys<R>(tcx: ty::ctxt,
fn trans_rec_or_struct(bcx: @mut Block,
fields: &[ast::Field],
base: Option<@ast::expr>,
expr_span: codemap::span,
expr_span: codemap::Span,
id: ast::NodeId,
dest: Dest) -> @mut Block
{

View File

@ -29,7 +29,7 @@ use middle::ty::FnSig;
use std::uint;
use std::vec;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::{ast};
use syntax::{attr, ast_map};
use syntax::parse::token::special_idents;
@ -350,7 +350,7 @@ pub fn trans_foreign_mod(ccx: @mut CrateContext,
// correct code in the first place, but this is much simpler.
pub fn register_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
sp: span,
sp: Span,
sym: ~str,
node_id: ast::NodeId)
-> ValueRef {

View File

@ -205,7 +205,7 @@ pub fn trans_slice_vstore(bcx: @mut Block,
// Handle the &"..." case:
match content_expr.node {
ast::expr_lit(@codemap::spanned {node: ast::lit_str(s), span: _}) => {
ast::expr_lit(@codemap::Spanned {node: ast::lit_str(s), span: _}) => {
return trans_lit_str(bcx, content_expr, s, dest);
}
_ => {}
@ -295,7 +295,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: @a
match heap {
heap_exchange => {
match content_expr.node {
ast::expr_lit(@codemap::spanned {
ast::expr_lit(@codemap::Spanned {
node: ast::lit_str(s), span
}) => {
let llptrval = C_cstr(bcx.ccx(), s);
@ -357,7 +357,7 @@ pub fn write_content(bcx: @mut Block,
let _indenter = indenter();
match content_expr.node {
ast::expr_lit(@codemap::spanned { node: ast::lit_str(s), _ }) => {
ast::expr_lit(@codemap::Spanned { node: ast::lit_str(s), _ }) => {
match dest {
Ignore => {
return bcx;
@ -490,7 +490,7 @@ pub fn elements_required(bcx: @mut Block, content_expr: &ast::expr) -> uint {
//! Figure out the number of elements we need to store this content
match content_expr.node {
ast::expr_lit(@codemap::spanned { node: ast::lit_str(s), _ }) => {
ast::expr_lit(@codemap::Spanned { node: ast::lit_str(s), _ }) => {
s.len()
},
ast::expr_vec(ref es, _) => es.len(),

View File

@ -28,14 +28,14 @@ use middle::trans::common::*;
use middle::trans::datum::*;
use middle::trans::expr;
use middle::ty;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::ast;
use middle::trans::type_::Type;
pub fn root_and_write_guard(datum: &Datum,
mut bcx: @mut Block,
span: span,
span: Span,
expr_id: ast::NodeId,
derefs: uint) -> @mut Block {
let key = root_map_key { id: expr_id, derefs: derefs };
@ -103,7 +103,7 @@ pub fn return_to_mut(mut bcx: @mut Block,
fn root(datum: &Datum,
mut bcx: @mut Block,
span: span,
span: Span,
root_key: root_map_key,
root_info: RootInfo) -> @mut Block {
//! In some cases, borrowck will decide that an @T/@[]/@str
@ -183,7 +183,7 @@ fn root(datum: &Datum,
fn perform_write_guard(datum: &Datum,
bcx: @mut Block,
span: span) -> @mut Block {
span: Span) -> @mut Block {
debug!("perform_write_guard");
let llval = datum.to_value_llval(bcx);

View File

@ -38,7 +38,7 @@ use syntax::ast::*;
use syntax::ast_util::is_local;
use syntax::ast_util;
use syntax::attr;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::codemap;
use syntax::parse::token;
use syntax::{ast, ast_map};
@ -2898,7 +2898,7 @@ pub fn ty_vstore(ty: t) -> vstore {
}
pub fn ty_region(tcx: ctxt,
span: span,
span: Span,
ty: t) -> Region {
match get(ty).sty {
ty_rptr(r, _) => r,
@ -2996,7 +2996,7 @@ pub fn expr_ty_adjusted(cx: ctxt, expr: &ast::expr) -> t {
}
pub fn adjust_ty(cx: ctxt,
span: span,
span: Span,
unadjusted_ty: ty::t,
adjustment: Option<@AutoAdjustment>) -> ty::t
{
@ -3076,7 +3076,7 @@ pub fn adjust_ty(cx: ctxt,
}
};
fn borrow_vec(cx: ctxt, span: span,
fn borrow_vec(cx: ctxt, span: Span,
r: Region, m: ast::mutability,
ty: ty::t) -> ty::t {
match get(ty).sty {
@ -3097,7 +3097,7 @@ pub fn adjust_ty(cx: ctxt,
}
}
fn borrow_fn(cx: ctxt, span: span, r: Region, ty: ty::t) -> ty::t {
fn borrow_fn(cx: ctxt, span: Span, r: Region, ty: ty::t) -> ty::t {
match get(ty).sty {
ty_closure(ref fty) => {
ty::mk_closure(cx, ClosureTy {
@ -3116,7 +3116,7 @@ pub fn adjust_ty(cx: ctxt,
}
}
fn borrow_obj(cx: ctxt, span: span, r: Region,
fn borrow_obj(cx: ctxt, span: Span, r: Region,
m: ast::mutability, ty: ty::t) -> ty::t {
match get(ty).sty {
ty_trait(trt_did, ref trt_substs, _, _, b) => {
@ -3283,7 +3283,7 @@ pub fn expr_kind(tcx: ctxt,
ast::expr_do_body(*) |
ast::expr_block(*) |
ast::expr_repeat(*) |
ast::expr_lit(@codemap::spanned {node: lit_str(_), _}) |
ast::expr_lit(@codemap::Spanned {node: lit_str(_), _}) |
ast::expr_vstore(_, ast::expr_vstore_slice) |
ast::expr_vstore(_, ast::expr_vstore_mut_slice) |
ast::expr_vec(*) => {
@ -3395,7 +3395,7 @@ pub fn param_tys_in_type(ty: t) -> ~[param_ty] {
rslt
}
pub fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) {
pub fn occurs_check(tcx: ctxt, sp: Span, vid: TyVid, rt: t) {
// Returns a vec of all the type variables occurring in `ty`. It may
// contain duplicates. (Integral type vars aren't counted.)
fn vars_in_type(ty: t) -> ~[TyVid] {

View File

@ -65,7 +65,7 @@ use middle::typeck::lookup_def_tcx;
use std::result;
use syntax::abi::AbiSet;
use syntax::{ast, ast_util};
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::opt_vec::OptVec;
use syntax::opt_vec;
use syntax::print::pprust::{lifetime_to_str, path_to_str};
@ -78,12 +78,12 @@ pub trait AstConv {
fn get_trait_def(&self, id: ast::def_id) -> @ty::TraitDef;
// what type should we use when a type is omitted?
fn ty_infer(&self, span: span) -> ty::t;
fn ty_infer(&self, span: Span) -> ty::t;
}
pub fn get_region_reporting_err(
tcx: ty::ctxt,
span: span,
span: Span,
a_r: &Option<ast::Lifetime>,
res: Result<ty::Region, RegionError>) -> ty::Region
{
@ -107,7 +107,7 @@ pub fn get_region_reporting_err(
pub fn ast_region_to_region<AC:AstConv,RS:RegionScope + Clone + 'static>(
this: &AC,
rscope: &RS,
default_span: span,
default_span: Span,
opt_lifetime: &Option<ast::Lifetime>) -> ty::Region
{
let (span, res) = match opt_lifetime {
@ -701,7 +701,7 @@ pub fn ty_of_closure<AC:AstConv,RS:RegionScope + Clone + 'static>(
decl: &ast::fn_decl,
expected_sig: Option<ty::FnSig>,
lifetimes: &OptVec<ast::Lifetime>,
span: span)
span: Span)
-> ty::ClosureTy
{
// The caller should not both provide explicit bound lifetime

View File

@ -21,7 +21,7 @@ use middle::typeck::require_same_types;
use std::hashmap::{HashMap, HashSet};
use syntax::ast;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::print::pprust;
pub fn check_match(fcx: @mut FnCtxt,
@ -284,7 +284,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: &ast::Path,
/// (e.g. K,V in HashMap<K,V>).
/// `etc` is true if the pattern said '...' and false otherwise.
pub fn check_struct_pat_fields(pcx: &pat_ctxt,
span: span,
span: Span,
path: &ast::Path,
fields: &[ast::field_pat],
class_fields: ~[ty::field_ty],
@ -338,7 +338,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
}
}
pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: span,
pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: Span,
expected: ty::t, path: &ast::Path,
fields: &[ast::field_pat], etc: bool,
struct_id: ast::def_id,
@ -372,7 +372,7 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: span,
pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt,
pat_id: ast::NodeId,
span: span,
span: Span,
expected: ty::t,
path: &ast::Path,
fields: &[ast::field_pat],
@ -651,7 +651,7 @@ pub fn check_pointer_pat(pcx: &pat_ctxt,
pointer_kind: PointerKind,
inner: @ast::pat,
pat_id: ast::NodeId,
span: span,
span: Span,
expected: ty::t) {
let fcx = pcx.fcx;
let check_inner: &fn(ty::mt) = |e_inner| {

View File

@ -16,24 +16,24 @@ use middle::typeck::infer;
use std::result::{Err, Ok};
use std::result;
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
// Requires that the two types unify, and prints an error message if they
// don't.
pub fn suptype(fcx: @mut FnCtxt, sp: span, expected: ty::t, actual: ty::t) {
pub fn suptype(fcx: @mut FnCtxt, sp: Span, expected: ty::t, actual: ty::t) {
suptype_with_fn(fcx, sp, false, expected, actual,
|sp, e, a, s| { fcx.report_mismatched_types(sp, e, a, s) })
}
pub fn subtype(fcx: @mut FnCtxt, sp: span, expected: ty::t, actual: ty::t) {
pub fn subtype(fcx: @mut FnCtxt, sp: Span, expected: ty::t, actual: ty::t) {
suptype_with_fn(fcx, sp, true, actual, expected,
|sp, a, e, s| { fcx.report_mismatched_types(sp, e, a, s) })
}
pub fn suptype_with_fn(fcx: @mut FnCtxt,
sp: span, b_is_expected: bool,
sp: Span, b_is_expected: bool,
ty_a: ty::t, ty_b: ty::t,
handle_err: &fn(span, ty::t, ty::t, &ty::type_err)) {
handle_err: &fn(Span, ty::t, ty::t, &ty::type_err)) {
// n.b.: order of actual, expected is reversed
match infer::mk_subty(fcx.infcx(), b_is_expected, infer::Misc(sp),
ty_b, ty_a) {
@ -44,7 +44,7 @@ pub fn suptype_with_fn(fcx: @mut FnCtxt,
}
}
pub fn eqtype(fcx: @mut FnCtxt, sp: span, expected: ty::t, actual: ty::t) {
pub fn eqtype(fcx: @mut FnCtxt, sp: Span, expected: ty::t, actual: ty::t) {
match infer::mk_eqty(fcx.infcx(), false, infer::Misc(sp), actual, expected) {
Ok(()) => { /* ok */ }
Err(ref err) => {
@ -55,7 +55,7 @@ pub fn eqtype(fcx: @mut FnCtxt, sp: span, expected: ty::t, actual: ty::t) {
// Checks that the type `actual` can be coerced to `expected`.
pub fn coerce(fcx: @mut FnCtxt,
sp: span,
sp: Span,
expected: ty::t,
expr: @ast::expr) {
let expr_ty = fcx.expr_ty(expr);

View File

@ -122,7 +122,7 @@ use syntax::ast;
use syntax::ast_map;
use syntax::ast_util::local_def;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::codemap;
use syntax::opt_vec::OptVec;
use syntax::opt_vec;
@ -144,7 +144,7 @@ pub mod method;
pub struct SelfInfo {
self_ty: ty::t,
self_id: ast::NodeId,
span: span
span: Span
}
/// Fields that are part of a `FnCtxt` which are inherited by
@ -398,7 +398,7 @@ impl Visitor<()> for GatherLocalsVisitor {
// Don't descend into fns and items
fn visit_fn(&mut self, _:&visit::fn_kind, _:&ast::fn_decl,
_:&ast::Block, _:span, _:ast::NodeId, _:()) { }
_:&ast::Block, _:Span, _:ast::NodeId, _:()) { }
fn visit_item(&mut self, _:@ast::item, _:()) { }
}
@ -557,7 +557,7 @@ pub fn check_method(ccx: @mut CrateCtxt,
}
pub fn check_no_duplicate_fields(tcx: ty::ctxt,
fields: ~[(ast::ident, span)]) {
fields: ~[(ast::ident, Span)]) {
let mut field_names = HashMap::new();
for p in fields.iter() {
@ -577,7 +577,7 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt,
}
}
pub fn check_struct(ccx: @mut CrateCtxt, id: ast::NodeId, span: span) {
pub fn check_struct(ccx: @mut CrateCtxt, id: ast::NodeId, span: Span) {
let tcx = ccx.tcx;
// Check that the class is instantiable
@ -665,7 +665,7 @@ impl AstConv for FnCtxt {
ty::lookup_trait_def(self.tcx(), id)
}
fn ty_infer(&self, _span: span) -> ty::t {
fn ty_infer(&self, _span: Span) -> ty::t {
self.infcx().next_ty_var()
}
}
@ -678,7 +678,7 @@ impl FnCtxt {
self.ccx.tcx.sess.err_count() - self.err_count_on_creation
}
pub fn search_in_scope_regions(&self,
span: span,
span: Span,
br: ty::bound_region)
-> Result<ty::Region, RegionError> {
let in_scope_regions = self.in_scope_regions;
@ -706,14 +706,14 @@ impl FnCtxt {
}
impl RegionScope for FnCtxt {
fn anon_region(&self, span: span) -> Result<ty::Region, RegionError> {
fn anon_region(&self, span: Span) -> Result<ty::Region, RegionError> {
result::Ok(self.infcx().next_region_var(infer::MiscVariable(span)))
}
fn self_region(&self, span: span) -> Result<ty::Region, RegionError> {
fn self_region(&self, span: Span) -> Result<ty::Region, RegionError> {
self.search_in_scope_regions(span, ty::br_self)
}
fn named_region(&self,
span: span,
span: Span,
id: ast::ident) -> Result<ty::Region, RegionError> {
self.search_in_scope_regions(span, ty::br_named(id))
}
@ -726,7 +726,7 @@ impl FnCtxt {
}
}
pub fn local_ty(&self, span: span, nid: ast::NodeId) -> ty::t {
pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> ty::t {
match self.inh.locals.find(&nid) {
Some(&t) => t,
None => {
@ -918,7 +918,7 @@ impl FnCtxt {
pub fn region_var_if_parameterized(&self,
rp: Option<ty::region_variance>,
span: span)
span: Span)
-> OptVec<ty::Region> {
match rp {
None => opt_vec::Empty,
@ -931,7 +931,7 @@ impl FnCtxt {
}
pub fn type_error_message(&self,
sp: span,
sp: Span,
mk_msg: &fn(~str) -> ~str,
actual_ty: ty::t,
err: Option<&ty::type_err>) {
@ -939,7 +939,7 @@ impl FnCtxt {
}
pub fn report_mismatched_return_types(&self,
sp: span,
sp: Span,
e: ty::t,
a: ty::t,
err: &ty::type_err) {
@ -951,7 +951,7 @@ impl FnCtxt {
}
pub fn report_mismatched_types(&self,
sp: span,
sp: Span,
e: ty::t,
a: ty::t,
err: &ty::type_err) {
@ -959,7 +959,7 @@ impl FnCtxt {
}
}
pub fn do_autoderef(fcx: @mut FnCtxt, sp: span, t: ty::t) -> (ty::t, uint) {
pub fn do_autoderef(fcx: @mut FnCtxt, sp: Span, t: ty::t) -> (ty::t, uint) {
/*!
*
* Autoderefs the type `t` as many times as possible, returning
@ -1306,7 +1306,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
fn check_method_argument_types(
fcx: @mut FnCtxt,
sp: span,
sp: Span,
method_fn_ty: ty::t,
callee_expr: @ast::expr,
args: &[@ast::expr],
@ -1336,7 +1336,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
fn check_argument_types(
fcx: @mut FnCtxt,
sp: span,
sp: Span,
fn_inputs: &[ty::t],
callee_expr: @ast::expr,
args: &[@ast::expr],
@ -1597,7 +1597,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
then_blk: &ast::Block,
opt_else_expr: Option<@ast::expr>,
id: ast::NodeId,
sp: span,
sp: Span,
expected: Option<ty::t>) {
check_expr_has_type(fcx, cond_expr, ty::mk_bool());
@ -2005,7 +2005,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
}
fn check_struct_or_variant_fields(fcx: @mut FnCtxt,
span: span,
span: Span,
class_id: ast::def_id,
node_id: ast::NodeId,
substitutions: ty::substs,
@ -2096,7 +2096,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
fn check_struct_constructor(fcx: @mut FnCtxt,
id: ast::NodeId,
span: codemap::span,
span: codemap::Span,
class_id: ast::def_id,
fields: &[ast::Field],
base_expr: Option<@ast::expr>) {
@ -2185,7 +2185,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
fn check_struct_enum_variant(fcx: @mut FnCtxt,
id: ast::NodeId,
span: codemap::span,
span: codemap::Span,
enum_id: ast::def_id,
variant_id: ast::def_id,
fields: &[ast::Field]) {
@ -2259,7 +2259,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
match expr.node {
ast::expr_vstore(ev, vst) => {
let typ = match ev.node {
ast::expr_lit(@codemap::spanned { node: ast::lit_str(_), _ }) => {
ast::expr_lit(@codemap::Spanned { node: ast::lit_str(_), _ }) => {
let tt = ast_expr_vstore_to_vstore(fcx, ev, vst);
ty::mk_estr(tcx, tt)
}
@ -2708,7 +2708,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
_ => false
}
}
fn types_compatible(fcx: @mut FnCtxt, sp: span,
fn types_compatible(fcx: @mut FnCtxt, sp: Span,
t1: ty::t, t2: ty::t) -> bool {
if !is_vec(t1) {
false
@ -2897,7 +2897,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
unifier();
}
pub fn require_integral(fcx: @mut FnCtxt, sp: span, t: ty::t) {
pub fn require_integral(fcx: @mut FnCtxt, sp: Span, t: ty::t) {
if !type_is_integral(fcx, sp, t) {
fcx.type_error_message(sp, |actual| {
fmt!("mismatched types: expected integral type but found `%s`",
@ -3022,7 +3022,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt,
let s_id = ast_util::stmt_id(*s);
let s_ty = fcx.node_ty(s_id);
if last_was_bot && !warned && match s.node {
ast::stmt_decl(@codemap::spanned { node: ast::decl_local(_),
ast::stmt_decl(@codemap::Spanned { node: ast::decl_local(_),
_}, _) |
ast::stmt_expr(_, _) | ast::stmt_semi(_, _) => {
true
@ -3070,7 +3070,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt,
}
pub fn check_const(ccx: @mut CrateCtxt,
sp: span,
sp: Span,
e: @ast::expr,
id: ast::NodeId) {
let rty = ty::node_id_to_type(ccx.tcx, id);
@ -3080,7 +3080,7 @@ pub fn check_const(ccx: @mut CrateCtxt,
}
pub fn check_const_with_ty(fcx: @mut FnCtxt,
_: span,
_: Span,
e: @ast::expr,
declty: ty::t) {
check_expr(fcx, e);
@ -3102,7 +3102,7 @@ pub fn check_const_with_ty(fcx: @mut FnCtxt,
///
/// is representable, but not instantiable.
pub fn check_instantiable(tcx: ty::ctxt,
sp: span,
sp: Span,
item_id: ast::NodeId) {
let item_ty = ty::node_id_to_type(tcx, item_id);
if !ty::is_instantiable(tcx, item_ty) {
@ -3113,7 +3113,7 @@ pub fn check_instantiable(tcx: ty::ctxt,
}
}
pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::NodeId) {
pub fn check_simd(tcx: ty::ctxt, sp: Span, id: ast::NodeId) {
let t = ty::node_id_to_type(tcx, id);
if ty::type_needs_subst(t) {
tcx.sess.span_err(sp, "SIMD vector cannot be generic");
@ -3143,7 +3143,7 @@ pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::NodeId) {
}
pub fn check_enum_variants(ccx: @mut CrateCtxt,
sp: span,
sp: Span,
vs: &[ast::variant],
id: ast::NodeId) {
fn do_check(ccx: @mut CrateCtxt,
@ -3236,13 +3236,13 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt,
check_instantiable(ccx.tcx, sp, id);
}
pub fn lookup_def(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) -> ast::def {
pub fn lookup_def(fcx: @mut FnCtxt, sp: Span, id: ast::NodeId) -> ast::def {
lookup_def_ccx(fcx.ccx, sp, id)
}
// Returns the type parameter count and the type for the given definition.
pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt,
sp: span,
sp: Span,
defn: ast::def)
-> ty_param_bounds_and_ty {
match defn {
@ -3295,7 +3295,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt,
pth: &ast::Path,
tpt: ty_param_bounds_and_ty,
def: ast::def,
span: span,
span: Span,
node_id: ast::NodeId) {
debug!(">>> instantiate_path");
@ -3409,7 +3409,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt,
// Resolves `typ` by a single level if `typ` is a type variable. If no
// resolution is possible, then an error is reported.
pub fn structurally_resolved_type(fcx: @mut FnCtxt, sp: span, tp: ty::t)
pub fn structurally_resolved_type(fcx: @mut FnCtxt, sp: Span, tp: ty::t)
-> ty::t {
match infer::resolve_type(fcx.infcx(), tp, force_tvar) {
Ok(t_s) if !ty::type_is_ty_var(t_s) => t_s,
@ -3424,32 +3424,32 @@ pub fn structurally_resolved_type(fcx: @mut FnCtxt, sp: span, tp: ty::t)
}
// Returns the one-level-deep structure of the given type.
pub fn structure_of<'a>(fcx: @mut FnCtxt, sp: span, typ: ty::t)
pub fn structure_of<'a>(fcx: @mut FnCtxt, sp: Span, typ: ty::t)
-> &'a ty::sty {
&ty::get(structurally_resolved_type(fcx, sp, typ)).sty
}
pub fn type_is_integral(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool {
pub fn type_is_integral(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool {
let typ_s = structurally_resolved_type(fcx, sp, typ);
return ty::type_is_integral(typ_s);
}
pub fn type_is_scalar(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool {
pub fn type_is_scalar(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool {
let typ_s = structurally_resolved_type(fcx, sp, typ);
return ty::type_is_scalar(typ_s);
}
pub fn type_is_unsafe_ptr(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool {
pub fn type_is_unsafe_ptr(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool {
let typ_s = structurally_resolved_type(fcx, sp, typ);
return ty::type_is_unsafe_ptr(typ_s);
}
pub fn type_is_region_ptr(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool {
pub fn type_is_region_ptr(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool {
let typ_s = structurally_resolved_type(fcx, sp, typ);
return ty::type_is_region_ptr(typ_s);
}
pub fn type_is_c_like_enum(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool {
pub fn type_is_c_like_enum(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool {
let typ_s = structurally_resolved_type(fcx, sp, typ);
return ty::type_is_c_like_enum(fcx.ccx.tcx, typ_s);
}
@ -3492,7 +3492,7 @@ pub fn may_break(cx: ty::ctxt, id: ast::NodeId, b: &ast::Block) -> bool {
}
pub fn check_bounds_are_used(ccx: @mut CrateCtxt,
span: span,
span: Span,
tps: &OptVec<ast::TyParam>,
ty: ty::t) {
debug!("check_bounds_are_used(n_tps=%u, ty=%s)",

View File

@ -42,7 +42,7 @@ use middle::pat_util;
use syntax::ast::{ManagedSigil, OwnedSigil, BorrowedSigil};
use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar};
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::visit;
use syntax::visit::Visitor;
@ -626,7 +626,7 @@ fn constrain_derefs(rcx: @mut Rcx,
}
pub fn mk_subregion_due_to_derefence(rcx: @mut Rcx,
deref_span: span,
deref_span: Span,
minimum_lifetime: ty::Region,
maximum_lifetime: ty::Region) {
rcx.fcx.mk_subr(true, infer::DerefPointer(deref_span),
@ -809,7 +809,7 @@ pub mod guarantor {
use middle::typeck::infer;
use middle::ty;
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
use util::ppaux::{ty_to_str};
pub fn for_addr_of(rcx: @mut Rcx, expr: @ast::expr, base: @ast::expr) {
@ -918,7 +918,7 @@ pub mod guarantor {
fn link(
rcx: @mut Rcx,
span: span,
span: Span,
id: ast::NodeId,
guarantor: Option<ty::Region>) {
/*!

View File

@ -27,7 +27,7 @@ use std::hashmap::HashSet;
use std::result;
use syntax::ast;
use syntax::ast_util;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::print::pprust::expr_to_str;
use syntax::visit;
use syntax::visit::Visitor;
@ -62,7 +62,7 @@ use syntax::visit::Visitor;
/// responsible for this vtable instantiation. (This may not be an expression
/// if the vtable instantiation is being performed as part of "deriving".)
pub struct LocationInfo {
span: span,
span: Span,
id: ast::NodeId
}

View File

@ -27,11 +27,11 @@ use middle::typeck::write_ty_to_tcx;
use util::ppaux;
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::print::pprust::pat_to_str;
use syntax::oldvisit;
fn resolve_type_vars_in_type(fcx: @mut FnCtxt, sp: span, typ: ty::t)
fn resolve_type_vars_in_type(fcx: @mut FnCtxt, sp: Span, typ: ty::t)
-> Option<ty::t> {
if !ty::type_needs_infer(typ) { return Some(typ); }
match resolve_type(fcx.infcx(), typ, resolve_all | force_all) {
@ -49,7 +49,7 @@ fn resolve_type_vars_in_type(fcx: @mut FnCtxt, sp: span, typ: ty::t)
}
}
fn resolve_type_vars_in_types(fcx: @mut FnCtxt, sp: span, tys: &[ty::t])
fn resolve_type_vars_in_types(fcx: @mut FnCtxt, sp: Span, tys: &[ty::t])
-> ~[ty::t] {
tys.map(|t| {
match resolve_type_vars_in_type(fcx, sp, *t) {
@ -59,7 +59,7 @@ fn resolve_type_vars_in_types(fcx: @mut FnCtxt, sp: span, tys: &[ty::t])
})
}
fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) {
fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: Span, id: ast::NodeId) {
// Resolve any method map entry
match fcx.inh.method_map.find(&id) {
None => {}
@ -79,7 +79,7 @@ fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) {
}
}
fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) {
fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: Span, id: ast::NodeId) {
// Resolve any method map entry
match fcx.inh.vtable_map.find(&id) {
None => {}
@ -92,13 +92,13 @@ fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) {
}
}
fn resolve_origins(fcx: @mut FnCtxt, sp: span,
fn resolve_origins(fcx: @mut FnCtxt, sp: Span,
vtbls: vtable_res) -> vtable_res {
@vtbls.map(|os| @os.map(|o| resolve_origin(fcx, sp, o)))
}
fn resolve_origin(fcx: @mut FnCtxt,
sp: span,
sp: Span,
origin: &vtable_origin) -> vtable_origin {
match origin {
&vtable_static(def_id, ref tys, origins) => {
@ -113,7 +113,7 @@ fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) {
}
}
fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: span, id: ast::NodeId)
fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: Span, id: ast::NodeId)
-> Option<ty::t> {
let fcx = wbcx.fcx;
let tcx = fcx.ccx.tcx;
@ -196,7 +196,7 @@ fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: span, id: ast::NodeId)
}
fn maybe_resolve_type_vars_for_node(wbcx: @mut WbCtxt,
sp: span,
sp: Span,
id: ast::NodeId)
-> Option<ty::t> {
if wbcx.fcx.inh.node_types.contains_key(&id) {

View File

@ -42,7 +42,7 @@ use syntax::ast;
use syntax::ast_map::node_item;
use syntax::ast_map;
use syntax::ast_util::{def_id_of_def, local_def};
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::opt_vec;
use syntax::visit;
use syntax::parse;
@ -58,7 +58,7 @@ pub struct UniversalQuantificationResult {
}
pub fn get_base_type(inference_context: @mut InferCtxt,
span: span,
span: Span,
original_type: t)
-> Option<t> {
let resolved_type;
@ -121,7 +121,7 @@ pub fn type_is_defined_in_local_crate(original_type: t) -> bool {
// Returns the def ID of the base type, if there is one.
pub fn get_base_type_def_id(inference_context: @mut InferCtxt,
span: span,
span: Span,
original_type: t)
-> Option<def_id> {
match get_base_type(inference_context, span, original_type) {
@ -546,7 +546,7 @@ impl CoherenceChecker {
&self,
all_methods: &mut ~[@Method],
trait_did: def_id,
trait_ref_span: span) {
trait_ref_span: Span) {
let tcx = self.crate_context.tcx;
@ -647,7 +647,7 @@ impl CoherenceChecker {
}
}
pub fn span_of_impl(&self, implementation: @Impl) -> span {
pub fn span_of_impl(&self, implementation: @Impl) -> Span {
assert_eq!(implementation.did.crate, LOCAL_CRATE);
match self.crate_context.tcx.items.find(&implementation.did.node) {
Some(&node_item(item, _)) => {

View File

@ -54,7 +54,7 @@ use syntax::ast::{RegionTyParamBound, TraitTyParamBound};
use syntax::ast;
use syntax::ast_map;
use syntax::ast_util::{local_def, split_trait_methods};
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::codemap;
use syntax::print::pprust::{path_to_str, explicit_self_to_str};
use syntax::visit;
@ -140,7 +140,7 @@ impl AstConv for CrateCtxt {
get_trait_def(self, id)
}
fn ty_infer(&self, span: span) -> ty::t {
fn ty_infer(&self, span: Span) -> ty::t {
self.tcx.sess.span_bug(span,
"found `ty_infer` in unexpected place");
}
@ -397,7 +397,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt,
pub fn ensure_supertraits(ccx: &CrateCtxt,
id: ast::NodeId,
sp: codemap::span,
sp: codemap::Span,
rp: Option<ty::region_variance>,
ast_trait_refs: &[ast::trait_ref],
generics: &ast::Generics) -> ty::BuiltinBounds
@ -740,7 +740,7 @@ pub fn convert_field(ccx: &CrateCtxt,
pub struct ConvertedMethod {
mty: @ty::Method,
id: ast::NodeId,
span: span,
span: Span,
body_id: ast::NodeId
}
@ -828,7 +828,7 @@ pub fn convert_methods(ccx: &CrateCtxt,
}
pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt,
span: span,
span: Span,
generics: &ast::Generics,
thing: &'static str) {
for ty_param in generics.ty_params.iter() {

View File

@ -44,7 +44,7 @@ use extra::smallintmap::SmallIntMap;
use syntax::ast::{m_imm, m_mutbl};
use syntax::ast;
use syntax::codemap;
use syntax::codemap::span;
use syntax::codemap::Span;
pub mod doc;
pub mod macros;
@ -100,25 +100,25 @@ pub struct InferCtxt {
#[deriving(Clone)]
pub enum TypeOrigin {
// Not yet categorized in a better way
Misc(span),
Misc(Span),
// Checking that method of impl is compatible with trait
MethodCompatCheck(span),
MethodCompatCheck(Span),
// Checking that this expression can be assigned where it needs to be
ExprAssignable(@ast::expr),
// Relating trait refs when resolving vtables
RelateTraitRefs(span),
RelateTraitRefs(Span),
// Relating trait refs when resolving vtables
RelateSelfType(span),
RelateSelfType(Span),
// Computing common supertype in a match expression
MatchExpression(span),
MatchExpression(Span),
// Computing common supertype in an if expression
IfExpression(span),
IfExpression(Span),
}
/// See `error_reporting.rs` for more details
@ -148,47 +148,47 @@ pub enum SubregionOrigin {
// Stack-allocated closures cannot outlive innermost loop
// or function so as to ensure we only require finite stack
InfStackClosure(span),
InfStackClosure(Span),
// Invocation of closure must be within its lifetime
InvokeClosure(span),
InvokeClosure(Span),
// Dereference of borrowed pointer must be within its lifetime
DerefPointer(span),
DerefPointer(Span),
// Closure bound must not outlive captured free variables
FreeVariable(span),
FreeVariable(Span),
// Index into slice must be within its lifetime
IndexSlice(span),
IndexSlice(Span),
// When casting `&'a T` to an `&'b Trait` object,
// relating `'a` to `'b`
RelateObjectBound(span),
RelateObjectBound(Span),
// Creating a pointer `b` to contents of another borrowed pointer
Reborrow(span),
Reborrow(Span),
// (&'a &'b T) where a >= b
ReferenceOutlivesReferent(ty::t, span),
ReferenceOutlivesReferent(ty::t, Span),
// A `ref b` whose region does not enclose the decl site
BindingTypeIsNotValidAtDecl(span),
BindingTypeIsNotValidAtDecl(Span),
// Regions appearing in a method receiver must outlive method call
CallRcvr(span),
CallRcvr(Span),
// Regions appearing in a function argument must outlive func call
CallArg(span),
CallArg(Span),
// Region in return type of invoked fn must enclose call
CallReturn(span),
CallReturn(Span),
// Region resulting from a `&` expr must enclose the `&` expr
AddrOf(span),
AddrOf(Span),
// An auto-borrow that does not enclose the expr where it occurs
AutoBorrow(span),
AutoBorrow(Span),
}
/// Reasons to create a region inference variable
@ -197,36 +197,36 @@ pub enum SubregionOrigin {
pub enum RegionVariableOrigin {
// Region variables created for ill-categorized reasons,
// mostly indicates places in need of refactoring
MiscVariable(span),
MiscVariable(Span),
// Regions created by a `&P` or `[...]` pattern
PatternRegion(span),
PatternRegion(Span),
// Regions created by `&` operator
AddrOfRegion(span),
AddrOfRegion(Span),
// Regions created by `&[...]` literal
AddrOfSlice(span),
AddrOfSlice(Span),
// Regions created as part of an autoref of a method receiver
Autoref(span),
Autoref(Span),
// Regions created as part of an automatic coercion
Coercion(TypeTrace),
// Region variables created for bound regions
// in a function or method that is called
BoundRegionInFnCall(span, ty::bound_region),
BoundRegionInFnCall(Span, ty::bound_region),
// Region variables created for bound regions
// when doing subtyping/lub/glb computations
BoundRegionInFnType(span, ty::bound_region),
BoundRegionInFnType(Span, ty::bound_region),
BoundRegionInTypeOrImpl(span),
BoundRegionInTypeOrImpl(Span),
BoundRegionInCoherence,
BoundRegionError(span),
BoundRegionError(Span),
}
pub enum fixup_err {
@ -710,7 +710,7 @@ impl InferCtxt {
// types using one of these four methods, and should not call span_err directly for such
// errors.
pub fn type_error_message_str(@mut self,
sp: span,
sp: Span,
mk_msg: &fn(Option<~str>, ~str) -> ~str,
actual_ty: ~str,
err: Option<&ty::type_err>) {
@ -718,7 +718,7 @@ impl InferCtxt {
}
pub fn type_error_message_str_with_expected(@mut self,
sp: span,
sp: Span,
mk_msg:
&fn(Option<~str>, ~str) ->
~str,
@ -749,7 +749,7 @@ impl InferCtxt {
}
pub fn type_error_message(@mut self,
sp: span,
sp: Span,
mk_msg: &fn(~str) -> ~str,
actual_ty: ty::t,
err: Option<&ty::type_err>) {
@ -764,7 +764,7 @@ impl InferCtxt {
}
pub fn report_mismatched_types(@mut self,
sp: span,
sp: Span,
e: ty::t,
a: ty::t,
err: &ty::type_err) {
@ -812,7 +812,7 @@ pub fn fold_regions_in_sig(
}
impl TypeTrace {
pub fn span(&self) -> span {
pub fn span(&self) -> Span {
self.origin.span()
}
}
@ -824,7 +824,7 @@ impl Repr for TypeTrace {
}
impl TypeOrigin {
pub fn span(&self) -> span {
pub fn span(&self) -> Span {
match *self {
MethodCompatCheck(span) => span,
ExprAssignable(expr) => expr.span,
@ -852,7 +852,7 @@ impl Repr for TypeOrigin {
}
impl SubregionOrigin {
pub fn span(&self) -> span {
pub fn span(&self) -> Span {
match *self {
Subtype(a) => a.span(),
InfStackClosure(a) => a,
@ -896,7 +896,7 @@ impl Repr for SubregionOrigin {
}
impl RegionVariableOrigin {
pub fn span(&self) -> span {
pub fn span(&self) -> Span {
match *self {
MiscVariable(a) => a,
PatternRegion(a) => a,

View File

@ -61,7 +61,7 @@ use std::hashmap::HashMap;
use std::result;
use extra::list::List;
use extra::list;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::print::pprust::*;
use syntax::{ast, ast_map, abi};
use syntax::opt_vec;
@ -249,7 +249,7 @@ pub fn write_tpt_to_tcx(tcx: ty::ctxt,
}
}
pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::NodeId) -> ast::def {
pub fn lookup_def_tcx(tcx: ty::ctxt, sp: Span, id: ast::NodeId) -> ast::def {
match tcx.def_map.find(&id) {
Some(&x) => x,
_ => {
@ -258,7 +258,7 @@ pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::NodeId) -> ast::def {
}
}
pub fn lookup_def_ccx(ccx: &CrateCtxt, sp: span, id: ast::NodeId)
pub fn lookup_def_ccx(ccx: &CrateCtxt, sp: Span, id: ast::NodeId)
-> ast::def {
lookup_def_tcx(ccx.tcx, sp, id)
}
@ -275,7 +275,7 @@ pub fn require_same_types(
tcx: ty::ctxt,
maybe_infcx: Option<@mut infer::InferCtxt>,
t1_is_expected: bool,
span: span,
span: Span,
t1: ty::t,
t2: ty::t,
msg: &fn() -> ~str) -> bool {
@ -330,7 +330,7 @@ impl get_and_find_region for isr_alist {
fn check_main_fn_ty(ccx: &CrateCtxt,
main_id: ast::NodeId,
main_span: span) {
main_span: Span) {
let tcx = ccx.tcx;
let main_t = ty::node_id_to_type(tcx, main_id);
match ty::get(main_t).sty {
@ -374,7 +374,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
fn check_start_fn_ty(ccx: &CrateCtxt,
start_id: ast::NodeId,
start_span: span) {
start_span: Span) {
let tcx = ccx.tcx;
let start_t = ty::node_id_to_type(tcx, start_id);
match ty::get(start_t).sty {

View File

@ -13,7 +13,7 @@ use middle::ty;
use std::result;
use syntax::ast;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::opt_vec::OptVec;
use syntax::opt_vec;
use syntax::parse::token::special_idents;
@ -25,25 +25,25 @@ pub struct RegionError {
}
pub trait RegionScope {
fn anon_region(&self, span: span) -> Result<ty::Region, RegionError>;
fn self_region(&self, span: span) -> Result<ty::Region, RegionError>;
fn named_region(&self, span: span, id: ast::ident)
fn anon_region(&self, span: Span) -> Result<ty::Region, RegionError>;
fn self_region(&self, span: Span) -> Result<ty::Region, RegionError>;
fn named_region(&self, span: Span, id: ast::ident)
-> Result<ty::Region, RegionError>;
}
#[deriving(Clone)]
pub struct EmptyRscope;
impl RegionScope for EmptyRscope {
fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> {
fn anon_region(&self, _span: Span) -> Result<ty::Region, RegionError> {
result::Err(RegionError {
msg: ~"only 'static is allowed here",
replacement: ty::re_static
})
}
fn self_region(&self, _span: span) -> Result<ty::Region, RegionError> {
fn self_region(&self, _span: Span) -> Result<ty::Region, RegionError> {
self.anon_region(_span)
}
fn named_region(&self, _span: span, _id: ast::ident)
fn named_region(&self, _span: Span, _id: ast::ident)
-> Result<ty::Region, RegionError>
{
self.anon_region(_span)
@ -176,13 +176,13 @@ impl MethodRscope {
}
impl RegionScope for MethodRscope {
fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> {
fn anon_region(&self, _span: Span) -> Result<ty::Region, RegionError> {
result::Err(RegionError {
msg: ~"anonymous lifetimes are not permitted here",
replacement: ty::re_bound(ty::br_self)
})
}
fn self_region(&self, _span: span) -> Result<ty::Region, RegionError> {
fn self_region(&self, _span: Span) -> Result<ty::Region, RegionError> {
assert!(self.variance.is_some());
match self.variance {
None => {} // must be borrowed self, so this is OK
@ -197,7 +197,7 @@ impl RegionScope for MethodRscope {
}
result::Ok(ty::re_bound(ty::br_self))
}
fn named_region(&self, span: span, id: ast::ident)
fn named_region(&self, span: Span, id: ast::ident)
-> Result<ty::Region, RegionError> {
if !self.region_param_names.has_ident(id) {
return RegionParamNames::undeclared_name(None);
@ -224,13 +224,13 @@ impl TypeRscope {
}
}
impl RegionScope for TypeRscope {
fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> {
fn anon_region(&self, _span: Span) -> Result<ty::Region, RegionError> {
result::Err(RegionError {
msg: ~"anonymous lifetimes are not permitted here",
replacement: self.replacement()
})
}
fn self_region(&self, _span: span) -> Result<ty::Region, RegionError> {
fn self_region(&self, _span: Span) -> Result<ty::Region, RegionError> {
match **self {
None => {
// if the self region is used, region parameterization should
@ -249,7 +249,7 @@ impl RegionScope for TypeRscope {
}
result::Ok(ty::re_bound(ty::br_self))
}
fn named_region(&self, span: span, id: ast::ident)
fn named_region(&self, span: Span, id: ast::ident)
-> Result<ty::Region, RegionError> {
do EmptyRscope.named_region(span, id).chain_err |_e| {
result::Err(RegionError {
@ -298,16 +298,16 @@ pub fn in_binding_rscope<RS:RegionScope + Clone + 'static>(
}
impl RegionScope for BindingRscope {
fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> {
fn anon_region(&self, _span: Span) -> Result<ty::Region, RegionError> {
let idx = *self.anon_bindings;
*self.anon_bindings += 1;
result::Ok(ty::re_bound(ty::br_anon(idx)))
}
fn self_region(&self, span: span) -> Result<ty::Region, RegionError> {
fn self_region(&self, span: Span) -> Result<ty::Region, RegionError> {
self.base.self_region(span)
}
fn named_region(&self,
span: span,
span: Span,
id: ast::ident) -> Result<ty::Region, RegionError>
{
do self.base.named_region(span, id).chain_err |_e| {

View File

@ -28,7 +28,7 @@ extern mod syntax;
use driver::driver::{host_triple, optgroups, early_error};
use driver::driver::{str_input, file_input, build_session_options};
use driver::driver::{build_session, build_configuration, parse_pretty};
use driver::driver::{pp_mode, pretty_print_input, list_metadata};
use driver::driver::{PpMode, pretty_print_input, list_metadata};
use driver::driver::{compile_input};
use driver::session;
use middle::lint;
@ -262,11 +262,11 @@ pub fn run_compiler(args: &[~str], demitter: diagnostic::Emitter) {
parse_pretty(sess, a)
};
match pretty {
Some::<pp_mode>(ppm) => {
Some::<PpMode>(ppm) => {
pretty_print_input(sess, cfg, &input, ppm);
return;
}
None::<pp_mode> => {/* continue */ }
None::<PpMode> => {/* continue */ }
}
let ls = opt_present(matches, "ls");
if ls {
@ -326,7 +326,7 @@ pub fn monitor(f: ~fn(diagnostic::Emitter)) {
let ch_capture = ch.clone();
// The 'diagnostics emitter'. Every error, warning, etc. should
// go through this function.
let demitter: @fn(Option<(@codemap::CodeMap, codemap::span)>,
let demitter: @fn(Option<(@codemap::CodeMap, codemap::Span)>,
&str,
diagnostic::level) =
|cmsp, msg, lvl| {

View File

@ -10,7 +10,7 @@
use syntax::ast;
use syntax::codemap::{span};
use syntax::codemap::{Span};
use syntax::visit;
use syntax::visit::Visitor;
@ -105,7 +105,7 @@ pub fn block_query(b: &ast::Block, p: @fn(@ast::expr) -> bool) -> bool {
return *rs;
}
pub fn local_rhs_span(l: @ast::Local, def: span) -> span {
pub fn local_rhs_span(l: @ast::Local, def: Span) -> Span {
match l.init {
Some(i) => return i.span,
_ => return def

View File

@ -26,7 +26,7 @@ use middle::ty;
use middle::typeck;
use syntax::abi::AbiSet;
use syntax::ast_map;
use syntax::codemap::span;
use syntax::codemap::Span;
use syntax::parse::token;
use syntax::print::pprust;
use syntax::{ast, ast_util};
@ -69,7 +69,7 @@ pub fn explain_region(cx: ctxt, region: ty::Region) -> ~str {
pub fn explain_region_and_span(cx: ctxt, region: ty::Region)
-> (~str, Option<span>) {
-> (~str, Option<Span>) {
return match region {
re_scope(node_id) => {
match cx.items.find(&node_id) {
@ -136,8 +136,8 @@ pub fn explain_region_and_span(cx: ctxt, region: ty::Region)
}
};
fn explain_span(cx: ctxt, heading: &str, span: span)
-> (~str, Option<span>)
fn explain_span(cx: ctxt, heading: &str, span: Span)
-> (~str, Option<Span>)
{
let lo = cx.sess.codemap.lookup_char_pos_adj(span.lo);
(fmt!("the %s at %u:%u", heading,
@ -827,7 +827,7 @@ impl Repr for ty::BuiltinBounds {
}
}
impl Repr for span {
impl Repr for Span {
fn repr(&self, tcx: ctxt) -> ~str {
tcx.sess.codemap.span_to_str(*self)
}

View File

@ -12,7 +12,7 @@ use std::os;
use rustc::driver::{driver, session};
use extra::getopts::groups::getopts;
use syntax::ast_util::*;
use syntax::codemap::{dummy_sp, spanned};
use syntax::codemap::{dummy_sp, Spanned};
use syntax::ext::base::ExtCtxt;
use syntax::{ast, attr, codemap, diagnostic, fold};
use syntax::attr::AttrMetaMethods;
@ -53,7 +53,7 @@ pub fn is_cmd(cmd: &str) -> bool {
struct ListenerFn {
cmds: ~[~str],
span: codemap::span,
span: codemap::Span,
path: ~[ast::ident]
}
@ -427,7 +427,7 @@ pub fn link_exe(src: &Path, dest: &Path) -> bool {
}
pub fn mk_string_lit(s: @str) -> ast::lit {
spanned {
Spanned {
node: ast::lit_str(s),
span: dummy_sp()
}

View File

@ -10,7 +10,7 @@
// The Rust abstract syntax tree.
use codemap::{span, spanned};
use codemap::{Span, Spanned};
use abi::AbiSet;
use opt_vec::OptVec;
use parse::token::{interner_get, str_to_ident};
@ -95,7 +95,7 @@ pub type fn_ident = Option<ident>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct Lifetime {
id: NodeId,
span: span,
span: Span,
ident: ident
}
@ -105,7 +105,7 @@ pub struct Lifetime {
// of supporting information.
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct Path {
span: span,
span: Span,
/// A `::foo` path, is relative to the crate root rather than current
/// module (like paths in an import).
global: bool,
@ -219,10 +219,10 @@ pub struct Crate {
module: _mod,
attrs: ~[Attribute],
config: CrateConfig,
span: span,
span: Span,
}
pub type MetaItem = spanned<MetaItem_>;
pub type MetaItem = Spanned<MetaItem_>;
#[deriving(Clone, Encodable, Decodable, IterBytes)]
pub enum MetaItem_ {
@ -263,14 +263,14 @@ pub struct Block {
expr: Option<@expr>,
id: NodeId,
rules: BlockCheckMode,
span: span,
span: Span,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct pat {
id: NodeId,
node: pat_,
span: span,
span: Span,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
@ -333,7 +333,7 @@ impl ToStr for Sigil {
}
}
#[deriving(Eq, Encodable, Decodable,IterBytes)]
#[deriving(Eq, Encodable, Decodable, IterBytes)]
pub enum vstore {
// FIXME (#3469): Change uint to @expr (actually only constant exprs)
vstore_fixed(Option<uint>), // [1,2,3,4]
@ -382,7 +382,7 @@ pub enum unop {
neg
}
pub type stmt = spanned<stmt_>;
pub type stmt = Spanned<stmt_>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum stmt_ {
@ -408,10 +408,10 @@ pub struct Local {
pat: @pat,
init: Option<@expr>,
id: NodeId,
span: span,
span: Span,
}
pub type decl = spanned<decl_>;
pub type decl = Spanned<decl_>;
#[deriving(Eq, Encodable, Decodable,IterBytes)]
pub enum decl_ {
@ -432,7 +432,7 @@ pub struct arm {
pub struct Field {
ident: ident,
expr: @expr,
span: span,
span: Span,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
@ -445,7 +445,7 @@ pub enum BlockCheckMode {
pub struct expr {
id: NodeId,
node: expr_,
span: span,
span: Span,
}
impl expr {
@ -538,7 +538,7 @@ pub enum expr_ {
#[doc="For macro invocations; parsing is delegated to the macro"]
pub enum token_tree {
// a single token
tt_tok(span, ::parse::token::Token),
tt_tok(Span, ::parse::token::Token),
// a delimited sequence (the delimiters appear as the first
// and last elements of the vector)
tt_delim(@mut ~[token_tree]),
@ -547,10 +547,10 @@ pub enum token_tree {
// a kleene-style repetition sequence with a span, a tt_forest,
// an optional separator (?), and a boolean where true indicates
// zero or more (*), and false indicates one or more (+).
tt_seq(span, @mut ~[token_tree], Option<::parse::token::Token>, bool),
tt_seq(Span, @mut ~[token_tree], Option<::parse::token::Token>, bool),
// a syntactic variable that will be filled in by macro expansion.
tt_nonterminal(span, ident)
tt_nonterminal(Span, ident)
}
//
@ -605,7 +605,7 @@ pub enum token_tree {
// If you understand that, you have closed to loop and understand the whole
// macro system. Congratulations.
//
pub type matcher = spanned<matcher_>;
pub type matcher = Spanned<matcher_>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum matcher_ {
@ -618,14 +618,14 @@ pub enum matcher_ {
match_nonterminal(ident, ident, uint)
}
pub type mac = spanned<mac_>;
pub type mac = Spanned<mac_>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum mac_ {
mac_invoc_tt(Path,~[token_tree]), // new macro-invocation
}
pub type lit = spanned<lit_>;
pub type lit = Spanned<lit_>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum lit_ {
@ -651,7 +651,7 @@ pub struct mt {
pub struct TypeField {
ident: ident,
mt: mt,
span: span,
span: Span,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
@ -663,7 +663,7 @@ pub struct TypeMethod {
generics: Generics,
explicit_self: explicit_self,
id: NodeId,
span: span,
span: Span,
}
// A trait method is either required (meaning it doesn't have an
@ -724,7 +724,7 @@ impl ToStr for float_ty {
pub struct Ty {
id: NodeId,
node: ty_,
span: span,
span: Span,
}
// Not represented directly in the AST, referred to by name through a ty_path.
@ -864,7 +864,7 @@ pub enum explicit_self_ {
sty_uniq // `~self`
}
pub type explicit_self = spanned<explicit_self_>;
pub type explicit_self = Spanned<explicit_self_>;
#[deriving(Eq, Encodable, Decodable,IterBytes)]
pub struct method {
@ -876,7 +876,7 @@ pub struct method {
decl: fn_decl,
body: Block,
id: NodeId,
span: span,
span: Span,
self_id: NodeId,
vis: visibility,
}
@ -929,7 +929,7 @@ pub struct variant_ {
vis: visibility,
}
pub type variant = spanned<variant_>;
pub type variant = Spanned<variant_>;
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct path_list_ident_ {
@ -937,9 +937,9 @@ pub struct path_list_ident_ {
id: NodeId,
}
pub type path_list_ident = spanned<path_list_ident_>;
pub type path_list_ident = Spanned<path_list_ident_>;
pub type view_path = spanned<view_path_>;
pub type view_path = Spanned<view_path_>;
#[deriving(Eq, Encodable, Decodable, IterBytes)]
pub enum view_path_ {
@ -963,7 +963,7 @@ pub struct view_item {
node: view_item_,
attrs: ~[Attribute],
vis: visibility,
span: span,
span: Span,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
@ -977,7 +977,7 @@ pub enum view_item_ {
}
// Meta-data associated with an item
pub type Attribute = spanned<Attribute_>;
pub type Attribute = Spanned<Attribute_>;
// Distinguishes between Attributes that decorate items and Attributes that
// are contained as statements within items. These two cases need to be
@ -1033,7 +1033,7 @@ pub struct struct_field_ {
attrs: ~[Attribute],
}
pub type struct_field = spanned<struct_field_>;
pub type struct_field = Spanned<struct_field_>;
#[deriving(Eq, Encodable, Decodable,IterBytes)]
pub enum struct_field_kind {
@ -1060,7 +1060,7 @@ pub struct item {
id: NodeId,
node: item_,
vis: visibility,
span: span,
span: Span,
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
@ -1087,7 +1087,7 @@ pub struct foreign_item {
attrs: ~[Attribute],
node: foreign_item_,
id: NodeId,
span: span,
span: Span,
vis: visibility,
}

View File

@ -13,7 +13,7 @@ use ast::*;
use ast;
use ast_util::{inlined_item_utils, stmt_id};
use ast_util;
use codemap::span;
use codemap::Span;
use codemap;
use diagnostic::span_handler;
use parse::token::ident_interner;
@ -148,7 +148,7 @@ impl Ctx {
fk: &visit::fn_kind,
decl: &fn_decl,
body: &Block,
sp: codemap::span,
sp: codemap::Span,
id: NodeId) {
for a in decl.inputs.iter() {
self.map.insert(a.id, node_arg);
@ -282,7 +282,7 @@ impl Visitor<()> for Ctx {
function_kind: &fn_kind,
function_declaration: &fn_decl,
block: &Block,
span: span,
span: Span,
node_id: NodeId,
_: ()) {
self.map_fn(function_kind, function_declaration, block, span, node_id)
@ -294,7 +294,7 @@ impl Visitor<()> for Ctx {
// XXX: Methods below can become default methods.
fn visit_mod(&mut self, module: &_mod, _: span, _: NodeId, _: ()) {
fn visit_mod(&mut self, module: &_mod, _: Span, _: NodeId, _: ()) {
visit::walk_mod(self, module, ())
}
@ -334,7 +334,7 @@ impl Visitor<()> for Ctx {
function_kind: &fn_kind,
function_declaration: &fn_decl,
block: &Block,
span: span,
span: Span,
node_id: NodeId,
_: ()) {
visit::walk_fn(self,

View File

@ -11,7 +11,7 @@
use ast::*;
use ast;
use ast_util;
use codemap::{span, dummy_sp};
use codemap::{Span, dummy_sp};
use opt_vec;
use parse::token;
use visit::{SimpleVisitor, SimpleVisitorVisitor, Visitor};
@ -217,7 +217,7 @@ pub fn default_block(
}
}
pub fn ident_to_path(s: span, identifier: ident) -> Path {
pub fn ident_to_path(s: Span, identifier: ident) -> Path {
ast::Path {
span: s,
global: false,
@ -231,7 +231,7 @@ pub fn ident_to_path(s: span, identifier: ident) -> Path {
}
}
pub fn ident_to_pat(id: NodeId, s: span, i: ident) -> @pat {
pub fn ident_to_pat(id: NodeId, s: Span, i: ident) -> @pat {
@ast::pat { id: id,
node: pat_ident(bind_infer, ident_to_path(s, i), None),
span: s }
@ -426,7 +426,7 @@ impl IdVisitor {
impl Visitor<()> for IdVisitor {
fn visit_mod(&mut self,
module: &_mod,
_: span,
_: Span,
node_id: NodeId,
env: ()) {
(self.visit_callback)(node_id);
@ -551,7 +551,7 @@ impl Visitor<()> for IdVisitor {
function_kind: &visit::fn_kind,
function_declaration: &fn_decl,
block: &Block,
span: span,
span: Span,
node_id: NodeId,
env: ()) {
if !self.pass_through_items {
@ -691,7 +691,7 @@ struct EachViewItemData {
}
impl SimpleVisitor for EachViewItemData {
fn visit_mod(&mut self, _: &_mod, _: span, _: NodeId) {
fn visit_mod(&mut self, _: &_mod, _: Span, _: NodeId) {
// XXX: Default method.
}
fn visit_view_item(&mut self, view_item: &view_item) {
@ -737,7 +737,7 @@ impl SimpleVisitor for EachViewItemData {
_: &visit::fn_kind,
_: &fn_decl,
_: &Block,
_: span,
_: Span,
_: NodeId) {
// XXX: Default method.
}

View File

@ -14,7 +14,7 @@ use extra;
use ast;
use ast::{Attribute, Attribute_, MetaItem, MetaWord, MetaNameValue, MetaList};
use codemap::{spanned, dummy_spanned};
use codemap::{Spanned, spanned, dummy_spanned};
use codemap::BytePos;
use diagnostic::span_handler;
use parse::comments::{doc_comment_style, strip_doc_comment_decoration};
@ -212,7 +212,7 @@ pub fn sort_meta_items(items: &[@MetaItem]) -> ~[@MetaItem] {
do v.move_iter().map |(_, m)| {
match m.node {
MetaList(n, ref mis) => {
@spanned {
@Spanned {
node: MetaList(n, sort_meta_items(*mis)),
.. /*bad*/ (*m).clone()
}

View File

@ -96,57 +96,57 @@ relative to FileMaps. Methods on the CodeMap can be used to relate spans back
to the original source.
*/
#[deriving(Clone, IterBytes)]
pub struct span {
pub struct Span {
lo: BytePos,
hi: BytePos,
expn_info: Option<@ExpnInfo>
}
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub struct spanned<T> {
pub struct Spanned<T> {
node: T,
span: span,
span: Span,
}
impl cmp::Eq for span {
fn eq(&self, other: &span) -> bool {
impl cmp::Eq for Span {
fn eq(&self, other: &Span) -> bool {
return (*self).lo == (*other).lo && (*self).hi == (*other).hi;
}
fn ne(&self, other: &span) -> bool { !(*self).eq(other) }
fn ne(&self, other: &Span) -> bool { !(*self).eq(other) }
}
impl<S:Encoder> Encodable<S> for span {
impl<S:Encoder> Encodable<S> for Span {
/* Note #1972 -- spans are encoded but not decoded */
fn encode(&self, s: &mut S) {
s.emit_nil()
}
}
impl<D:Decoder> Decodable<D> for span {
fn decode(_d: &mut D) -> span {
impl<D:Decoder> Decodable<D> for Span {
fn decode(_d: &mut D) -> Span {
dummy_sp()
}
}
pub fn spanned<T>(lo: BytePos, hi: BytePos, t: T) -> spanned<T> {
pub fn spanned<T>(lo: BytePos, hi: BytePos, t: T) -> Spanned<T> {
respan(mk_sp(lo, hi), t)
}
pub fn respan<T>(sp: span, t: T) -> spanned<T> {
spanned {node: t, span: sp}
pub fn respan<T>(sp: Span, t: T) -> Spanned<T> {
Spanned {node: t, span: sp}
}
pub fn dummy_spanned<T>(t: T) -> spanned<T> {
pub fn dummy_spanned<T>(t: T) -> Spanned<T> {
respan(dummy_sp(), t)
}
/* assuming that we're not in macro expansion */
pub fn mk_sp(lo: BytePos, hi: BytePos) -> span {
span {lo: lo, hi: hi, expn_info: None}
pub fn mk_sp(lo: BytePos, hi: BytePos) -> Span {
Span {lo: lo, hi: hi, expn_info: None}
}
// make this a const, once the compiler supports it
pub fn dummy_sp() -> span { return mk_sp(BytePos(0), BytePos(0)); }
pub fn dummy_sp() -> Span { return mk_sp(BytePos(0), BytePos(0)); }
@ -174,12 +174,12 @@ pub struct LocWithOpt {
pub struct FileMapAndLine {fm: @FileMap, line: uint}
pub struct FileMapAndBytePos {fm: @FileMap, pos: BytePos}
#[deriving(IterBytes)]
pub struct NameAndSpan {name: @str, span: Option<span>}
pub struct NameAndSpan {name: @str, span: Option<Span>}
/// Extra information for tracking macro expansion of spans
#[deriving(IterBytes)]
pub struct ExpnInfo {
call_site: span,
call_site: Span,
callee: NameAndSpan
}
@ -197,7 +197,7 @@ pub enum FileSubstr {
FssNone,
// indicates that this "file" is actually a substring
// of another file that appears earlier in the codemap
FssInternal(span),
FssInternal(Span),
}
/// Identifies an offset of a multi-byte character in a FileMap
@ -302,7 +302,7 @@ impl CodeMap {
return filemap;
}
pub fn mk_substr_filename(&self, sp: span) -> ~str {
pub fn mk_substr_filename(&self, sp: Span) -> ~str {
let pos = self.lookup_char_pos(sp.lo);
return fmt!("<%s:%u:%u>", pos.file.name,
pos.line, pos.col.to_uint());
@ -328,12 +328,12 @@ impl CodeMap {
}
}
pub fn adjust_span(&self, sp: span) -> span {
pub fn adjust_span(&self, sp: Span) -> Span {
let line = self.lookup_line(sp.lo);
match (line.fm.substr) {
FssNone => sp,
FssInternal(s) => {
self.adjust_span(span {
self.adjust_span(Span {
lo: s.lo + (sp.lo - line.fm.start_pos),
hi: s.lo + (sp.hi - line.fm.start_pos),
expn_info: sp.expn_info
@ -342,7 +342,7 @@ impl CodeMap {
}
}
pub fn span_to_str(&self, sp: span) -> ~str {
pub fn span_to_str(&self, sp: Span) -> ~str {
let files = &*self.files;
if files.len() == 0 && sp == dummy_sp() {
return ~"no-location";
@ -354,12 +354,12 @@ impl CodeMap {
lo.line, lo.col.to_uint(), hi.line, hi.col.to_uint())
}
pub fn span_to_filename(&self, sp: span) -> FileName {
pub fn span_to_filename(&self, sp: Span) -> FileName {
let lo = self.lookup_char_pos(sp.lo);
lo.file.name
}
pub fn span_to_lines(&self, sp: span) -> @FileLines {
pub fn span_to_lines(&self, sp: Span) -> @FileLines {
let lo = self.lookup_char_pos(sp.lo);
let hi = self.lookup_char_pos(sp.hi);
let mut lines = ~[];
@ -369,7 +369,7 @@ impl CodeMap {
return @FileLines {file: lo.file, lines: lines};
}
pub fn span_to_snippet(&self, sp: span) -> Option<~str> {
pub fn span_to_snippet(&self, sp: Span) -> Option<~str> {
let begin = self.lookup_byte_offset(sp.lo);
let end = self.lookup_byte_offset(sp.hi);
@ -446,7 +446,7 @@ impl CodeMap {
};
}
fn span_to_str_no_adj(&self, sp: span) -> ~str {
fn span_to_str_no_adj(&self, sp: Span) -> ~str {
let lo = self.lookup_char_pos(sp.lo);
let hi = self.lookup_char_pos(sp.hi);
return fmt!("%s:%u:%u: %u:%u", lo.file.name,

View File

@ -8,14 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use codemap::{Pos, span};
use codemap::{Pos, Span};
use codemap;
use std::io;
use std::local_data;
use extra::term;
pub type Emitter = @fn(cmsp: Option<(@codemap::CodeMap, span)>,
pub type Emitter = @fn(cmsp: Option<(@codemap::CodeMap, Span)>,
msg: &str,
lvl: level);
@ -35,7 +35,7 @@ pub trait handler {
fn bug(@mut self, msg: &str) -> !;
fn unimpl(@mut self, msg: &str) -> !;
fn emit(@mut self,
cmsp: Option<(@codemap::CodeMap, span)>,
cmsp: Option<(@codemap::CodeMap, Span)>,
msg: &str,
lvl: level);
}
@ -44,12 +44,12 @@ pub trait handler {
// accepts span information for source-location
// reporting.
pub trait span_handler {
fn span_fatal(@mut self, sp: span, msg: &str) -> !;
fn span_err(@mut self, sp: span, msg: &str);
fn span_warn(@mut self, sp: span, msg: &str);
fn span_note(@mut self, sp: span, msg: &str);
fn span_bug(@mut self, sp: span, msg: &str) -> !;
fn span_unimpl(@mut self, sp: span, msg: &str) -> !;
fn span_fatal(@mut self, sp: Span, msg: &str) -> !;
fn span_err(@mut self, sp: Span, msg: &str);
fn span_warn(@mut self, sp: Span, msg: &str);
fn span_note(@mut self, sp: Span, msg: &str);
fn span_bug(@mut self, sp: Span, msg: &str) -> !;
fn span_unimpl(@mut self, sp: Span, msg: &str) -> !;
fn handler(@mut self) -> @mut handler;
}
@ -64,24 +64,24 @@ struct CodemapT {
}
impl span_handler for CodemapT {
fn span_fatal(@mut self, sp: span, msg: &str) -> ! {
fn span_fatal(@mut self, sp: Span, msg: &str) -> ! {
self.handler.emit(Some((self.cm, sp)), msg, fatal);
fail!();
}
fn span_err(@mut self, sp: span, msg: &str) {
fn span_err(@mut self, sp: Span, msg: &str) {
self.handler.emit(Some((self.cm, sp)), msg, error);
self.handler.bump_err_count();
}
fn span_warn(@mut self, sp: span, msg: &str) {
fn span_warn(@mut self, sp: Span, msg: &str) {
self.handler.emit(Some((self.cm, sp)), msg, warning);
}
fn span_note(@mut self, sp: span, msg: &str) {
fn span_note(@mut self, sp: Span, msg: &str) {
self.handler.emit(Some((self.cm, sp)), msg, note);
}
fn span_bug(@mut self, sp: span, msg: &str) -> ! {
fn span_bug(@mut self, sp: Span, msg: &str) -> ! {
self.span_fatal(sp, ice_msg(msg));
}
fn span_unimpl(@mut self, sp: span, msg: &str) -> ! {
fn span_unimpl(@mut self, sp: Span, msg: &str) -> ! {
self.span_bug(sp, ~"unimplemented " + msg);
}
fn handler(@mut self) -> @mut handler {
@ -132,7 +132,7 @@ impl handler for HandlerT {
self.bug(~"unimplemented " + msg);
}
fn emit(@mut self,
cmsp: Option<(@codemap::CodeMap, span)>,
cmsp: Option<(@codemap::CodeMap, Span)>,
msg: &str,
lvl: level) {
(self.emit)(cmsp, msg, lvl);
@ -231,13 +231,13 @@ fn print_diagnostic(topic: &str, lvl: level, msg: &str) {
}
pub fn collect(messages: @mut ~[~str])
-> @fn(Option<(@codemap::CodeMap, span)>, &str, level) {
let f: @fn(Option<(@codemap::CodeMap, span)>, &str, level) =
-> @fn(Option<(@codemap::CodeMap, Span)>, &str, level) {
let f: @fn(Option<(@codemap::CodeMap, Span)>, &str, level) =
|_o, msg: &str, _l| { messages.push(msg.to_str()); };
f
}
pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) {
pub fn emit(cmsp: Option<(@codemap::CodeMap, Span)>, msg: &str, lvl: level) {
match cmsp {
Some((cm, sp)) => {
let sp = cm.adjust_span(sp);
@ -254,7 +254,7 @@ pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) {
}
fn highlight_lines(cm: @codemap::CodeMap,
sp: span, lvl: level,
sp: Span, lvl: level,
lines: @codemap::FileLines) {
let fm = lines.file;
@ -330,7 +330,7 @@ fn highlight_lines(cm: @codemap::CodeMap,
}
}
fn print_macro_backtrace(cm: @codemap::CodeMap, sp: span) {
fn print_macro_backtrace(cm: @codemap::CodeMap, sp: Span) {
for ei in sp.expn_info.iter() {
let ss = ei.callee.span.map_default(~"", |span| cm.span_to_str(*span));
print_diagnostic(ss, note,

View File

@ -13,7 +13,7 @@
*/
use ast;
use codemap::span;
use codemap::Span;
use ext::base;
use ext::base::*;
use parse;
@ -37,7 +37,7 @@ fn next_state(s: State) -> Option<State> {
}
}
pub fn expand_asm(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
-> base::MacResult {
let p = parse::new_parser_from_tts(cx.parse_sess(),
cx.cfg(),

View File

@ -11,12 +11,12 @@
/// Deprecated #[auto_encode] and #[auto_decode] syntax extensions
use ast;
use codemap::span;
use codemap::Span;
use ext::base::*;
pub fn expand_auto_encode(
cx: @ExtCtxt,
span: span,
span: Span,
_mitem: @ast::MetaItem,
in_items: ~[@ast::item]
) -> ~[@ast::item] {
@ -26,7 +26,7 @@ pub fn expand_auto_encode(
pub fn expand_auto_decode(
cx: @ExtCtxt,
span: span,
span: Span,
_mitem: @ast::MetaItem,
in_items: ~[@ast::item]
) -> ~[@ast::item] {

View File

@ -11,7 +11,7 @@
use ast;
use ast::Name;
use codemap;
use codemap::{CodeMap, span, ExpnInfo};
use codemap::{CodeMap, Span, ExpnInfo};
use diagnostic::span_handler;
use ext;
use parse;
@ -35,28 +35,28 @@ pub struct MacroDef {
}
pub type ItemDecorator = @fn(@ExtCtxt,
span,
Span,
@ast::MetaItem,
~[@ast::item])
-> ~[@ast::item];
pub struct SyntaxExpanderTT {
expander: SyntaxExpanderTTFun,
span: Option<span>
span: Option<Span>
}
pub type SyntaxExpanderTTFun = @fn(@ExtCtxt,
span,
Span,
&[ast::token_tree])
-> MacResult;
pub struct SyntaxExpanderTTItem {
expander: SyntaxExpanderTTItemFun,
span: Option<span>
span: Option<Span>
}
pub type SyntaxExpanderTTItemFun = @fn(@ExtCtxt,
span,
Span,
ast::ident,
~[ast::token_tree])
-> MacResult;
@ -247,7 +247,7 @@ impl ExtCtxt {
pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm }
pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess }
pub fn cfg(&self) -> ast::CrateConfig { self.cfg.clone() }
pub fn call_site(&self) -> span {
pub fn call_site(&self) -> Span {
match *self.backtrace {
Some(@ExpnInfo {call_site: cs, _}) => cs,
None => self.bug("missing top span")
@ -263,7 +263,7 @@ impl ExtCtxt {
ExpnInfo {call_site: cs, callee: ref callee} => {
*self.backtrace =
Some(@ExpnInfo {
call_site: span {lo: cs.lo, hi: cs.hi,
call_site: Span {lo: cs.lo, hi: cs.hi,
expn_info: *self.backtrace},
callee: *callee});
}
@ -272,29 +272,29 @@ impl ExtCtxt {
pub fn bt_pop(&self) {
match *self.backtrace {
Some(@ExpnInfo {
call_site: span {expn_info: prev, _}, _}) => {
call_site: Span {expn_info: prev, _}, _}) => {
*self.backtrace = prev
}
_ => self.bug("tried to pop without a push")
}
}
pub fn span_fatal(&self, sp: span, msg: &str) -> ! {
pub fn span_fatal(&self, sp: Span, msg: &str) -> ! {
self.print_backtrace();
self.parse_sess.span_diagnostic.span_fatal(sp, msg);
}
pub fn span_err(&self, sp: span, msg: &str) {
pub fn span_err(&self, sp: Span, msg: &str) {
self.print_backtrace();
self.parse_sess.span_diagnostic.span_err(sp, msg);
}
pub fn span_warn(&self, sp: span, msg: &str) {
pub fn span_warn(&self, sp: Span, msg: &str) {
self.print_backtrace();
self.parse_sess.span_diagnostic.span_warn(sp, msg);
}
pub fn span_unimpl(&self, sp: span, msg: &str) -> ! {
pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! {
self.print_backtrace();
self.parse_sess.span_diagnostic.span_unimpl(sp, msg);
}
pub fn span_bug(&self, sp: span, msg: &str) -> ! {
pub fn span_bug(&self, sp: Span, msg: &str) -> ! {
self.print_backtrace();
self.parse_sess.span_diagnostic.span_bug(sp, msg);
}
@ -329,7 +329,7 @@ pub fn expr_to_str(cx: @ExtCtxt, expr: @ast::expr, err_msg: &str) -> @str {
}
}
pub fn check_zero_tts(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree],
pub fn check_zero_tts(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree],
name: &str) {
if tts.len() != 0 {
cx.span_fatal(sp, fmt!("%s takes no arguments", name));
@ -337,7 +337,7 @@ pub fn check_zero_tts(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree],
}
pub fn get_single_str_from_tts(cx: @ExtCtxt,
sp: span,
sp: Span,
tts: &[ast::token_tree],
name: &str)
-> @str {
@ -352,7 +352,7 @@ pub fn get_single_str_from_tts(cx: @ExtCtxt,
}
pub fn get_exprs_from_tts(cx: @ExtCtxt,
sp: span,
sp: Span,
tts: &[ast::token_tree]) -> ~[@ast::expr] {
let p = parse::new_parser_from_tts(cx.parse_sess(),
cx.cfg(),

View File

@ -12,7 +12,7 @@ use abi::AbiSet;
use ast::ident;
use ast;
use ast_util;
use codemap::{span, respan, dummy_sp};
use codemap::{Span, respan, dummy_sp};
use fold;
use ext::base::ExtCtxt;
use ext::quote::rt::*;
@ -32,10 +32,10 @@ mod syntax {
pub trait AstBuilder {
// paths
fn path(&self, span: span, strs: ~[ast::ident]) -> ast::Path;
fn path_ident(&self, span: span, id: ast::ident) -> ast::Path;
fn path_global(&self, span: span, strs: ~[ast::ident]) -> ast::Path;
fn path_all(&self, sp: span,
fn path(&self, span: Span, strs: ~[ast::ident]) -> ast::Path;
fn path_ident(&self, span: Span, id: ast::ident) -> ast::Path;
fn path_global(&self, span: Span, strs: ~[ast::ident]) -> ast::Path;
fn path_all(&self, sp: Span,
global: bool,
idents: ~[ast::ident],
rp: Option<ast::Lifetime>,
@ -45,37 +45,37 @@ pub trait AstBuilder {
// types
fn ty_mt(&self, ty: ast::Ty, mutbl: ast::mutability) -> ast::mt;
fn ty(&self, span: span, ty: ast::ty_) -> ast::Ty;
fn ty(&self, span: Span, ty: ast::ty_) -> ast::Ty;
fn ty_path(&self, ast::Path, Option<OptVec<ast::TyParamBound>>) -> ast::Ty;
fn ty_ident(&self, span: span, idents: ast::ident) -> ast::Ty;
fn ty_ident(&self, span: Span, idents: ast::ident) -> ast::Ty;
fn ty_rptr(&self, span: span,
fn ty_rptr(&self, span: Span,
ty: ast::Ty,
lifetime: Option<ast::Lifetime>,
mutbl: ast::mutability) -> ast::Ty;
fn ty_uniq(&self, span: span, ty: ast::Ty) -> ast::Ty;
fn ty_box(&self, span: span, ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty;
fn ty_uniq(&self, span: Span, ty: ast::Ty) -> ast::Ty;
fn ty_box(&self, span: Span, ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty;
fn ty_option(&self, ty: ast::Ty) -> ast::Ty;
fn ty_infer(&self, sp: span) -> ast::Ty;
fn ty_infer(&self, sp: Span) -> ast::Ty;
fn ty_nil(&self) -> ast::Ty;
fn ty_vars(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty];
fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[ast::Ty];
fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::TypeField;
fn ty_field_imm(&self, span: Span, name: ident, ty: ast::Ty) -> ast::TypeField;
fn strip_bounds(&self, bounds: &Generics) -> Generics;
fn typaram(&self, id: ast::ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam;
fn trait_ref(&self, path: ast::Path) -> ast::trait_ref;
fn typarambound(&self, path: ast::Path) -> ast::TyParamBound;
fn lifetime(&self, span: span, ident: ast::ident) -> ast::Lifetime;
fn lifetime(&self, span: Span, ident: ast::ident) -> ast::Lifetime;
// statements
fn stmt_expr(&self, expr: @ast::expr) -> @ast::stmt;
fn stmt_let(&self, sp: span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt;
fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt;
fn stmt_let_typed(&self,
sp: span,
sp: Span,
mutbl: bool,
ident: ast::ident,
typ: ast::Ty,
@ -83,165 +83,165 @@ pub trait AstBuilder {
-> @ast::stmt;
// blocks
fn block(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block;
fn block(&self, span: Span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block;
fn block_expr(&self, expr: @ast::expr) -> ast::Block;
fn block_all(&self, span: span,
fn block_all(&self, span: Span,
view_items: ~[ast::view_item],
stmts: ~[@ast::stmt],
expr: Option<@ast::expr>) -> ast::Block;
// expressions
fn expr(&self, span: span, node: ast::expr_) -> @ast::expr;
fn expr(&self, span: Span, node: ast::expr_) -> @ast::expr;
fn expr_path(&self, path: ast::Path) -> @ast::expr;
fn expr_ident(&self, span: span, id: ast::ident) -> @ast::expr;
fn expr_ident(&self, span: Span, id: ast::ident) -> @ast::expr;
fn expr_self(&self, span: span) -> @ast::expr;
fn expr_binary(&self, sp: span, op: ast::binop,
fn expr_self(&self, span: Span) -> @ast::expr;
fn expr_binary(&self, sp: Span, op: ast::binop,
lhs: @ast::expr, rhs: @ast::expr) -> @ast::expr;
fn expr_deref(&self, sp: span, e: @ast::expr) -> @ast::expr;
fn expr_unary(&self, sp: span, op: ast::unop, e: @ast::expr) -> @ast::expr;
fn expr_deref(&self, sp: Span, e: @ast::expr) -> @ast::expr;
fn expr_unary(&self, sp: Span, op: ast::unop, e: @ast::expr) -> @ast::expr;
fn expr_managed(&self, sp: span, e: @ast::expr) -> @ast::expr;
fn expr_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr;
fn expr_mut_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr;
fn expr_field_access(&self, span: span, expr: @ast::expr, ident: ast::ident) -> @ast::expr;
fn expr_call(&self, span: span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr;
fn expr_call_ident(&self, span: span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr;
fn expr_call_global(&self, sp: span, fn_path: ~[ast::ident],
fn expr_managed(&self, sp: Span, e: @ast::expr) -> @ast::expr;
fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr;
fn expr_mut_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr;
fn expr_field_access(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr;
fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr;
fn expr_call_ident(&self, span: Span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr;
fn expr_call_global(&self, sp: Span, fn_path: ~[ast::ident],
args: ~[@ast::expr]) -> @ast::expr;
fn expr_method_call(&self, span: span,
fn expr_method_call(&self, span: Span,
expr: @ast::expr, ident: ast::ident,
args: ~[@ast::expr]) -> @ast::expr;
fn expr_block(&self, b: ast::Block) -> @ast::expr;
fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::Field;
fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr;
fn expr_struct_ident(&self, span: span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr;
fn field_imm(&self, span: Span, name: ident, e: @ast::expr) -> ast::Field;
fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr;
fn expr_struct_ident(&self, span: Span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr;
fn expr_lit(&self, sp: span, lit: ast::lit_) -> @ast::expr;
fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::expr;
fn expr_uint(&self, span: span, i: uint) -> @ast::expr;
fn expr_int(&self, sp: span, i: int) -> @ast::expr;
fn expr_u8(&self, sp: span, u: u8) -> @ast::expr;
fn expr_bool(&self, sp: span, value: bool) -> @ast::expr;
fn expr_uint(&self, span: Span, i: uint) -> @ast::expr;
fn expr_int(&self, sp: Span, i: int) -> @ast::expr;
fn expr_u8(&self, sp: Span, u: u8) -> @ast::expr;
fn expr_bool(&self, sp: Span, value: bool) -> @ast::expr;
fn expr_vstore(&self, sp: span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr;
fn expr_vec(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr;
fn expr_vec_uniq(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr;
fn expr_vec_slice(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr;
fn expr_str(&self, sp: span, s: @str) -> @ast::expr;
fn expr_str_uniq(&self, sp: span, s: @str) -> @ast::expr;
fn expr_vstore(&self, sp: Span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr;
fn expr_vec(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr;
fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr;
fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr;
fn expr_str(&self, sp: Span, s: @str) -> @ast::expr;
fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::expr;
fn expr_unreachable(&self, span: span) -> @ast::expr;
fn expr_unreachable(&self, span: Span) -> @ast::expr;
fn pat(&self, span: span, pat: ast::pat_) -> @ast::pat;
fn pat_wild(&self, span: span) -> @ast::pat;
fn pat_lit(&self, span: span, expr: @ast::expr) -> @ast::pat;
fn pat_ident(&self, span: span, ident: ast::ident) -> @ast::pat;
fn pat(&self, span: Span, pat: ast::pat_) -> @ast::pat;
fn pat_wild(&self, span: Span) -> @ast::pat;
fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat;
fn pat_ident(&self, span: Span, ident: ast::ident) -> @ast::pat;
fn pat_ident_binding_mode(&self,
span: span,
span: Span,
ident: ast::ident,
bm: ast::binding_mode) -> @ast::pat;
fn pat_enum(&self, span: span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat;
fn pat_struct(&self, span: span,
fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat;
fn pat_struct(&self, span: Span,
path: ast::Path, field_pats: ~[ast::field_pat]) -> @ast::pat;
fn arm(&self, span: span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm;
fn arm_unreachable(&self, span: span) -> ast::arm;
fn arm(&self, span: Span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm;
fn arm_unreachable(&self, span: Span) -> ast::arm;
fn expr_match(&self, span: span, arg: @ast::expr, arms: ~[ast::arm]) -> @ast::expr;
fn expr_if(&self, span: span,
fn expr_match(&self, span: Span, arg: @ast::expr, arms: ~[ast::arm]) -> @ast::expr;
fn expr_if(&self, span: Span,
cond: @ast::expr, then: @ast::expr, els: Option<@ast::expr>) -> @ast::expr;
fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr;
fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr;
fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr;
fn lambda0(&self, span: span, blk: ast::Block) -> @ast::expr;
fn lambda1(&self, span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr;
fn lambda(&self, span: Span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr;
fn lambda0(&self, span: Span, blk: ast::Block) -> @ast::expr;
fn lambda1(&self, span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr;
fn lambda_expr(&self, span: span, ids: ~[ast::ident], blk: @ast::expr) -> @ast::expr;
fn lambda_expr_0(&self, span: span, expr: @ast::expr) -> @ast::expr;
fn lambda_expr_1(&self, span: span, expr: @ast::expr, ident: ast::ident) -> @ast::expr;
fn lambda_expr(&self, span: Span, ids: ~[ast::ident], blk: @ast::expr) -> @ast::expr;
fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr;
fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr;
fn lambda_stmts(&self, span: span, ids: ~[ast::ident], blk: ~[@ast::stmt]) -> @ast::expr;
fn lambda_stmts_0(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr;
fn lambda_stmts_1(&self, span: span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr;
fn lambda_stmts(&self, span: Span, ids: ~[ast::ident], blk: ~[@ast::stmt]) -> @ast::expr;
fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr;
fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr;
// items
fn item(&self, span: span,
fn item(&self, span: Span,
name: ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item;
fn arg(&self, span: span, name: ident, ty: ast::Ty) -> ast::arg;
fn arg(&self, span: Span, name: ident, ty: ast::Ty) -> ast::arg;
// XXX unused self
fn fn_decl(&self, inputs: ~[ast::arg], output: ast::Ty) -> ast::fn_decl;
fn item_fn_poly(&self,
span: span,
span: Span,
name: ident,
inputs: ~[ast::arg],
output: ast::Ty,
generics: Generics,
body: ast::Block) -> @ast::item;
fn item_fn(&self,
span: span,
span: Span,
name: ident,
inputs: ~[ast::arg],
output: ast::Ty,
body: ast::Block) -> @ast::item;
fn variant(&self, span: span, name: ident, tys: ~[ast::Ty]) -> ast::variant;
fn variant(&self, span: Span, name: ident, tys: ~[ast::Ty]) -> ast::variant;
fn item_enum_poly(&self,
span: span,
span: Span,
name: ident,
enum_definition: ast::enum_def,
generics: Generics) -> @ast::item;
fn item_enum(&self, span: span, name: ident, enum_def: ast::enum_def) -> @ast::item;
fn item_enum(&self, span: Span, name: ident, enum_def: ast::enum_def) -> @ast::item;
fn item_struct_poly(&self,
span: span,
span: Span,
name: ident,
struct_def: ast::struct_def,
generics: Generics) -> @ast::item;
fn item_struct(&self, span: span, name: ident, struct_def: ast::struct_def) -> @ast::item;
fn item_struct(&self, span: Span, name: ident, struct_def: ast::struct_def) -> @ast::item;
fn item_mod(&self, span: span,
fn item_mod(&self, span: Span,
name: ident, attrs: ~[ast::Attribute],
vi: ~[ast::view_item], items: ~[@ast::item]) -> @ast::item;
fn item_ty_poly(&self,
span: span,
span: Span,
name: ident,
ty: ast::Ty,
generics: Generics) -> @ast::item;
fn item_ty(&self, span: span, name: ident, ty: ast::Ty) -> @ast::item;
fn item_ty(&self, span: Span, name: ident, ty: ast::Ty) -> @ast::item;
fn attribute(&self, sp: span, mi: @ast::MetaItem) -> ast::Attribute;
fn attribute(&self, sp: Span, mi: @ast::MetaItem) -> ast::Attribute;
fn meta_word(&self, sp: span, w: @str) -> @ast::MetaItem;
fn meta_list(&self, sp: span, name: @str, mis: ~[@ast::MetaItem]) -> @ast::MetaItem;
fn meta_name_value(&self, sp: span, name: @str, value: ast::lit_) -> @ast::MetaItem;
fn meta_word(&self, sp: Span, w: @str) -> @ast::MetaItem;
fn meta_list(&self, sp: Span, name: @str, mis: ~[@ast::MetaItem]) -> @ast::MetaItem;
fn meta_name_value(&self, sp: Span, name: @str, value: ast::lit_) -> @ast::MetaItem;
fn view_use(&self, sp: span,
fn view_use(&self, sp: Span,
vis: ast::visibility, vp: ~[@ast::view_path]) -> ast::view_item;
fn view_use_list(&self, sp: span, vis: ast::visibility,
fn view_use_list(&self, sp: Span, vis: ast::visibility,
path: ~[ast::ident], imports: &[ast::ident]) -> ast::view_item;
fn view_use_glob(&self, sp: span,
fn view_use_glob(&self, sp: Span,
vis: ast::visibility, path: ~[ast::ident]) -> ast::view_item;
}
impl AstBuilder for @ExtCtxt {
fn path(&self, span: span, strs: ~[ast::ident]) -> ast::Path {
fn path(&self, span: Span, strs: ~[ast::ident]) -> ast::Path {
self.path_all(span, false, strs, None, ~[])
}
fn path_ident(&self, span: span, id: ast::ident) -> ast::Path {
fn path_ident(&self, span: Span, id: ast::ident) -> ast::Path {
self.path(span, ~[id])
}
fn path_global(&self, span: span, strs: ~[ast::ident]) -> ast::Path {
fn path_global(&self, span: Span, strs: ~[ast::ident]) -> ast::Path {
self.path_all(span, true, strs, None, ~[])
}
fn path_all(&self,
sp: span,
sp: Span,
global: bool,
mut idents: ~[ast::ident],
rp: Option<ast::Lifetime>,
@ -275,7 +275,7 @@ impl AstBuilder for @ExtCtxt {
}
}
fn ty(&self, span: span, ty: ast::ty_) -> ast::Ty {
fn ty(&self, span: Span, ty: ast::ty_) -> ast::Ty {
ast::Ty {
id: self.next_id(),
span: span,
@ -291,13 +291,13 @@ impl AstBuilder for @ExtCtxt {
// Might need to take bounds as an argument in the future, if you ever want
// to generate a bounded existential trait type.
fn ty_ident(&self, span: span, ident: ast::ident)
fn ty_ident(&self, span: Span, ident: ast::ident)
-> ast::Ty {
self.ty_path(self.path_ident(span, ident), None)
}
fn ty_rptr(&self,
span: span,
span: Span,
ty: ast::Ty,
lifetime: Option<ast::Lifetime>,
mutbl: ast::mutability)
@ -305,10 +305,10 @@ impl AstBuilder for @ExtCtxt {
self.ty(span,
ast::ty_rptr(lifetime, self.ty_mt(ty, mutbl)))
}
fn ty_uniq(&self, span: span, ty: ast::Ty) -> ast::Ty {
fn ty_uniq(&self, span: Span, ty: ast::Ty) -> ast::Ty {
self.ty(span, ast::ty_uniq(self.ty_mt(ty, ast::m_imm)))
}
fn ty_box(&self, span: span,
fn ty_box(&self, span: Span,
ty: ast::Ty, mutbl: ast::mutability) -> ast::Ty {
self.ty(span, ast::ty_box(self.ty_mt(ty, mutbl)))
}
@ -326,7 +326,7 @@ impl AstBuilder for @ExtCtxt {
~[ ty ]), None)
}
fn ty_field_imm(&self, span: span, name: ident, ty: ast::Ty) -> ast::TypeField {
fn ty_field_imm(&self, span: Span, name: ident, ty: ast::Ty) -> ast::TypeField {
ast::TypeField {
ident: name,
mt: ast::mt { ty: ~ty, mutbl: ast::m_imm },
@ -334,7 +334,7 @@ impl AstBuilder for @ExtCtxt {
}
}
fn ty_infer(&self, span: span) -> ast::Ty {
fn ty_infer(&self, span: Span) -> ast::Ty {
self.ty(span, ast::ty_infer)
}
@ -385,7 +385,7 @@ impl AstBuilder for @ExtCtxt {
ast::TraitTyParamBound(self.trait_ref(path))
}
fn lifetime(&self, span: span, ident: ast::ident) -> ast::Lifetime {
fn lifetime(&self, span: Span, ident: ast::ident) -> ast::Lifetime {
ast::Lifetime { id: self.next_id(), span: span, ident: ident }
}
@ -393,7 +393,7 @@ impl AstBuilder for @ExtCtxt {
@respan(expr.span, ast::stmt_semi(expr, self.next_id()))
}
fn stmt_let(&self, sp: span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt {
fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt {
let pat = self.pat_ident(sp, ident);
let local = @ast::Local {
is_mutbl: mutbl,
@ -408,7 +408,7 @@ impl AstBuilder for @ExtCtxt {
}
fn stmt_let_typed(&self,
sp: span,
sp: Span,
mutbl: bool,
ident: ast::ident,
typ: ast::Ty,
@ -427,7 +427,7 @@ impl AstBuilder for @ExtCtxt {
@respan(sp, ast::stmt_decl(@decl, self.next_id()))
}
fn block(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::Block {
fn block(&self, span: Span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::Block {
self.block_all(span, ~[], stmts, expr)
}
@ -435,7 +435,7 @@ impl AstBuilder for @ExtCtxt {
self.block_all(expr.span, ~[], ~[], Some(expr))
}
fn block_all(&self,
span: span,
span: Span,
view_items: ~[ast::view_item],
stmts: ~[@ast::stmt],
expr: Option<@ast::expr>) -> ast::Block {
@ -449,7 +449,7 @@ impl AstBuilder for @ExtCtxt {
}
}
fn expr(&self, span: span, node: ast::expr_) -> @ast::expr {
fn expr(&self, span: Span, node: ast::expr_) -> @ast::expr {
@ast::expr {
id: self.next_id(),
node: node,
@ -461,53 +461,53 @@ impl AstBuilder for @ExtCtxt {
self.expr(path.span, ast::expr_path(path))
}
fn expr_ident(&self, span: span, id: ast::ident) -> @ast::expr {
fn expr_ident(&self, span: Span, id: ast::ident) -> @ast::expr {
self.expr_path(self.path_ident(span, id))
}
fn expr_self(&self, span: span) -> @ast::expr {
fn expr_self(&self, span: Span) -> @ast::expr {
self.expr(span, ast::expr_self)
}
fn expr_binary(&self, sp: span, op: ast::binop,
fn expr_binary(&self, sp: Span, op: ast::binop,
lhs: @ast::expr, rhs: @ast::expr) -> @ast::expr {
self.expr(sp, ast::expr_binary(self.next_id(), op, lhs, rhs))
}
fn expr_deref(&self, sp: span, e: @ast::expr) -> @ast::expr {
fn expr_deref(&self, sp: Span, e: @ast::expr) -> @ast::expr {
self.expr_unary(sp, ast::deref, e)
}
fn expr_unary(&self, sp: span, op: ast::unop, e: @ast::expr)
fn expr_unary(&self, sp: Span, op: ast::unop, e: @ast::expr)
-> @ast::expr {
self.expr(sp, ast::expr_unary(self.next_id(), op, e))
}
fn expr_managed(&self, sp: span, e: @ast::expr) -> @ast::expr {
fn expr_managed(&self, sp: Span, e: @ast::expr) -> @ast::expr {
self.expr_unary(sp, ast::box(ast::m_imm), e)
}
fn expr_field_access(&self, sp: span, expr: @ast::expr, ident: ast::ident) -> @ast::expr {
fn expr_field_access(&self, sp: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr {
self.expr(sp, ast::expr_field(expr, ident, ~[]))
}
fn expr_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr {
fn expr_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr {
self.expr(sp, ast::expr_addr_of(ast::m_imm, e))
}
fn expr_mut_addr_of(&self, sp: span, e: @ast::expr) -> @ast::expr {
fn expr_mut_addr_of(&self, sp: Span, e: @ast::expr) -> @ast::expr {
self.expr(sp, ast::expr_addr_of(ast::m_mutbl, e))
}
fn expr_call(&self, span: span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr {
fn expr_call(&self, span: Span, expr: @ast::expr, args: ~[@ast::expr]) -> @ast::expr {
self.expr(span, ast::expr_call(expr, args, ast::NoSugar))
}
fn expr_call_ident(&self, span: span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr {
fn expr_call_ident(&self, span: Span, id: ast::ident, args: ~[@ast::expr]) -> @ast::expr {
self.expr(span,
ast::expr_call(self.expr_ident(span, id), args, ast::NoSugar))
}
fn expr_call_global(&self, sp: span, fn_path: ~[ast::ident],
fn expr_call_global(&self, sp: Span, fn_path: ~[ast::ident],
args: ~[@ast::expr]) -> @ast::expr {
let pathexpr = self.expr_path(self.path_global(sp, fn_path));
self.expr_call(sp, pathexpr, args)
}
fn expr_method_call(&self, span: span,
fn expr_method_call(&self, span: Span,
expr: @ast::expr,
ident: ast::ident,
args: ~[@ast::expr]) -> @ast::expr {
@ -517,54 +517,54 @@ impl AstBuilder for @ExtCtxt {
fn expr_block(&self, b: ast::Block) -> @ast::expr {
self.expr(b.span, ast::expr_block(b))
}
fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::Field {
fn field_imm(&self, span: Span, name: ident, e: @ast::expr) -> ast::Field {
ast::Field { ident: name, expr: e, span: span }
}
fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr {
fn expr_struct(&self, span: Span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr {
self.expr(span, ast::expr_struct(path, fields, None))
}
fn expr_struct_ident(&self, span: span,
fn expr_struct_ident(&self, span: Span,
id: ast::ident, fields: ~[ast::Field]) -> @ast::expr {
self.expr_struct(span, self.path_ident(span, id), fields)
}
fn expr_lit(&self, sp: span, lit: ast::lit_) -> @ast::expr {
fn expr_lit(&self, sp: Span, lit: ast::lit_) -> @ast::expr {
self.expr(sp, ast::expr_lit(@respan(sp, lit)))
}
fn expr_uint(&self, span: span, i: uint) -> @ast::expr {
fn expr_uint(&self, span: Span, i: uint) -> @ast::expr {
self.expr_lit(span, ast::lit_uint(i as u64, ast::ty_u))
}
fn expr_int(&self, sp: span, i: int) -> @ast::expr {
fn expr_int(&self, sp: Span, i: int) -> @ast::expr {
self.expr_lit(sp, ast::lit_int(i as i64, ast::ty_i))
}
fn expr_u8(&self, sp: span, u: u8) -> @ast::expr {
fn expr_u8(&self, sp: Span, u: u8) -> @ast::expr {
self.expr_lit(sp, ast::lit_uint(u as u64, ast::ty_u8))
}
fn expr_bool(&self, sp: span, value: bool) -> @ast::expr {
fn expr_bool(&self, sp: Span, value: bool) -> @ast::expr {
self.expr_lit(sp, ast::lit_bool(value))
}
fn expr_vstore(&self, sp: span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr {
fn expr_vstore(&self, sp: Span, expr: @ast::expr, vst: ast::expr_vstore) -> @ast::expr {
self.expr(sp, ast::expr_vstore(expr, vst))
}
fn expr_vec(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr {
fn expr_vec(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr {
self.expr(sp, ast::expr_vec(exprs, ast::m_imm))
}
fn expr_vec_uniq(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr {
fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr {
self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::expr_vstore_uniq)
}
fn expr_vec_slice(&self, sp: span, exprs: ~[@ast::expr]) -> @ast::expr {
fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::expr]) -> @ast::expr {
self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::expr_vstore_slice)
}
fn expr_str(&self, sp: span, s: @str) -> @ast::expr {
fn expr_str(&self, sp: Span, s: @str) -> @ast::expr {
self.expr_lit(sp, ast::lit_str(s))
}
fn expr_str_uniq(&self, sp: span, s: @str) -> @ast::expr {
fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::expr {
self.expr_vstore(sp, self.expr_str(sp, s), ast::expr_vstore_uniq)
}
fn expr_unreachable(&self, span: span) -> @ast::expr {
fn expr_unreachable(&self, span: Span) -> @ast::expr {
let loc = self.codemap().lookup_char_pos(span.lo);
self.expr_call_global(
span,
@ -582,38 +582,38 @@ impl AstBuilder for @ExtCtxt {
}
fn pat(&self, span: span, pat: ast::pat_) -> @ast::pat {
fn pat(&self, span: Span, pat: ast::pat_) -> @ast::pat {
@ast::pat { id: self.next_id(), node: pat, span: span }
}
fn pat_wild(&self, span: span) -> @ast::pat {
fn pat_wild(&self, span: Span) -> @ast::pat {
self.pat(span, ast::pat_wild)
}
fn pat_lit(&self, span: span, expr: @ast::expr) -> @ast::pat {
fn pat_lit(&self, span: Span, expr: @ast::expr) -> @ast::pat {
self.pat(span, ast::pat_lit(expr))
}
fn pat_ident(&self, span: span, ident: ast::ident) -> @ast::pat {
fn pat_ident(&self, span: Span, ident: ast::ident) -> @ast::pat {
self.pat_ident_binding_mode(span, ident, ast::bind_infer)
}
fn pat_ident_binding_mode(&self,
span: span,
span: Span,
ident: ast::ident,
bm: ast::binding_mode) -> @ast::pat {
let path = self.path_ident(span, ident);
let pat = ast::pat_ident(bm, path, None);
self.pat(span, pat)
}
fn pat_enum(&self, span: span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat {
fn pat_enum(&self, span: Span, path: ast::Path, subpats: ~[@ast::pat]) -> @ast::pat {
let pat = ast::pat_enum(path, Some(subpats));
self.pat(span, pat)
}
fn pat_struct(&self, span: span,
fn pat_struct(&self, span: Span,
path: ast::Path, field_pats: ~[ast::field_pat]) -> @ast::pat {
let pat = ast::pat_struct(path, field_pats, false);
self.pat(span, pat)
}
fn arm(&self, _span: span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm {
fn arm(&self, _span: Span, pats: ~[@ast::pat], expr: @ast::expr) -> ast::arm {
ast::arm {
pats: pats,
guard: None,
@ -621,24 +621,24 @@ impl AstBuilder for @ExtCtxt {
}
}
fn arm_unreachable(&self, span: span) -> ast::arm {
fn arm_unreachable(&self, span: Span) -> ast::arm {
self.arm(span, ~[self.pat_wild(span)], self.expr_unreachable(span))
}
fn expr_match(&self, span: span, arg: @ast::expr, arms: ~[ast::arm]) -> @expr {
fn expr_match(&self, span: Span, arg: @ast::expr, arms: ~[ast::arm]) -> @expr {
self.expr(span, ast::expr_match(arg, arms))
}
fn expr_if(&self, span: span,
fn expr_if(&self, span: Span,
cond: @ast::expr, then: @ast::expr, els: Option<@ast::expr>) -> @ast::expr {
let els = els.map_move(|x| self.expr_block(self.block_expr(x)));
self.expr(span, ast::expr_if(cond, self.block_expr(then), els))
}
fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr {
fn lambda_fn_decl(&self, span: Span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr {
self.expr(span, ast::expr_fn_block(fn_decl, blk))
}
fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr {
fn lambda(&self, span: Span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr {
let fn_decl = self.fn_decl(
ids.map(|id| self.arg(span, *id, self.ty_infer(span))),
self.ty_infer(span));
@ -646,50 +646,50 @@ impl AstBuilder for @ExtCtxt {
self.expr(span, ast::expr_fn_block(fn_decl, blk))
}
#[cfg(stage0)]
fn lambda0(&self, _span: span, blk: ast::Block) -> @ast::expr {
fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::expr {
let ext_cx = *self;
let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
quote_expr!(|| $blk_e )
}
#[cfg(not(stage0))]
fn lambda0(&self, _span: span, blk: ast::Block) -> @ast::expr {
fn lambda0(&self, _span: Span, blk: ast::Block) -> @ast::expr {
let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
quote_expr!(*self, || $blk_e )
}
#[cfg(stage0)]
fn lambda1(&self, _span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr {
fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr {
let ext_cx = *self;
let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
quote_expr!(|$ident| $blk_e )
}
#[cfg(not(stage0))]
fn lambda1(&self, _span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr {
fn lambda1(&self, _span: Span, blk: ast::Block, ident: ast::ident) -> @ast::expr {
let blk_e = self.expr(blk.span, ast::expr_block(blk.clone()));
quote_expr!(*self, |$ident| $blk_e )
}
fn lambda_expr(&self, span: span, ids: ~[ast::ident], expr: @ast::expr) -> @ast::expr {
fn lambda_expr(&self, span: Span, ids: ~[ast::ident], expr: @ast::expr) -> @ast::expr {
self.lambda(span, ids, self.block_expr(expr))
}
fn lambda_expr_0(&self, span: span, expr: @ast::expr) -> @ast::expr {
fn lambda_expr_0(&self, span: Span, expr: @ast::expr) -> @ast::expr {
self.lambda0(span, self.block_expr(expr))
}
fn lambda_expr_1(&self, span: span, expr: @ast::expr, ident: ast::ident) -> @ast::expr {
fn lambda_expr_1(&self, span: Span, expr: @ast::expr, ident: ast::ident) -> @ast::expr {
self.lambda1(span, self.block_expr(expr), ident)
}
fn lambda_stmts(&self, span: span, ids: ~[ast::ident], stmts: ~[@ast::stmt]) -> @ast::expr {
fn lambda_stmts(&self, span: Span, ids: ~[ast::ident], stmts: ~[@ast::stmt]) -> @ast::expr {
self.lambda(span, ids, self.block(span, stmts, None))
}
fn lambda_stmts_0(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr {
fn lambda_stmts_0(&self, span: Span, stmts: ~[@ast::stmt]) -> @ast::expr {
self.lambda0(span, self.block(span, stmts, None))
}
fn lambda_stmts_1(&self, span: span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr {
fn lambda_stmts_1(&self, span: Span, stmts: ~[@ast::stmt], ident: ast::ident) -> @ast::expr {
self.lambda1(span, self.block(span, stmts, None), ident)
}
fn arg(&self, span: span, ident: ast::ident, ty: ast::Ty) -> ast::arg {
fn arg(&self, span: Span, ident: ast::ident, ty: ast::Ty) -> ast::arg {
let arg_pat = self.pat_ident(span, ident);
ast::arg {
is_mutbl: false,
@ -708,7 +708,7 @@ impl AstBuilder for @ExtCtxt {
}
}
fn item(&self, span: span,
fn item(&self, span: Span,
name: ident, attrs: ~[ast::Attribute], node: ast::item_) -> @ast::item {
// XXX: Would be nice if our generated code didn't violate
// Rust coding conventions
@ -721,7 +721,7 @@ impl AstBuilder for @ExtCtxt {
}
fn item_fn_poly(&self,
span: span,
span: Span,
name: ident,
inputs: ~[ast::arg],
output: ast::Ty,
@ -738,7 +738,7 @@ impl AstBuilder for @ExtCtxt {
}
fn item_fn(&self,
span: span,
span: Span,
name: ident,
inputs: ~[ast::arg],
output: ast::Ty,
@ -753,7 +753,7 @@ impl AstBuilder for @ExtCtxt {
body)
}
fn variant(&self, span: span, name: ident, tys: ~[ast::Ty]) -> ast::variant {
fn variant(&self, span: Span, name: ident, tys: ~[ast::Ty]) -> ast::variant {
let args = tys.move_iter().map(|ty| {
ast::variant_arg { ty: ty, id: self.next_id() }
}).collect();
@ -769,13 +769,13 @@ impl AstBuilder for @ExtCtxt {
})
}
fn item_enum_poly(&self, span: span, name: ident,
fn item_enum_poly(&self, span: Span, name: ident,
enum_definition: ast::enum_def,
generics: Generics) -> @ast::item {
self.item(span, name, ~[], ast::item_enum(enum_definition, generics))
}
fn item_enum(&self, span: span, name: ident,
fn item_enum(&self, span: Span, name: ident,
enum_definition: ast::enum_def) -> @ast::item {
self.item_enum_poly(span, name, enum_definition,
ast_util::empty_generics())
@ -783,7 +783,7 @@ impl AstBuilder for @ExtCtxt {
fn item_struct(
&self,
span: span,
span: Span,
name: ident,
struct_def: ast::struct_def
) -> @ast::item {
@ -797,7 +797,7 @@ impl AstBuilder for @ExtCtxt {
fn item_struct_poly(
&self,
span: span,
span: Span,
name: ident,
struct_def: ast::struct_def,
generics: Generics
@ -805,7 +805,7 @@ impl AstBuilder for @ExtCtxt {
self.item(span, name, ~[], ast::item_struct(@struct_def, generics))
}
fn item_mod(&self, span: span, name: ident,
fn item_mod(&self, span: Span, name: ident,
attrs: ~[ast::Attribute],
vi: ~[ast::view_item],
items: ~[@ast::item]) -> @ast::item {
@ -820,16 +820,16 @@ impl AstBuilder for @ExtCtxt {
)
}
fn item_ty_poly(&self, span: span, name: ident, ty: ast::Ty,
fn item_ty_poly(&self, span: Span, name: ident, ty: ast::Ty,
generics: Generics) -> @ast::item {
self.item(span, name, ~[], ast::item_ty(ty, generics))
}
fn item_ty(&self, span: span, name: ident, ty: ast::Ty) -> @ast::item {
fn item_ty(&self, span: Span, name: ident, ty: ast::Ty) -> @ast::item {
self.item_ty_poly(span, name, ty, ast_util::empty_generics())
}
fn attribute(&self, sp: span, mi: @ast::MetaItem) -> ast::Attribute {
fn attribute(&self, sp: Span, mi: @ast::MetaItem) -> ast::Attribute {
respan(sp, ast::Attribute_ {
style: ast::AttrOuter,
value: mi,
@ -837,17 +837,17 @@ impl AstBuilder for @ExtCtxt {
})
}
fn meta_word(&self, sp: span, w: @str) -> @ast::MetaItem {
fn meta_word(&self, sp: Span, w: @str) -> @ast::MetaItem {
@respan(sp, ast::MetaWord(w))
}
fn meta_list(&self, sp: span, name: @str, mis: ~[@ast::MetaItem]) -> @ast::MetaItem {
fn meta_list(&self, sp: Span, name: @str, mis: ~[@ast::MetaItem]) -> @ast::MetaItem {
@respan(sp, ast::MetaList(name, mis))
}
fn meta_name_value(&self, sp: span, name: @str, value: ast::lit_) -> @ast::MetaItem {
fn meta_name_value(&self, sp: Span, name: @str, value: ast::lit_) -> @ast::MetaItem {
@respan(sp, ast::MetaNameValue(name, respan(sp, value)))
}
fn view_use(&self, sp: span,
fn view_use(&self, sp: Span,
vis: ast::visibility, vp: ~[@ast::view_path]) -> ast::view_item {
ast::view_item {
node: ast::view_item_use(vp),
@ -857,7 +857,7 @@ impl AstBuilder for @ExtCtxt {
}
}
fn view_use_list(&self, sp: span, vis: ast::visibility,
fn view_use_list(&self, sp: Span, vis: ast::visibility,
path: ~[ast::ident], imports: &[ast::ident]) -> ast::view_item {
let imports = do imports.map |id| {
respan(sp, ast::path_list_ident_ { name: *id, id: self.next_id() })
@ -870,7 +870,7 @@ impl AstBuilder for @ExtCtxt {
self.next_id()))])
}
fn view_use_glob(&self, sp: span,
fn view_use_glob(&self, sp: Span,
vis: ast::visibility, path: ~[ast::ident]) -> ast::view_item {
self.view_use(sp, vis,
~[@respan(sp,

View File

@ -11,12 +11,12 @@
/* The compiler code necessary to support the bytes! extension. */
use ast;
use codemap::span;
use codemap::Span;
use ext::base::*;
use ext::base;
use ext::build::AstBuilder;
pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) -> base::MacResult {
pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult {
// Gather all argument expressions
let exprs = get_exprs_from_tts(cx, sp, tts);
let mut bytes = ~[];

View File

@ -15,7 +15,7 @@ match the current compilation environment.
*/
use ast;
use codemap::span;
use codemap::Span;
use ext::base::*;
use ext::base;
use ext::build::AstBuilder;
@ -25,7 +25,7 @@ use parse;
use parse::token;
use parse::attr::parser_attr;
pub fn expand_cfg(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) -> base::MacResult {
pub fn expand_cfg(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) -> base::MacResult {
let p = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts.to_owned());
let mut cfgs = ~[];

View File

@ -9,14 +9,14 @@
// except according to those terms.
use ast;
use codemap::span;
use codemap::Span;
use ext::base::*;
use ext::base;
use opt_vec;
use parse::token;
use parse::token::{str_to_ident};
pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
-> base::MacResult {
let mut res_str = ~"";
for (i, e) in tts.iter().enumerate() {

View File

@ -9,13 +9,13 @@
// except according to those terms.
use ast::{MetaItem, item, expr};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
pub fn expand_deriving_clone(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item])
-> ~[@item] {
@ -40,7 +40,7 @@ pub fn expand_deriving_clone(cx: @ExtCtxt,
}
pub fn expand_deriving_deep_clone(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item])
-> ~[@item] {
@ -68,7 +68,7 @@ pub fn expand_deriving_deep_clone(cx: @ExtCtxt,
fn cs_clone(
name: &str,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
substr: &Substructure) -> @expr {
let clone_ident = substr.method_ident;
let ctor_ident;

View File

@ -9,22 +9,22 @@
// except according to those terms.
use ast::{MetaItem, item, expr};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
pub fn expand_deriving_eq(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item]) -> ~[@item] {
// structures are equal if all fields are equal, and non equal, if
// any fields are not equal or if the enum variants are different
fn cs_eq(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
fn cs_eq(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr {
cs_and(|cx, span, _, _| cx.expr_bool(span, false),
cx, span, substr)
}
fn cs_ne(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
fn cs_ne(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr {
cs_or(|cx, span, _, _| cx.expr_bool(span, true),
cx, span, substr)
}

View File

@ -10,13 +10,13 @@
use ast;
use ast::{MetaItem, item, expr};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
pub fn expand_deriving_ord(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item]) -> ~[@item] {
macro_rules! md (
@ -48,7 +48,7 @@ pub fn expand_deriving_ord(cx: @ExtCtxt,
}
/// Strict inequality.
fn cs_op(less: bool, equal: bool, cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
fn cs_op(less: bool, equal: bool, cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr {
let op = if less {ast::lt} else {ast::gt};
cs_fold(
false, // need foldr,

View File

@ -9,16 +9,16 @@
// except according to those terms.
use ast::{MetaItem, item, expr};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
pub fn expand_deriving_totaleq(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item]) -> ~[@item] {
fn cs_equals(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
fn cs_equals(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr {
cs_and(|cx, span, _, _| cx.expr_bool(span, false),
cx, span, substr)
}

View File

@ -10,14 +10,14 @@
use ast;
use ast::{MetaItem, item, expr};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
use std::cmp::{Ordering, Equal, Less, Greater};
pub fn expand_deriving_totalord(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item]) -> ~[@item] {
let trait_def = TraitDef {
@ -41,7 +41,7 @@ pub fn expand_deriving_totalord(cx: @ExtCtxt,
}
pub fn ordering_const(cx: @ExtCtxt, span: span, cnst: Ordering) -> ast::Path {
pub fn ordering_const(cx: @ExtCtxt, span: Span, cnst: Ordering) -> ast::Path {
let cnst = match cnst {
Less => "Less",
Equal => "Equal",
@ -53,7 +53,7 @@ pub fn ordering_const(cx: @ExtCtxt, span: span, cnst: Ordering) -> ast::Path {
cx.ident_of(cnst)])
}
pub fn cs_cmp(cx: @ExtCtxt, span: span,
pub fn cs_cmp(cx: @ExtCtxt, span: Span,
substr: &Substructure) -> @expr {
let test_id = cx.ident_of("__test");
let equals_path = ordering_const(cx, span, Equal);

View File

@ -16,13 +16,13 @@ encodable.rs for more.
use std::vec;
use ast::{MetaItem, item, expr, m_mutbl};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
pub fn expand_deriving_decodable(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item]) -> ~[@item] {
let trait_def = TraitDef {
@ -50,7 +50,7 @@ pub fn expand_deriving_decodable(cx: @ExtCtxt,
trait_def.expand(cx, span, mitem, in_items)
}
fn decodable_substructure(cx: @ExtCtxt, span: span,
fn decodable_substructure(cx: @ExtCtxt, span: Span,
substr: &Substructure) -> @expr {
let decoder = substr.nonself_args[0];
let recurse = ~[cx.ident_of("extra"),

View File

@ -44,7 +44,7 @@ Other interesting scenarios are whe the item has type parameters or
references other non-built-in types. A type definition like:
#[deriving(Encodable, Decodable)]
struct spanned<T> {node: T, span: span}
struct spanned<T> {node: T, span: Span}
would yield functions like:
@ -76,13 +76,13 @@ would yield functions like:
*/
use ast::{MetaItem, item, expr, m_imm, m_mutbl};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
pub fn expand_deriving_encodable(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item]) -> ~[@item] {
let trait_def = TraitDef {
@ -110,7 +110,7 @@ pub fn expand_deriving_encodable(cx: @ExtCtxt,
trait_def.expand(cx, span, mitem, in_items)
}
fn encodable_substructure(cx: @ExtCtxt, span: span,
fn encodable_substructure(cx: @ExtCtxt, span: Span,
substr: &Substructure) -> @expr {
let encoder = substr.nonself_args[0];
// throw an underscore in front to suppress unused variable warnings

View File

@ -167,7 +167,7 @@ use ast::{enum_def, expr, ident, Generics, struct_def};
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use codemap::{span,respan};
use codemap::{Span,respan};
use opt_vec;
use std::vec;
@ -263,7 +263,7 @@ Combine the values of all the fields together. The last argument is
all the fields of all the structures, see above for details.
*/
pub type CombineSubstructureFunc<'self> =
&'self fn(@ExtCtxt, span, &Substructure) -> @expr;
&'self fn(@ExtCtxt, Span, &Substructure) -> @expr;
/**
Deal with non-matching enum variants, the arguments are a list
@ -271,7 +271,7 @@ representing each variant: (variant index, ast::variant instance,
[variant fields]), and a list of the nonself args of the type
*/
pub type EnumNonMatchFunc<'self> =
&'self fn(@ExtCtxt, span,
&'self fn(@ExtCtxt, Span,
&[(uint, ast::variant,
~[(Option<ident>, @expr)])],
&[@expr]) -> @expr;
@ -279,7 +279,7 @@ pub type EnumNonMatchFunc<'self> =
impl<'self> TraitDef<'self> {
pub fn expand(&self, cx: @ExtCtxt,
span: span,
span: Span,
_mitem: @ast::MetaItem,
in_items: ~[@ast::item]) -> ~[@ast::item] {
let mut result = ~[];
@ -314,7 +314,7 @@ impl<'self> TraitDef<'self> {
* where B1, B2, ... are the bounds given by `bounds_paths`.'
*
*/
fn create_derived_impl(&self, cx: @ExtCtxt, span: span,
fn create_derived_impl(&self, cx: @ExtCtxt, span: Span,
type_ident: ident, generics: &Generics,
methods: ~[@ast::method]) -> @ast::item {
let trait_path = self.path.to_path(cx, span, type_ident, generics);
@ -373,7 +373,7 @@ impl<'self> TraitDef<'self> {
}
fn expand_struct_def(&self, cx: @ExtCtxt,
span: span,
span: Span,
struct_def: &struct_def,
type_ident: ident,
generics: &Generics) -> @ast::item {
@ -404,7 +404,7 @@ impl<'self> TraitDef<'self> {
}
fn expand_enum_def(&self,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
enum_def: &enum_def,
type_ident: ident,
generics: &Generics) -> @ast::item {
@ -438,7 +438,7 @@ impl<'self> TraitDef<'self> {
impl<'self> MethodDef<'self> {
fn call_substructure_method(&self,
cx: @ExtCtxt,
span: span,
span: Span,
type_ident: ident,
self_args: &[@expr],
nonself_args: &[@expr],
@ -455,7 +455,7 @@ impl<'self> MethodDef<'self> {
&substructure)
}
fn get_ret_ty(&self, cx: @ExtCtxt, span: span,
fn get_ret_ty(&self, cx: @ExtCtxt, span: Span,
generics: &Generics, type_ident: ident) -> ast::Ty {
self.ret_ty.to_ty(cx, span, type_ident, generics)
}
@ -464,7 +464,7 @@ impl<'self> MethodDef<'self> {
self.explicit_self.is_none()
}
fn split_self_nonself_args(&self, cx: @ExtCtxt, span: span,
fn split_self_nonself_args(&self, cx: @ExtCtxt, span: Span,
type_ident: ident, generics: &Generics)
-> (ast::explicit_self, ~[@expr], ~[@expr], ~[(ident, ast::Ty)]) {
@ -510,7 +510,7 @@ impl<'self> MethodDef<'self> {
(ast_explicit_self, self_args, nonself_args, arg_tys)
}
fn create_method(&self, cx: @ExtCtxt, span: span,
fn create_method(&self, cx: @ExtCtxt, span: Span,
type_ident: ident,
generics: &Generics,
explicit_self: ast::explicit_self,
@ -569,7 +569,7 @@ impl<'self> MethodDef<'self> {
*/
fn expand_struct_method_body(&self,
cx: @ExtCtxt,
span: span,
span: Span,
struct_def: &struct_def,
type_ident: ident,
self_args: &[@expr],
@ -623,7 +623,7 @@ impl<'self> MethodDef<'self> {
fn expand_static_struct_method_body(&self,
cx: @ExtCtxt,
span: span,
span: Span,
struct_def: &struct_def,
type_ident: ident,
self_args: &[@expr],
@ -665,7 +665,7 @@ impl<'self> MethodDef<'self> {
*/
fn expand_enum_method_body(&self,
cx: @ExtCtxt,
span: span,
span: Span,
enum_def: &enum_def,
type_ident: ident,
self_args: &[@expr],
@ -700,7 +700,7 @@ impl<'self> MethodDef<'self> {
the first call).
*/
fn build_enum_match(&self,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
enum_def: &enum_def,
type_ident: ident,
self_args: &[@expr],
@ -850,7 +850,7 @@ impl<'self> MethodDef<'self> {
fn expand_static_enum_method_body(&self,
cx: @ExtCtxt,
span: span,
span: Span,
enum_def: &enum_def,
type_ident: ident,
self_args: &[@expr],
@ -873,7 +873,7 @@ impl<'self> MethodDef<'self> {
}
}
fn summarise_struct(cx: @ExtCtxt, span: span,
fn summarise_struct(cx: @ExtCtxt, span: Span,
struct_def: &struct_def) -> Either<uint, ~[ident]> {
let mut named_idents = ~[];
let mut unnamed_count = 0;
@ -896,7 +896,7 @@ fn summarise_struct(cx: @ExtCtxt, span: span,
}
pub fn create_subpatterns(cx: @ExtCtxt,
span: span,
span: Span,
field_paths: ~[ast::Path],
mutbl: ast::mutability)
-> ~[@ast::pat] {
@ -912,7 +912,7 @@ enum StructType {
}
fn create_struct_pattern(cx: @ExtCtxt,
span: span,
span: Span,
struct_ident: ident,
struct_def: &struct_def,
prefix: &str,
@ -973,7 +973,7 @@ fn create_struct_pattern(cx: @ExtCtxt,
}
fn create_enum_variant_pattern(cx: @ExtCtxt,
span: span,
span: Span,
variant: &ast::variant,
prefix: &str,
mutbl: ast::mutability)
@ -1022,13 +1022,13 @@ Fold the fields. `use_foldl` controls whether this is done
left-to-right (`true`) or right-to-left (`false`).
*/
pub fn cs_fold(use_foldl: bool,
f: &fn(@ExtCtxt, span,
f: &fn(@ExtCtxt, Span,
old: @expr,
self_f: @expr,
other_fs: &[@expr]) -> @expr,
base: @expr,
enum_nonmatch_f: EnumNonMatchFunc,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
substructure: &Substructure) -> @expr {
match *substructure.fields {
EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => {
@ -1064,9 +1064,9 @@ f(cx, span, ~[self_1.method(__arg_1_1, __arg_2_1),
~~~
*/
#[inline]
pub fn cs_same_method(f: &fn(@ExtCtxt, span, ~[@expr]) -> @expr,
pub fn cs_same_method(f: &fn(@ExtCtxt, Span, ~[@expr]) -> @expr,
enum_nonmatch_f: EnumNonMatchFunc,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
substructure: &Substructure) -> @expr {
match *substructure.fields {
EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => {
@ -1097,10 +1097,10 @@ fields. `use_foldl` controls whether this is done left-to-right
*/
#[inline]
pub fn cs_same_method_fold(use_foldl: bool,
f: &fn(@ExtCtxt, span, @expr, @expr) -> @expr,
f: &fn(@ExtCtxt, Span, @expr, @expr) -> @expr,
base: @expr,
enum_nonmatch_f: EnumNonMatchFunc,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
substructure: &Substructure) -> @expr {
cs_same_method(
|cx, span, vals| {
@ -1126,7 +1126,7 @@ on all the fields.
#[inline]
pub fn cs_binop(binop: ast::binop, base: @expr,
enum_nonmatch_f: EnumNonMatchFunc,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
substructure: &Substructure) -> @expr {
cs_same_method_fold(
true, // foldl is good enough
@ -1144,7 +1144,7 @@ pub fn cs_binop(binop: ast::binop, base: @expr,
/// cs_binop with binop == or
#[inline]
pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
substructure: &Substructure) -> @expr {
cs_binop(ast::or, cx.expr_bool(span, false),
enum_nonmatch_f,
@ -1153,7 +1153,7 @@ pub fn cs_or(enum_nonmatch_f: EnumNonMatchFunc,
/// cs_binop with binop == and
#[inline]
pub fn cs_and(enum_nonmatch_f: EnumNonMatchFunc,
cx: @ExtCtxt, span: span,
cx: @ExtCtxt, span: Span,
substructure: &Substructure) -> @expr {
cs_binop(ast::and, cx.expr_bool(span, true),
enum_nonmatch_f,

View File

@ -9,14 +9,14 @@
// except according to those terms.
use ast::{MetaItem, item, expr, and};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item]) -> ~[@item] {
let trait_def = TraitDef {
@ -42,7 +42,7 @@ pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
trait_def.expand(cx, span, mitem, in_items)
}
fn iter_bytes_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
fn iter_bytes_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr {
let (lsb0, f)= match substr.nonself_args {
[l, f] => (l, f),
_ => cx.span_bug(span, "Incorrect number of arguments in `deriving(IterBytes)`")

View File

@ -22,7 +22,7 @@ use ast::{enum_def, ident, item, Generics, struct_def};
use ast::{MetaItem, MetaList, MetaNameValue, MetaWord};
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use codemap::span;
use codemap::Span;
pub mod clone;
pub mod iter_bytes;
@ -45,20 +45,20 @@ pub mod totalord;
pub mod generic;
pub type ExpandDerivingStructDefFn<'self> = &'self fn(@ExtCtxt,
span,
Span,
x: &struct_def,
ident,
y: &Generics)
-> @item;
pub type ExpandDerivingEnumDefFn<'self> = &'self fn(@ExtCtxt,
span,
Span,
x: &enum_def,
ident,
y: &Generics)
-> @item;
pub fn expand_meta_deriving(cx: @ExtCtxt,
_span: span,
_span: Span,
mitem: @MetaItem,
in_items: ~[@item])
-> ~[@item] {

View File

@ -10,7 +10,7 @@
use ast;
use ast::{MetaItem, item, expr, ident};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::{AstBuilder, Duplicate};
use ext::deriving::generic::*;
@ -18,7 +18,7 @@ use ext::deriving::generic::*;
use std::vec;
pub fn expand_deriving_rand(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item])
-> ~[@item] {
@ -48,7 +48,7 @@ pub fn expand_deriving_rand(cx: @ExtCtxt,
trait_def.expand(cx, span, mitem, in_items)
}
fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
fn rand_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr {
let rng = match substr.nonself_args {
[rng] => ~[ rng ],
_ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`")
@ -128,7 +128,7 @@ fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
_ => cx.bug("Non-static method in `deriving(Rand)`")
};
fn rand_thing(cx: @ExtCtxt, span: span,
fn rand_thing(cx: @ExtCtxt, span: Span,
ctor_ident: ident,
summary: &Either<uint, ~[ident]>,
rand_call: &fn() -> @expr) -> @expr {

View File

@ -10,13 +10,13 @@
use ast;
use ast::{MetaItem, item, expr};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
pub fn expand_deriving_to_str(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item])
-> ~[@item] {
@ -43,7 +43,7 @@ pub fn expand_deriving_to_str(cx: @ExtCtxt,
// std::sys::log_str, but this isn't sufficient because it doesn't invoke the
// to_str() method on each field. Hence we mirror the logic of the log_str()
// method, but with tweaks to call to_str() on sub-fields.
fn to_str_substructure(cx: @ExtCtxt, span: span,
fn to_str_substructure(cx: @ExtCtxt, span: Span,
substr: &Substructure) -> @expr {
let to_str = cx.ident_of("to_str");

View File

@ -17,7 +17,7 @@ use ast;
use ast::{expr,Generics,ident};
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use codemap::{span,respan};
use codemap::{Span,respan};
use opt_vec;
/// The types of pointers
@ -58,7 +58,7 @@ impl<'self> Path<'self> {
pub fn to_ty(&self,
cx: @ExtCtxt,
span: span,
span: Span,
self_ty: ident,
self_generics: &Generics)
-> ast::Ty {
@ -66,7 +66,7 @@ impl<'self> Path<'self> {
}
pub fn to_path(&self,
cx: @ExtCtxt,
span: span,
span: Span,
self_ty: ident,
self_generics: &Generics)
-> ast::Path {
@ -109,7 +109,7 @@ pub fn nil_ty() -> Ty<'static> {
Tuple(~[])
}
fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<ast::Lifetime> {
fn mk_lifetime(cx: @ExtCtxt, span: Span, lt: &Option<&str>) -> Option<ast::Lifetime> {
match *lt {
Some(ref s) => Some(cx.lifetime(span, cx.ident_of(*s))),
None => None
@ -119,7 +119,7 @@ fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<ast::Lifet
impl<'self> Ty<'self> {
pub fn to_ty(&self,
cx: @ExtCtxt,
span: span,
span: Span,
self_ty: ident,
self_generics: &Generics)
-> ast::Ty {
@ -157,7 +157,7 @@ impl<'self> Ty<'self> {
pub fn to_path(&self,
cx: @ExtCtxt,
span: span,
span: Span,
self_ty: ident,
self_generics: &Generics)
-> ast::Path {
@ -185,7 +185,7 @@ impl<'self> Ty<'self> {
}
fn mk_ty_param(cx: @ExtCtxt, span: span, name: &str, bounds: &[Path],
fn mk_ty_param(cx: @ExtCtxt, span: Span, name: &str, bounds: &[Path],
self_ident: ident, self_generics: &Generics) -> ast::TyParam {
let bounds = opt_vec::from(
do bounds.map |b| {
@ -216,7 +216,7 @@ impl<'self> LifetimeBounds<'self> {
}
pub fn to_generics(&self,
cx: @ExtCtxt,
span: span,
span: Span,
self_ty: ident,
self_generics: &Generics)
-> Generics {
@ -235,7 +235,7 @@ impl<'self> LifetimeBounds<'self> {
}
pub fn get_explicit_self(cx: @ExtCtxt, span: span, self_ptr: &Option<PtrTy>)
pub fn get_explicit_self(cx: @ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
-> (@expr, ast::explicit_self) {
let self_path = cx.expr_self(span);
match *self_ptr {

View File

@ -9,7 +9,7 @@
// except according to those terms.
use ast::{MetaItem, item, expr};
use codemap::span;
use codemap::Span;
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use ext::deriving::generic::*;
@ -17,7 +17,7 @@ use ext::deriving::generic::*;
use std::vec;
pub fn expand_deriving_zero(cx: @ExtCtxt,
span: span,
span: Span,
mitem: @MetaItem,
in_items: ~[@item])
-> ~[@item] {
@ -55,7 +55,7 @@ pub fn expand_deriving_zero(cx: @ExtCtxt,
trait_def.expand(cx, span, mitem, in_items)
}
fn zero_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
fn zero_substructure(cx: @ExtCtxt, span: Span, substr: &Substructure) -> @expr {
let zero_ident = ~[
cx.ident_of("std"),
cx.ident_of("num"),

View File

@ -15,7 +15,7 @@
*/
use ast;
use codemap::span;
use codemap::Span;
use ext::base::*;
use ext::base;
use ext::build::AstBuilder;
@ -23,7 +23,7 @@ use ext::build::AstBuilder;
use std::os;
#[cfg(stage0)]
pub fn expand_option_env(ext_cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
pub fn expand_option_env(ext_cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
-> base::MacResult {
let var = get_single_str_from_tts(ext_cx, sp, tts, "option_env!");
@ -34,7 +34,7 @@ pub fn expand_option_env(ext_cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
MRExpr(e)
}
#[cfg(not(stage0))]
pub fn expand_option_env(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
pub fn expand_option_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
-> base::MacResult {
let var = get_single_str_from_tts(cx, sp, tts, "option_env!");
@ -45,7 +45,7 @@ pub fn expand_option_env(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
MRExpr(e)
}
pub fn expand_env(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
pub fn expand_env(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
-> base::MacResult {
let exprs = get_exprs_from_tts(cx, sp, tts);

View File

@ -16,7 +16,7 @@ use ast_util::{new_rename, new_mark, resolve};
use attr;
use attr::AttrMetaMethods;
use codemap;
use codemap::{span, spanned, ExpnInfo, NameAndSpan};
use codemap::{Span, Spanned, spanned, ExpnInfo, NameAndSpan};
use ext::base::*;
use fold::*;
use opt_vec;
@ -32,10 +32,10 @@ use std::vec;
pub fn expand_expr(extsbox: @mut SyntaxEnv,
cx: @ExtCtxt,
e: &expr_,
s: span,
s: Span,
fld: @ast_fold,
orig: @fn(&expr_, span, @ast_fold) -> (expr_, span))
-> (expr_, span) {
orig: @fn(&expr_, Span, @ast_fold) -> (expr_, Span))
-> (expr_, Span) {
match *e {
// expr_mac should really be expr_ext or something; it's the
// entry-point for all syntax extensions.
@ -117,7 +117,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
let lo = s.lo;
let hi = s.hi;
pub fn mk_expr(cx: @ExtCtxt, span: span,
pub fn mk_expr(cx: @ExtCtxt, span: Span,
node: expr_) -> @ast::expr {
@ast::expr {
id: cx.next_id(),
@ -129,7 +129,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
fn mk_block(cx: @ExtCtxt,
stmts: &[@ast::stmt],
expr: Option<@ast::expr>,
span: span) -> ast::Block {
span: Span) -> ast::Block {
ast::Block {
view_items: ~[],
stmts: stmts.to_owned(),
@ -140,7 +140,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
}
}
fn mk_simple_path(ident: ast::ident, span: span) -> ast::Path {
fn mk_simple_path(ident: ast::ident, span: Span) -> ast::Path {
ast::Path {
span: span,
global: false,
@ -367,7 +367,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
fld: @ast_fold)
-> Option<@ast::item> {
let (pth, tts) = match it.node {
item_mac(codemap::spanned { node: mac_invoc_tt(ref pth, ref tts), _}) => {
item_mac(codemap::Spanned { node: mac_invoc_tt(ref pth, ref tts), _}) => {
(pth, (*tts).clone())
}
_ => cx.span_bug(it.span, "invalid item macro invocation")
@ -449,11 +449,11 @@ fn insert_macro(exts: SyntaxEnv, name: ast::Name, transformer: @Transformer) {
pub fn expand_stmt(extsbox: @mut SyntaxEnv,
cx: @ExtCtxt,
s: &stmt_,
sp: span,
sp: Span,
fld: @ast_fold,
orig: @fn(&stmt_, span, @ast_fold)
-> (Option<stmt_>, span))
-> (Option<stmt_>, span) {
orig: @fn(&stmt_, Span, @ast_fold)
-> (Option<stmt_>, Span))
-> (Option<stmt_>, Span) {
let (mac, pth, tts, semi) = match *s {
stmt_mac(ref mac, semi) => {
match mac.node {
@ -484,7 +484,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
});
let expanded = match exp(cx, mac.span, tts) {
MRExpr(e) =>
@codemap::spanned { node: stmt_expr(e, cx.next_id()),
@codemap::Spanned { node: stmt_expr(e, cx.next_id()),
span: e.span},
MRAny(_,_,stmt_mkr) => stmt_mkr(),
_ => cx.span_fatal(
@ -563,7 +563,7 @@ impl Visitor<()> for NewNameFinderContext {
// XXX: Methods below can become default methods.
fn visit_mod(&mut self, module: &ast::_mod, _: span, _: NodeId, _: ()) {
fn visit_mod(&mut self, module: &ast::_mod, _: Span, _: NodeId, _: ()) {
visit::walk_mod(self, module, ())
}
@ -621,7 +621,7 @@ impl Visitor<()> for NewNameFinderContext {
function_kind: &visit::fn_kind,
function_declaration: &ast::fn_decl,
block: &ast::Block,
span: span,
span: Span,
node_id: NodeId,
_: ()) {
visit::walk_fn(self,
@ -723,9 +723,9 @@ fn apply_pending_renames(folder : @ast_fold, stmt : ast::stmt) -> @ast::stmt {
pub fn new_span(cx: @ExtCtxt, sp: span) -> span {
pub fn new_span(cx: @ExtCtxt, sp: Span) -> Span {
/* this discards information in the case of macro-defining macros */
return span {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()};
return Span {lo: sp.lo, hi: sp.hi, expn_info: cx.backtrace()};
}
// FIXME (#2247): this is a moderately bad kludge to inject some macros into
@ -1193,7 +1193,7 @@ mod test {
use ast;
use ast::{Attribute_, AttrOuter, MetaWord, empty_ctxt};
use codemap;
use codemap::spanned;
use codemap::Spanned;
use parse;
use parse::token::{intern, get_ident_interner};
use print::pprust;
@ -1282,11 +1282,11 @@ mod test {
// make a MetaWord outer attribute with the given name
fn make_dummy_attr(s: @str) -> ast::Attribute {
spanned {
Spanned {
span:codemap::dummy_sp(),
node: Attribute_ {
style: AttrOuter,
value: @spanned {
value: @Spanned {
node: MetaWord(s),
span: codemap::dummy_sp(),
},

View File

@ -15,7 +15,7 @@
*/
use ast;
use codemap::span;
use codemap::Span;
use ext::base::*;
use ext::base;
use ext::build::AstBuilder;
@ -24,7 +24,7 @@ use std::option;
use std::unstable::extfmt::ct::*;
use parse::token::{str_to_ident};
pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
pub fn expand_syntax_ext(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree])
-> base::MacResult {
let args = get_exprs_from_tts(cx, sp, tts);
if args.len() == 0 {
@ -35,7 +35,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
"first argument to fmt! must be a string literal.");
let fmtspan = args[0].span;
debug!("Format string: %s", fmt);
fn parse_fmt_err_(cx: @ExtCtxt, sp: span, msg: &str) -> ! {
fn parse_fmt_err_(cx: @ExtCtxt, sp: Span, msg: &str) -> ! {
cx.span_fatal(sp, msg);
}
let parse_fmt_err: @fn(&str) -> ! = |s| parse_fmt_err_(cx, fmtspan, s);
@ -47,7 +47,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
// probably be factored out in common with other code that builds
// expressions. Also: Cleanup the naming of these functions.
// Note: Moved many of the common ones to build.rs --kevina
fn pieces_to_expr(cx: @ExtCtxt, sp: span,
fn pieces_to_expr(cx: @ExtCtxt, sp: Span,
pieces: ~[Piece], args: ~[@ast::expr])
-> @ast::expr {
fn make_path_vec(ident: &str) -> ~[ast::ident] {
@ -57,15 +57,15 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
str_to_ident("rt"),
str_to_ident(ident)];
}
fn make_rt_path_expr(cx: @ExtCtxt, sp: span, nm: &str) -> @ast::expr {
fn make_rt_path_expr(cx: @ExtCtxt, sp: Span, nm: &str) -> @ast::expr {
let path = make_path_vec(nm);
cx.expr_path(cx.path_global(sp, path))
}
// Produces an AST expression that represents a RT::conv record,
// which tells the RT::conv* functions how to perform the conversion
fn make_rt_conv_expr(cx: @ExtCtxt, sp: span, cnv: &Conv) -> @ast::expr {
fn make_flags(cx: @ExtCtxt, sp: span, flags: &[Flag]) -> @ast::expr {
fn make_rt_conv_expr(cx: @ExtCtxt, sp: Span, cnv: &Conv) -> @ast::expr {
fn make_flags(cx: @ExtCtxt, sp: Span, flags: &[Flag]) -> @ast::expr {
let mut tmp_expr = make_rt_path_expr(cx, sp, "flag_none");
for f in flags.iter() {
let fstr = match *f {
@ -80,7 +80,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
}
return tmp_expr;
}
fn make_count(cx: @ExtCtxt, sp: span, cnt: Count) -> @ast::expr {
fn make_count(cx: @ExtCtxt, sp: Span, cnt: Count) -> @ast::expr {
match cnt {
CountImplied => {
return make_rt_path_expr(cx, sp, "CountImplied");
@ -94,7 +94,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
_ => cx.span_unimpl(sp, "unimplemented fmt! conversion")
}
}
fn make_ty(cx: @ExtCtxt, sp: span, t: Ty) -> @ast::expr {
fn make_ty(cx: @ExtCtxt, sp: Span, t: Ty) -> @ast::expr {
let rt_type = match t {
TyHex(c) => match c {
CaseUpper => "TyHexUpper",
@ -106,7 +106,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
};
return make_rt_path_expr(cx, sp, rt_type);
}
fn make_conv_struct(cx: @ExtCtxt, sp: span, flags_expr: @ast::expr,
fn make_conv_struct(cx: @ExtCtxt, sp: Span, flags_expr: @ast::expr,
width_expr: @ast::expr, precision_expr: @ast::expr,
ty_expr: @ast::expr) -> @ast::expr {
cx.expr_struct(
@ -127,7 +127,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
make_conv_struct(cx, sp, rt_conv_flags, rt_conv_width,
rt_conv_precision, rt_conv_ty)
}
fn make_conv_call(cx: @ExtCtxt, sp: span, conv_type: &str, cnv: &Conv,
fn make_conv_call(cx: @ExtCtxt, sp: Span, conv_type: &str, cnv: &Conv,
arg: @ast::expr, buf: @ast::expr) -> @ast::expr {
let fname = ~"conv_" + conv_type;
let path = make_path_vec(fname);
@ -136,7 +136,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
cx.expr_call_global(arg.span, path, args)
}
fn make_new_conv(cx: @ExtCtxt, sp: span, cnv: &Conv,
fn make_new_conv(cx: @ExtCtxt, sp: Span, cnv: &Conv,
arg: @ast::expr, buf: @ast::expr) -> @ast::expr {
fn is_signed_type(cnv: &Conv) -> bool {
match cnv.ty {

View File

@ -9,7 +9,7 @@
// except according to those terms.
use ast;
use codemap::{span, respan};
use codemap::{Span, respan};
use ext::base::*;
use ext::base;
use ext::build::AstBuilder;
@ -30,7 +30,7 @@ enum ArgumentType {
struct Context {
ecx: @ExtCtxt,
fmtsp: span,
fmtsp: Span,
// Parsed argument expressions and the types that we've found so far for
// them.
@ -53,7 +53,7 @@ struct Context {
impl Context {
/// Parses the arguments from the given list of tokens, returning None if
/// there's a parse error so we can continue parsing other fmt! expressions.
fn parse_args(&mut self, sp: span,
fn parse_args(&mut self, sp: Span,
leading_expr: bool,
tts: &[ast::token_tree]) -> (Option<@ast::expr>,
Option<@ast::expr>) {
@ -294,7 +294,7 @@ impl Context {
///
/// Obviously `Some(Some(x)) != Some(Some(y))`, but we consider it true
/// that: `Some(None) == Some(Some(x))`
fn verify_same(&self, sp: span, ty: ArgumentType,
fn verify_same(&self, sp: Span, ty: ArgumentType,
before: Option<ArgumentType>) {
if ty == Unknown { return }
let cur = match before {
@ -636,7 +636,7 @@ impl Context {
self.ecx.expr_block(self.ecx.block(self.fmtsp, lets, Some(result)))
}
fn format_arg(&self, sp: span, arg: Either<uint, @str>,
fn format_arg(&self, sp: Span, arg: Either<uint, @str>,
ident: ast::ident) -> @ast::expr {
let ty = match arg {
Left(i) => self.arg_types[i].unwrap(),
@ -697,22 +697,22 @@ impl Context {
}
}
pub fn expand_format(ecx: @ExtCtxt, sp: span,
pub fn expand_format(ecx: @ExtCtxt, sp: Span,
tts: &[ast::token_tree]) -> base::MacResult {
expand_ifmt(ecx, sp, tts, false, false, "format")
}
pub fn expand_write(ecx: @ExtCtxt, sp: span,
pub fn expand_write(ecx: @ExtCtxt, sp: Span,
tts: &[ast::token_tree]) -> base::MacResult {
expand_ifmt(ecx, sp, tts, true, false, "write")
}
pub fn expand_writeln(ecx: @ExtCtxt, sp: span,
pub fn expand_writeln(ecx: @ExtCtxt, sp: Span,
tts: &[ast::token_tree]) -> base::MacResult {
expand_ifmt(ecx, sp, tts, true, true, "write")
}
fn expand_ifmt(ecx: @ExtCtxt, sp: span, tts: &[ast::token_tree],
fn expand_ifmt(ecx: @ExtCtxt, sp: Span, tts: &[ast::token_tree],
leading_arg: bool, append_newline: bool,
function: &str) -> base::MacResult {
let mut cx = Context {

View File

@ -18,7 +18,7 @@ use parse::token::{get_ident_interner};
use std::io;
pub fn expand_syntax_ext(cx: @ExtCtxt,
sp: codemap::span,
sp: codemap::Span,
tt: &[ast::token_tree])
-> base::MacResult {
@ -31,7 +31,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt,
//trivial expression
MRExpr(@ast::expr {
id: cx.next_id(),
node: ast::expr_lit(@codemap::spanned {
node: ast::expr_lit(@codemap::Spanned {
node: ast::lit_nil,
span: sp
}),

Some files were not shown because too many files have changed in this diff Show More