core: Replace map/map_default with map_ref/map_default_ref
This commit is contained in:
parent
64de6d638d
commit
e8fe718bfd
30 changed files with 79 additions and 97 deletions
|
@ -58,7 +58,7 @@ fn parse_config(args: ~[~str]) -> config {
|
||||||
} else { option::None },
|
} else { option::None },
|
||||||
logfile: option::map(&getopts::opt_maybe_str(matches,
|
logfile: option::map(&getopts::opt_maybe_str(matches,
|
||||||
~"logfile"),
|
~"logfile"),
|
||||||
|s| Path(s)),
|
|s| Path(*s)),
|
||||||
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
|
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
|
||||||
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
|
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
|
||||||
jit: getopts::opt_present(matches, ~"jit"),
|
jit: getopts::opt_present(matches, ~"jit"),
|
||||||
|
|
|
@ -103,7 +103,7 @@ fn parse_compile_flags(line: ~str) -> Option<~str> {
|
||||||
fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
|
fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> {
|
||||||
do parse_name_value_directive(line, ~"exec-env").map |nv| {
|
do parse_name_value_directive(line, ~"exec-env").map |nv| {
|
||||||
// nv is either FOO or FOO=BAR
|
// nv is either FOO or FOO=BAR
|
||||||
let strs = str::splitn_char(nv, '=', 1u);
|
let strs = str::splitn_char(*nv, '=', 1u);
|
||||||
match strs.len() {
|
match strs.len() {
|
||||||
1u => (strs[0], ~""),
|
1u => (strs[0], ~""),
|
||||||
2u => (strs[0], strs[1]),
|
2u => (strs[0], strs[1]),
|
||||||
|
|
|
@ -275,13 +275,13 @@ impl<T> DList<T> {
|
||||||
/// Remove a node from the head of the list. O(1).
|
/// Remove a node from the head of the list. O(1).
|
||||||
fn pop_n() -> Option<DListNode<T>> {
|
fn pop_n() -> Option<DListNode<T>> {
|
||||||
let hd = self.peek_n();
|
let hd = self.peek_n();
|
||||||
hd.map(|nobe| self.unlink(nobe));
|
hd.map(|nobe| self.unlink(*nobe));
|
||||||
hd
|
hd
|
||||||
}
|
}
|
||||||
/// Remove a node from the tail of the list. O(1).
|
/// Remove a node from the tail of the list. O(1).
|
||||||
fn pop_tail_n() -> Option<DListNode<T>> {
|
fn pop_tail_n() -> Option<DListNode<T>> {
|
||||||
let tl = self.peek_tail_n();
|
let tl = self.peek_tail_n();
|
||||||
tl.map(|nobe| self.unlink(nobe));
|
tl.map(|nobe| self.unlink(*nobe));
|
||||||
tl
|
tl
|
||||||
}
|
}
|
||||||
/// Get the node at the list's head. O(1).
|
/// Get the node at the list's head. O(1).
|
||||||
|
|
|
@ -290,7 +290,7 @@ pure fn from_elem<T: Copy,BT: Buildable<T>>(n_elts: uint, t: T) -> BT {
|
||||||
pure fn append<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>(
|
pure fn append<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>(
|
||||||
lhs: IT, rhs: IT) -> BT {
|
lhs: IT, rhs: IT) -> BT {
|
||||||
let size_opt = lhs.size_hint().chain(
|
let size_opt = lhs.size_hint().chain(
|
||||||
|sz1| rhs.size_hint().map(|sz2| sz1+sz2));
|
|sz1| rhs.size_hint().map(|sz2| sz1+*sz2));
|
||||||
do build_sized_opt(size_opt) |push| {
|
do build_sized_opt(size_opt) |push| {
|
||||||
for lhs.each |x| { push(*x); }
|
for lhs.each |x| { push(*x); }
|
||||||
for rhs.each |x| { push(*x); }
|
for rhs.each |x| { push(*x); }
|
||||||
|
|
|
@ -61,13 +61,7 @@ pure fn expect<T: Copy>(opt: &Option<T>, +reason: ~str) -> T {
|
||||||
match *opt { Some(x) => x, None => fail reason }
|
match *opt { Some(x) => x, None => fail reason }
|
||||||
}
|
}
|
||||||
|
|
||||||
pure fn map<T, U>(opt: &Option<T>, f: fn(T) -> U) -> Option<U> {
|
pure fn map<T, U>(opt: &Option<T>, f: fn(x: &T) -> U) -> Option<U> {
|
||||||
//! Maps a `some` value from one type to another
|
|
||||||
|
|
||||||
match *opt { Some(x) => Some(f(x)), None => None }
|
|
||||||
}
|
|
||||||
|
|
||||||
pure fn map_ref<T, U>(opt: &Option<T>, f: fn(x: &T) -> U) -> Option<U> {
|
|
||||||
//! Maps a `some` value by reference from one type to another
|
//! Maps a `some` value by reference from one type to another
|
||||||
|
|
||||||
match *opt { Some(ref x) => Some(f(x)), None => None }
|
match *opt { Some(ref x) => Some(f(x)), None => None }
|
||||||
|
@ -138,14 +132,7 @@ pure fn get_default<T: Copy>(opt: &Option<T>, +def: T) -> T {
|
||||||
match *opt { Some(x) => x, None => def }
|
match *opt { Some(x) => x, None => def }
|
||||||
}
|
}
|
||||||
|
|
||||||
pure fn map_default<T, U>(opt: &Option<T>, +def: U, f: fn(T) -> U) -> U {
|
pure fn map_default<T, U>(opt: &Option<T>, +def: U,
|
||||||
//! Applies a function to the contained value or returns a default
|
|
||||||
|
|
||||||
match *opt { None => move def, Some(t) => f(t) }
|
|
||||||
}
|
|
||||||
|
|
||||||
// This should replace map_default.
|
|
||||||
pure fn map_default_ref<T, U>(opt: &Option<T>, +def: U,
|
|
||||||
f: fn(x: &T) -> U) -> U {
|
f: fn(x: &T) -> U) -> U {
|
||||||
//! Applies a function to the contained value or returns a default
|
//! Applies a function to the contained value or returns a default
|
||||||
|
|
||||||
|
@ -200,17 +187,12 @@ impl<T> Option<T> {
|
||||||
* function that returns an option.
|
* function that returns an option.
|
||||||
*/
|
*/
|
||||||
pure fn chain<U>(f: fn(T) -> Option<U>) -> Option<U> { chain(&self, f) }
|
pure fn chain<U>(f: fn(T) -> Option<U>) -> Option<U> { chain(&self, f) }
|
||||||
/// Applies a function to the contained value or returns a default
|
|
||||||
pure fn map_default<U>(+def: U, f: fn(T) -> U) -> U
|
|
||||||
{ map_default(&self, move def, f) }
|
|
||||||
/// Performs an operation on the contained value or does nothing
|
/// Performs an operation on the contained value or does nothing
|
||||||
pure fn iter(f: fn(T)) { iter(&self, f) }
|
pure fn iter(f: fn(T)) { iter(&self, f) }
|
||||||
/// Returns true if the option equals `none`
|
/// Returns true if the option equals `none`
|
||||||
pure fn is_none() -> bool { is_none(&self) }
|
pure fn is_none() -> bool { is_none(&self) }
|
||||||
/// Returns true if the option contains some value
|
/// Returns true if the option contains some value
|
||||||
pure fn is_some() -> bool { is_some(&self) }
|
pure fn is_some() -> bool { is_some(&self) }
|
||||||
/// Maps a `some` value from one type to another
|
|
||||||
pure fn map<U>(f: fn(T) -> U) -> Option<U> { map(&self, f) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> &Option<T> {
|
impl<T> &Option<T> {
|
||||||
|
@ -222,12 +204,12 @@ impl<T> &Option<T> {
|
||||||
chain_ref(self, f)
|
chain_ref(self, f)
|
||||||
}
|
}
|
||||||
/// Applies a function to the contained value or returns a default
|
/// Applies a function to the contained value or returns a default
|
||||||
pure fn map_default_ref<U>(+def: U, f: fn(x: &T) -> U) -> U
|
pure fn map_default<U>(+def: U, f: fn(x: &T) -> U) -> U
|
||||||
{ map_default_ref(self, move def, f) }
|
{ map_default(self, move def, f) }
|
||||||
/// Performs an operation on the contained value by reference
|
/// Performs an operation on the contained value by reference
|
||||||
pure fn iter_ref(f: fn(x: &T)) { iter_ref(self, f) }
|
pure fn iter_ref(f: fn(x: &T)) { iter_ref(self, f) }
|
||||||
/// Maps a `some` value from one type to another by reference
|
/// Maps a `some` value from one type to another by reference
|
||||||
pure fn map_ref<U>(f: fn(x: &T) -> U) -> Option<U> { map_ref(self, f) }
|
pure fn map<U>(f: fn(x: &T) -> U) -> Option<U> { map(self, f) }
|
||||||
/// Gets an immutable reference to the value inside a `some`.
|
/// Gets an immutable reference to the value inside a `some`.
|
||||||
pure fn get_ref() -> &self/T { get_ref(self) }
|
pure fn get_ref() -> &self/T { get_ref(self) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,7 +439,7 @@ fn self_exe_path() -> Option<Path> {
|
||||||
}
|
}
|
||||||
|
|
||||||
do load_self().map |pth| {
|
do load_self().map |pth| {
|
||||||
Path(pth).dir_path()
|
Path(*pth).dir_path()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@ unsafe fn local_data_lookup<T: Owned>(
|
||||||
);
|
);
|
||||||
do map_pos.map |index| {
|
do map_pos.map |index| {
|
||||||
// .get() is guaranteed because of "None { false }" above.
|
// .get() is guaranteed because of "None { false }" above.
|
||||||
let (_, data_ptr, _) = (*map)[index].get();
|
let (_, data_ptr, _) = (*map)[*index].get();
|
||||||
(index, data_ptr)
|
(*index, data_ptr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ unsafe fn local_get_helper<T: Owned>(
|
||||||
// was referenced in the local_data box, though, not here, so before
|
// was referenced in the local_data box, though, not here, so before
|
||||||
// overwriting the local_data_box we need to give an extra reference.
|
// overwriting the local_data_box we need to give an extra reference.
|
||||||
// We must also give an extra reference when not removing.
|
// We must also give an extra reference when not removing.
|
||||||
let (index, data_ptr) = result;
|
let (index, data_ptr) = *result;
|
||||||
let data: @T = cast::transmute(move data_ptr);
|
let data: @T = cast::transmute(move data_ptr);
|
||||||
cast::bump_box_refcount(data);
|
cast::bump_box_refcount(data);
|
||||||
if do_pop {
|
if do_pop {
|
||||||
|
|
|
@ -200,7 +200,7 @@ fn each_ancestor(list: &mut AncestorList,
|
||||||
// the end of the list, which doesn't make sense to coalesce.
|
// the end of the list, which doesn't make sense to coalesce.
|
||||||
return do (**ancestors).map_default((None,false)) |ancestor_arc| {
|
return do (**ancestors).map_default((None,false)) |ancestor_arc| {
|
||||||
// NB: Takes a lock! (this ancestor node)
|
// NB: Takes a lock! (this ancestor node)
|
||||||
do access_ancestors(&ancestor_arc) |nobe| {
|
do access_ancestors(ancestor_arc) |nobe| {
|
||||||
// Check monotonicity
|
// Check monotonicity
|
||||||
assert last_generation > nobe.generation;
|
assert last_generation > nobe.generation;
|
||||||
/*##########################################################*
|
/*##########################################################*
|
||||||
|
|
|
@ -969,7 +969,7 @@ pure fn find<T: Copy>(v: &[T], f: fn(T) -> bool) -> Option<T> {
|
||||||
*/
|
*/
|
||||||
pure fn find_between<T: Copy>(v: &[T], start: uint, end: uint,
|
pure fn find_between<T: Copy>(v: &[T], start: uint, end: uint,
|
||||||
f: fn(T) -> bool) -> Option<T> {
|
f: fn(T) -> bool) -> Option<T> {
|
||||||
position_between(v, start, end, f).map(|i| v[i])
|
position_between(v, start, end, f).map(|i| v[*i])
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -992,7 +992,7 @@ pure fn rfind<T: Copy>(v: &[T], f: fn(T) -> bool) -> Option<T> {
|
||||||
*/
|
*/
|
||||||
pure fn rfind_between<T: Copy>(v: &[T], start: uint, end: uint,
|
pure fn rfind_between<T: Copy>(v: &[T], start: uint, end: uint,
|
||||||
f: fn(T) -> bool) -> Option<T> {
|
f: fn(T) -> bool) -> Option<T> {
|
||||||
rposition_between(v, start, end, f).map(|i| v[i])
|
rposition_between(v, start, end, f).map(|i| v[*i])
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find the first index containing a matching value
|
/// Find the first index containing a matching value
|
||||||
|
|
|
@ -262,7 +262,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span,
|
||||||
fn print_macro_backtrace(cm: codemap::codemap, sp: span) {
|
fn print_macro_backtrace(cm: codemap::codemap, sp: span) {
|
||||||
do option::iter(&sp.expn_info) |ei| {
|
do option::iter(&sp.expn_info) |ei| {
|
||||||
let ss = option::map_default(&ei.callie.span, @~"",
|
let ss = option::map_default(&ei.callie.span, @~"",
|
||||||
|span| @codemap::span_to_str(span, cm));
|
|span| @codemap::span_to_str(*span, cm));
|
||||||
print_diagnostic(*ss, note,
|
print_diagnostic(*ss, note,
|
||||||
fmt!("in expansion of #%s", ei.callie.name));
|
fmt!("in expansion of #%s", ei.callie.name));
|
||||||
let ss = codemap::span_to_str(ei.call_site, cm);
|
let ss = codemap::span_to_str(ei.call_site, cm);
|
||||||
|
|
|
@ -114,7 +114,7 @@ fn fold_mac_(m: mac, fld: ast_fold) -> mac {
|
||||||
match m.node {
|
match m.node {
|
||||||
mac_invoc(pth, arg, body) => {
|
mac_invoc(pth, arg, body) => {
|
||||||
mac_invoc(fld.fold_path(pth),
|
mac_invoc(fld.fold_path(pth),
|
||||||
option::map(&arg, |x| fld.fold_expr(x)), body)
|
option::map(&arg, |x| fld.fold_expr(*x)), body)
|
||||||
}
|
}
|
||||||
mac_invoc_tt(*) => m.node,
|
mac_invoc_tt(*) => m.node,
|
||||||
mac_ellipsis => mac_ellipsis,
|
mac_ellipsis => mac_ellipsis,
|
||||||
|
@ -243,7 +243,7 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
|
||||||
variants: vec::map(enum_definition.variants,
|
variants: vec::map(enum_definition.variants,
|
||||||
|x| fld.fold_variant(*x)),
|
|x| fld.fold_variant(*x)),
|
||||||
common: option::map(&enum_definition.common,
|
common: option::map(&enum_definition.common,
|
||||||
|x| fold_struct_def(x, fld))
|
|x| fold_struct_def(*x, fld))
|
||||||
}), fold_ty_params(typms, fld))
|
}), fold_ty_params(typms, fld))
|
||||||
}
|
}
|
||||||
item_class(struct_def, typms) => {
|
item_class(struct_def, typms) => {
|
||||||
|
@ -252,7 +252,7 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
|
||||||
}
|
}
|
||||||
item_impl(tps, ifce, ty, methods) => {
|
item_impl(tps, ifce, ty, methods) => {
|
||||||
item_impl(fold_ty_params(tps, fld),
|
item_impl(fold_ty_params(tps, fld),
|
||||||
ifce.map(|p| fold_trait_ref(p, fld)),
|
ifce.map(|p| fold_trait_ref(*p, fld)),
|
||||||
fld.fold_ty(ty),
|
fld.fold_ty(ty),
|
||||||
vec::map(methods, |x| fld.fold_method(*x)))
|
vec::map(methods, |x| fld.fold_method(*x)))
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold)
|
||||||
let dtor_id = fld.new_id(dtor.node.id);
|
let dtor_id = fld.new_id(dtor.node.id);
|
||||||
{node: {body: dtor_body,
|
{node: {body: dtor_body,
|
||||||
id: dtor_id,.. dtor.node},
|
id: dtor_id,.. dtor.node},
|
||||||
.. dtor}};
|
.. *dtor}};
|
||||||
return @{
|
return @{
|
||||||
traits: vec::map(struct_def.traits, |p| fold_trait_ref(*p, fld)),
|
traits: vec::map(struct_def.traits, |p| fold_trait_ref(*p, fld)),
|
||||||
fields: vec::map(struct_def.fields, |f| fold_struct_field(*f, fld)),
|
fields: vec::map(struct_def.fields, |f| fold_struct_field(*f, fld)),
|
||||||
|
@ -332,7 +332,7 @@ fn noop_fold_method(&&m: @method, fld: ast_fold) -> @method {
|
||||||
fn noop_fold_block(b: blk_, fld: ast_fold) -> blk_ {
|
fn noop_fold_block(b: blk_, fld: ast_fold) -> blk_ {
|
||||||
return {view_items: vec::map(b.view_items, |x| fld.fold_view_item(*x)),
|
return {view_items: vec::map(b.view_items, |x| fld.fold_view_item(*x)),
|
||||||
stmts: vec::map(b.stmts, |x| fld.fold_stmt(*x)),
|
stmts: vec::map(b.stmts, |x| fld.fold_stmt(*x)),
|
||||||
expr: option::map(&b.expr, |x| fld.fold_expr(x)),
|
expr: option::map(&b.expr, |x| fld.fold_expr(*x)),
|
||||||
id: fld.new_id(b.id),
|
id: fld.new_id(b.id),
|
||||||
rules: b.rules};
|
rules: b.rules};
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ fn noop_fold_stmt(s: stmt_, fld: ast_fold) -> stmt_ {
|
||||||
|
|
||||||
fn noop_fold_arm(a: arm, fld: ast_fold) -> arm {
|
fn noop_fold_arm(a: arm, fld: ast_fold) -> arm {
|
||||||
return {pats: vec::map(a.pats, |x| fld.fold_pat(*x)),
|
return {pats: vec::map(a.pats, |x| fld.fold_pat(*x)),
|
||||||
guard: option::map(&a.guard, |x| fld.fold_expr(x)),
|
guard: option::map(&a.guard, |x| fld.fold_expr(*x)),
|
||||||
body: fld.fold_block(a.body)};
|
body: fld.fold_block(a.body)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,12 +357,12 @@ fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ {
|
||||||
pat_ident(binding_mode, pth, sub) => {
|
pat_ident(binding_mode, pth, sub) => {
|
||||||
pat_ident(binding_mode,
|
pat_ident(binding_mode,
|
||||||
fld.fold_path(pth),
|
fld.fold_path(pth),
|
||||||
option::map(&sub, |x| fld.fold_pat(x)))
|
option::map(&sub, |x| fld.fold_pat(*x)))
|
||||||
}
|
}
|
||||||
pat_lit(e) => pat_lit(fld.fold_expr(e)),
|
pat_lit(e) => pat_lit(fld.fold_expr(e)),
|
||||||
pat_enum(pth, pats) => {
|
pat_enum(pth, pats) => {
|
||||||
pat_enum(fld.fold_path(pth), option::map(&pats,
|
pat_enum(fld.fold_path(pth), option::map(&pats,
|
||||||
|pats| vec::map(pats, |x| fld.fold_pat(*x))))
|
|pats| vec::map(*pats, |x| fld.fold_pat(*x))))
|
||||||
}
|
}
|
||||||
pat_rec(fields, etc) => {
|
pat_rec(fields, etc) => {
|
||||||
let mut fs = ~[];
|
let mut fs = ~[];
|
||||||
|
@ -432,7 +432,7 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||||
expr_repeat(fld.fold_expr(expr), fld.fold_expr(count), mutt),
|
expr_repeat(fld.fold_expr(expr), fld.fold_expr(count), mutt),
|
||||||
expr_rec(fields, maybe_expr) => {
|
expr_rec(fields, maybe_expr) => {
|
||||||
expr_rec(vec::map(fields, |x| fold_field(*x)),
|
expr_rec(vec::map(fields, |x| fold_field(*x)),
|
||||||
option::map(&maybe_expr, |x| fld.fold_expr(x)))
|
option::map(&maybe_expr, |x| fld.fold_expr(*x)))
|
||||||
}
|
}
|
||||||
expr_tup(elts) => expr_tup(vec::map(elts, |x| fld.fold_expr(*x))),
|
expr_tup(elts) => expr_tup(vec::map(elts, |x| fld.fold_expr(*x))),
|
||||||
expr_call(f, args, blk) => {
|
expr_call(f, args, blk) => {
|
||||||
|
@ -451,14 +451,14 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||||
expr_addr_of(m, ohs) => expr_addr_of(m, fld.fold_expr(ohs)),
|
expr_addr_of(m, ohs) => expr_addr_of(m, fld.fold_expr(ohs)),
|
||||||
expr_if(cond, tr, fl) => {
|
expr_if(cond, tr, fl) => {
|
||||||
expr_if(fld.fold_expr(cond), fld.fold_block(tr),
|
expr_if(fld.fold_expr(cond), fld.fold_block(tr),
|
||||||
option::map(&fl, |x| fld.fold_expr(x)))
|
option::map(&fl, |x| fld.fold_expr(*x)))
|
||||||
}
|
}
|
||||||
expr_while(cond, body) => {
|
expr_while(cond, body) => {
|
||||||
expr_while(fld.fold_expr(cond), fld.fold_block(body))
|
expr_while(fld.fold_expr(cond), fld.fold_block(body))
|
||||||
}
|
}
|
||||||
expr_loop(body, opt_ident) => {
|
expr_loop(body, opt_ident) => {
|
||||||
expr_loop(fld.fold_block(body),
|
expr_loop(fld.fold_block(body),
|
||||||
option::map(&opt_ident, |x| fld.fold_ident(x)))
|
option::map(&opt_ident, |x| fld.fold_ident(*x)))
|
||||||
}
|
}
|
||||||
expr_match(expr, arms) => {
|
expr_match(expr, arms) => {
|
||||||
expr_match(fld.fold_expr(expr),
|
expr_match(fld.fold_expr(expr),
|
||||||
|
@ -500,12 +500,12 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||||
expr_index(fld.fold_expr(el), fld.fold_expr(er))
|
expr_index(fld.fold_expr(el), fld.fold_expr(er))
|
||||||
}
|
}
|
||||||
expr_path(pth) => expr_path(fld.fold_path(pth)),
|
expr_path(pth) => expr_path(fld.fold_path(pth)),
|
||||||
expr_fail(e) => expr_fail(option::map(&e, |x| fld.fold_expr(x))),
|
expr_fail(e) => expr_fail(option::map(&e, |x| fld.fold_expr(*x))),
|
||||||
expr_break(opt_ident) =>
|
expr_break(opt_ident) =>
|
||||||
expr_break(option::map(&opt_ident, |x| fld.fold_ident(x))),
|
expr_break(option::map(&opt_ident, |x| fld.fold_ident(*x))),
|
||||||
expr_again(opt_ident) =>
|
expr_again(opt_ident) =>
|
||||||
expr_again(option::map(&opt_ident, |x| fld.fold_ident(x))),
|
expr_again(option::map(&opt_ident, |x| fld.fold_ident(*x))),
|
||||||
expr_ret(e) => expr_ret(option::map(&e, |x| fld.fold_expr(x))),
|
expr_ret(e) => expr_ret(option::map(&e, |x| fld.fold_expr(*x))),
|
||||||
expr_log(i, lv, e) => expr_log(i, fld.fold_expr(lv),
|
expr_log(i, lv, e) => expr_log(i, fld.fold_expr(lv),
|
||||||
fld.fold_expr(e)),
|
fld.fold_expr(e)),
|
||||||
expr_assert(e) => expr_assert(fld.fold_expr(e)),
|
expr_assert(e) => expr_assert(fld.fold_expr(e)),
|
||||||
|
@ -513,7 +513,7 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
|
||||||
expr_struct(path, fields, maybe_expr) => {
|
expr_struct(path, fields, maybe_expr) => {
|
||||||
expr_struct(fld.fold_path(path),
|
expr_struct(fld.fold_path(path),
|
||||||
vec::map(fields, |x| fold_field(*x)),
|
vec::map(fields, |x| fold_field(*x)),
|
||||||
option::map(&maybe_expr, |x| fld.fold_expr(x)))
|
option::map(&maybe_expr, |x| fld.fold_expr(*x)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ {
|
||||||
let dtor_id = fld.new_id(dtor.node.id);
|
let dtor_id = fld.new_id(dtor.node.id);
|
||||||
{node: {body: dtor_body,
|
{node: {body: dtor_body,
|
||||||
id: dtor_id,.. dtor.node},
|
id: dtor_id,.. dtor.node},
|
||||||
.. dtor}};
|
.. *dtor}};
|
||||||
kind = struct_variant_kind(@{
|
kind = struct_variant_kind(@{
|
||||||
traits: ~[],
|
traits: ~[],
|
||||||
fields: vec::map(struct_def.fields,
|
fields: vec::map(struct_def.fields,
|
||||||
|
@ -593,7 +593,7 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ {
|
||||||
let variants = vec::map(enum_definition.variants,
|
let variants = vec::map(enum_definition.variants,
|
||||||
|x| fld.fold_variant(*x));
|
|x| fld.fold_variant(*x));
|
||||||
let common = option::map(&enum_definition.common,
|
let common = option::map(&enum_definition.common,
|
||||||
|x| fold_struct_def(x, fld));
|
|x| fold_struct_def(*x, fld));
|
||||||
kind = enum_variant_kind(ast::enum_def({ variants: variants,
|
kind = enum_variant_kind(ast::enum_def({ variants: variants,
|
||||||
common: common }));
|
common: common }));
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ fn parse_crate_from_crate_file(input: &Path, cfg: ast::crate_cfg,
|
||||||
sess.chpos = rdr.chpos;
|
sess.chpos = rdr.chpos;
|
||||||
sess.byte_pos = sess.byte_pos + rdr.pos;
|
sess.byte_pos = sess.byte_pos + rdr.pos;
|
||||||
let cx = @{sess: sess, cfg: /* FIXME (#2543) */ copy p.cfg};
|
let cx = @{sess: sess, cfg: /* FIXME (#2543) */ copy p.cfg};
|
||||||
let companionmod = input.filestem().map(|s| Path(s));
|
let companionmod = input.filestem().map(|s| Path(*s));
|
||||||
let (m, attrs) = eval::eval_crate_directives_to_mod(
|
let (m, attrs) = eval::eval_crate_directives_to_mod(
|
||||||
cx, cdirs, &prefix, &companionmod);
|
cx, cdirs, &prefix, &companionmod);
|
||||||
let mut hi = p.span.hi;
|
let mut hi = p.span.hi;
|
||||||
|
|
|
@ -2758,7 +2758,7 @@ impl parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
let actual_dtor = do the_dtor.map |dtor| {
|
let actual_dtor = do the_dtor.map |dtor| {
|
||||||
let (d_body, d_attrs, d_s) = dtor;
|
let (d_body, d_attrs, d_s) = *dtor;
|
||||||
{node: {id: self.get_id(),
|
{node: {id: self.get_id(),
|
||||||
attrs: d_attrs,
|
attrs: d_attrs,
|
||||||
self_id: self.get_id(),
|
self_id: self.get_id(),
|
||||||
|
@ -3126,7 +3126,7 @@ impl parser {
|
||||||
}
|
}
|
||||||
self.bump();
|
self.bump();
|
||||||
let mut actual_dtor = do the_dtor.map |dtor| {
|
let mut actual_dtor = do the_dtor.map |dtor| {
|
||||||
let (d_body, d_attrs, d_s) = dtor;
|
let (d_body, d_attrs, d_s) = *dtor;
|
||||||
{node: {id: self.get_id(),
|
{node: {id: self.get_id(),
|
||||||
attrs: d_attrs,
|
attrs: d_attrs,
|
||||||
self_id: self.get_id(),
|
self_id: self.get_id(),
|
||||||
|
|
|
@ -395,7 +395,7 @@ fn visit_exprs<E>(exprs: ~[@expr], e: E, v: vt<E>) {
|
||||||
fn visit_mac<E>(m: mac, e: E, v: vt<E>) {
|
fn visit_mac<E>(m: mac, e: E, v: vt<E>) {
|
||||||
match m.node {
|
match m.node {
|
||||||
ast::mac_invoc(_, arg, _) => {
|
ast::mac_invoc(_, arg, _) => {
|
||||||
option::map(&arg, |arg| v.visit_expr(arg, e, v)); }
|
option::map(&arg, |arg| v.visit_expr(*arg, e, v)); }
|
||||||
ast::mac_invoc_tt(*) => { /* no user-serviceable parts inside */ }
|
ast::mac_invoc_tt(*) => { /* no user-serviceable parts inside */ }
|
||||||
ast::mac_ellipsis => (),
|
ast::mac_ellipsis => (),
|
||||||
ast::mac_aq(*) => { /* FIXME: maybe visit (Issue #2340) */ }
|
ast::mac_aq(*) => { /* FIXME: maybe visit (Issue #2340) */ }
|
||||||
|
|
|
@ -507,7 +507,7 @@ fn build_session_options(binary: ~str,
|
||||||
let extra_debuginfo = opt_present(matches, ~"xg");
|
let extra_debuginfo = opt_present(matches, ~"xg");
|
||||||
let debuginfo = opt_present(matches, ~"g") || extra_debuginfo;
|
let debuginfo = opt_present(matches, ~"g") || extra_debuginfo;
|
||||||
let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
|
let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
|
||||||
let sysroot_opt = sysroot_opt.map(|m| Path(m));
|
let sysroot_opt = sysroot_opt.map(|m| Path(*m));
|
||||||
let target_opt = getopts::opt_maybe_str(matches, ~"target");
|
let target_opt = getopts::opt_maybe_str(matches, ~"target");
|
||||||
let save_temps = getopts::opt_present(matches, ~"save-temps");
|
let save_temps = getopts::opt_present(matches, ~"save-temps");
|
||||||
match output_type {
|
match output_type {
|
||||||
|
|
|
@ -172,14 +172,14 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) {
|
||||||
let sopts = build_session_options(binary, matches, demitter);
|
let sopts = build_session_options(binary, matches, demitter);
|
||||||
let sess = build_session(sopts, demitter);
|
let sess = build_session(sopts, demitter);
|
||||||
let odir = getopts::opt_maybe_str(matches, ~"out-dir");
|
let odir = getopts::opt_maybe_str(matches, ~"out-dir");
|
||||||
let odir = odir.map(|o| Path(o));
|
let odir = odir.map(|o| Path(*o));
|
||||||
let ofile = getopts::opt_maybe_str(matches, ~"o");
|
let ofile = getopts::opt_maybe_str(matches, ~"o");
|
||||||
let ofile = ofile.map(|o| Path(o));
|
let ofile = ofile.map(|o| Path(*o));
|
||||||
let cfg = build_configuration(sess, binary, input);
|
let cfg = build_configuration(sess, binary, input);
|
||||||
let pretty =
|
let pretty =
|
||||||
option::map(&getopts::opt_default(matches, ~"pretty",
|
option::map(&getopts::opt_default(matches, ~"pretty",
|
||||||
~"normal"),
|
~"normal"),
|
||||||
|a| parse_pretty(sess, a) );
|
|a| parse_pretty(sess, *a) );
|
||||||
match pretty {
|
match pretty {
|
||||||
Some::<pp_mode>(ppm) => {
|
Some::<pp_mode>(ppm) => {
|
||||||
pretty_print_input(sess, cfg, input, ppm);
|
pretty_print_input(sess, cfg, input, ppm);
|
||||||
|
|
|
@ -104,7 +104,7 @@ fn fold_block(cx: ctxt, b: ast::blk_, fld: fold::ast_fold) ->
|
||||||
let filtered_stmts = vec::filter_map(b.stmts, filter);
|
let filtered_stmts = vec::filter_map(b.stmts, filter);
|
||||||
return {view_items: b.view_items,
|
return {view_items: b.view_items,
|
||||||
stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)),
|
stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)),
|
||||||
expr: option::map(&b.expr, |x| fld.fold_expr(x)),
|
expr: option::map(&b.expr, |x| fld.fold_expr(*x)),
|
||||||
id: b.id,
|
id: b.id,
|
||||||
rules: b.rules};
|
rules: b.rules};
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ fn get_dep_hashes(cstore: cstore) -> ~[~str] {
|
||||||
|
|
||||||
fn get_path(cstore: cstore, d: ast::def_id) -> ~[~str] {
|
fn get_path(cstore: cstore, d: ast::def_id) -> ~[~str] {
|
||||||
option::map_default(&p(cstore).mod_path_map.find(d), ~[],
|
option::map_default(&p(cstore).mod_path_map.find(d), ~[],
|
||||||
|ds| str::split_str(*ds, ~"::"))
|
|ds| str::split_str(**ds, ~"::"))
|
||||||
}
|
}
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: rust
|
// mode: rust
|
||||||
|
|
|
@ -196,7 +196,7 @@ fn field_mutability(d: ebml::Doc) -> ast::class_mutability {
|
||||||
&ebml::maybe_get_doc(d, tag_class_mut),
|
&ebml::maybe_get_doc(d, tag_class_mut),
|
||||||
ast::class_immutable,
|
ast::class_immutable,
|
||||||
|d| {
|
|d| {
|
||||||
match ebml::doc_as_u8(d) as char {
|
match ebml::doc_as_u8(*d) as char {
|
||||||
'm' => ast::class_mutable,
|
'm' => ast::class_mutable,
|
||||||
_ => ast::class_immutable
|
_ => ast::class_immutable
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ fn item_ty_param_bounds(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd)
|
||||||
|
|
||||||
fn item_ty_region_param(item: ebml::Doc) -> Option<ty::region_variance> {
|
fn item_ty_region_param(item: ebml::Doc) -> Option<ty::region_variance> {
|
||||||
ebml::maybe_get_doc(item, tag_region_param).map(|doc| {
|
ebml::maybe_get_doc(item, tag_region_param).map(|doc| {
|
||||||
let d = ebml::ebml_deserializer(doc);
|
let d = ebml::ebml_deserializer(*doc);
|
||||||
ty::deserialize_region_variance(d)
|
ty::deserialize_region_variance(d)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ impl check_loan_ctxt {
|
||||||
debug!("check_pure_callee_or_arg(pc=%?, expr=%?, \
|
debug!("check_pure_callee_or_arg(pc=%?, expr=%?, \
|
||||||
callee_id=%d, ty=%s)",
|
callee_id=%d, ty=%s)",
|
||||||
pc,
|
pc,
|
||||||
opt_expr.map(|e| pprust::expr_to_str(e, tcx.sess.intr()) ),
|
opt_expr.map(|e| pprust::expr_to_str(*e, tcx.sess.intr()) ),
|
||||||
callee_id,
|
callee_id,
|
||||||
ty_to_str(self.tcx(), ty::node_id_to_type(tcx, callee_id)));
|
ty_to_str(self.tcx(), ty::node_id_to_type(tcx, callee_id)));
|
||||||
|
|
||||||
|
|
|
@ -659,7 +659,7 @@ impl Liveness {
|
||||||
expr_path(_) => {
|
expr_path(_) => {
|
||||||
let def = self.tcx.def_map.get(expr.id);
|
let def = self.tcx.def_map.get(expr.id);
|
||||||
relevant_def(def).map(
|
relevant_def(def).map(
|
||||||
|rdef| self.variable_from_rdef(rdef, expr.span)
|
|rdef| self.variable_from_rdef(*rdef, expr.span)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
_ => None
|
_ => None
|
||||||
|
@ -675,7 +675,7 @@ impl Liveness {
|
||||||
match self.tcx.def_map.find(node_id) {
|
match self.tcx.def_map.find(node_id) {
|
||||||
Some(def) => {
|
Some(def) => {
|
||||||
relevant_def(def).map(
|
relevant_def(def).map(
|
||||||
|rdef| self.variable_from_rdef(rdef, span)
|
|rdef| self.variable_from_rdef(*rdef, span)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
@ -1396,7 +1396,7 @@ impl Liveness {
|
||||||
// Note: the field_map is empty unless we are in a ctor
|
// Note: the field_map is empty unless we are in a ctor
|
||||||
return self.ir.field_map.find(fld).map(|var| {
|
return self.ir.field_map.find(fld).map(|var| {
|
||||||
let ln = self.live_node(expr.id, expr.span);
|
let ln = self.live_node(expr.id, expr.span);
|
||||||
(ln, var)
|
(ln, *var)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_ => return None
|
_ => return None
|
||||||
|
|
|
@ -612,7 +612,7 @@ impl &mem_categorization_ctxt {
|
||||||
cmt: cmt) -> cmt {
|
cmt: cmt) -> cmt {
|
||||||
@{id: arg.id(), span: arg.span(),
|
@{id: arg.id(), span: arg.span(),
|
||||||
cat: cat_comp(cmt, comp_variant(enum_did)),
|
cat: cat_comp(cmt, comp_variant(enum_did)),
|
||||||
lp: cmt.lp.map(|l| @lp_comp(l, comp_variant(enum_did)) ),
|
lp: cmt.lp.map(|l| @lp_comp(*l, comp_variant(enum_did)) ),
|
||||||
mutbl: cmt.mutbl, // imm iff in an immutable context
|
mutbl: cmt.mutbl, // imm iff in an immutable context
|
||||||
ty: self.tcx.ty(arg)}
|
ty: self.tcx.ty(arg)}
|
||||||
}
|
}
|
||||||
|
@ -649,7 +649,7 @@ impl &mem_categorization_ctxt {
|
||||||
};
|
};
|
||||||
let m = self.inherited_mutability(base_cmt.mutbl, f_mutbl);
|
let m = self.inherited_mutability(base_cmt.mutbl, f_mutbl);
|
||||||
let f_comp = comp_field(f_name, f_mutbl);
|
let f_comp = comp_field(f_name, f_mutbl);
|
||||||
let lp = base_cmt.lp.map(|lp| @lp_comp(lp, f_comp) );
|
let lp = base_cmt.lp.map(|lp| @lp_comp(*lp, f_comp) );
|
||||||
@{id: node.id(), span: node.span(),
|
@{id: node.id(), span: node.span(),
|
||||||
cat: cat_comp(base_cmt, f_comp), lp:lp,
|
cat: cat_comp(base_cmt, f_comp), lp:lp,
|
||||||
mutbl: m, ty: self.tcx.ty(node)}
|
mutbl: m, ty: self.tcx.ty(node)}
|
||||||
|
@ -699,7 +699,7 @@ impl &mem_categorization_ctxt {
|
||||||
}
|
}
|
||||||
|
|
||||||
deref_comp(comp) => {
|
deref_comp(comp) => {
|
||||||
let lp = base_cmt.lp.map(|l| @lp_comp(l, comp) );
|
let lp = base_cmt.lp.map(|l| @lp_comp(*l, comp) );
|
||||||
let m = self.inherited_mutability(base_cmt.mutbl, mt.mutbl);
|
let m = self.inherited_mutability(base_cmt.mutbl, mt.mutbl);
|
||||||
@{id:node.id(), span:node.span(),
|
@{id:node.id(), span:node.span(),
|
||||||
cat:cat_comp(base_cmt, comp), lp:lp,
|
cat:cat_comp(base_cmt, comp), lp:lp,
|
||||||
|
@ -724,7 +724,7 @@ impl &mem_categorization_ctxt {
|
||||||
// (a) the contents are loanable if the base is loanable
|
// (a) the contents are loanable if the base is loanable
|
||||||
// and this is a *unique* vector
|
// and this is a *unique* vector
|
||||||
let deref_lp = match ptr {
|
let deref_lp = match ptr {
|
||||||
uniq_ptr => {base_cmt.lp.map(|lp| @lp_deref(lp, uniq_ptr))}
|
uniq_ptr => {base_cmt.lp.map(|lp| @lp_deref(*lp, uniq_ptr))}
|
||||||
_ => {None}
|
_ => {None}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ impl &mem_categorization_ctxt {
|
||||||
fn comp(expr: @ast::expr, of_cmt: cmt,
|
fn comp(expr: @ast::expr, of_cmt: cmt,
|
||||||
vect: ty::t, mutbl: ast::mutability, ty: ty::t) -> cmt {
|
vect: ty::t, mutbl: ast::mutability, ty: ty::t) -> cmt {
|
||||||
let comp = comp_index(vect, mutbl);
|
let comp = comp_index(vect, mutbl);
|
||||||
let index_lp = of_cmt.lp.map(|lp| @lp_comp(lp, comp) );
|
let index_lp = of_cmt.lp.map(|lp| @lp_comp(*lp, comp) );
|
||||||
@{id:expr.id, span:expr.span,
|
@{id:expr.id, span:expr.span,
|
||||||
cat:cat_comp(of_cmt, comp), lp:index_lp,
|
cat:cat_comp(of_cmt, comp), lp:index_lp,
|
||||||
mutbl:mutbl, ty:ty}
|
mutbl:mutbl, ty:ty}
|
||||||
|
@ -766,7 +766,7 @@ impl &mem_categorization_ctxt {
|
||||||
fn cat_tuple_elt<N: ast_node>(elt: N, cmt: cmt) -> cmt {
|
fn cat_tuple_elt<N: ast_node>(elt: N, cmt: cmt) -> cmt {
|
||||||
@{id: elt.id(), span: elt.span(),
|
@{id: elt.id(), span: elt.span(),
|
||||||
cat: cat_comp(cmt, comp_tuple),
|
cat: cat_comp(cmt, comp_tuple),
|
||||||
lp: cmt.lp.map(|l| @lp_comp(l, comp_tuple) ),
|
lp: cmt.lp.map(|l| @lp_comp(*l, comp_tuple) ),
|
||||||
mutbl: cmt.mutbl, // imm iff in an immutable context
|
mutbl: cmt.mutbl, // imm iff in an immutable context
|
||||||
ty: self.tcx.ty(elt)}
|
ty: self.tcx.ty(elt)}
|
||||||
}
|
}
|
||||||
|
@ -958,7 +958,7 @@ impl &mem_categorization_ctxt {
|
||||||
self.cat_to_repr(cmt.cat),
|
self.cat_to_repr(cmt.cat),
|
||||||
cmt.id,
|
cmt.id,
|
||||||
self.mut_to_str(cmt.mutbl),
|
self.mut_to_str(cmt.mutbl),
|
||||||
cmt.lp.map_default(~"none", |p| self.lp_to_str(p) ),
|
cmt.lp.map_default(~"none", |p| self.lp_to_str(*p) ),
|
||||||
ty_to_str(self.tcx, cmt.ty))
|
ty_to_str(self.tcx, cmt.ty))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -537,7 +537,7 @@ fn trans_arg_expr(bcx: block,
|
||||||
ret_flag=%?)",
|
ret_flag=%?)",
|
||||||
formal_ty.mode, bcx.ty_to_str(formal_ty.ty),
|
formal_ty.mode, bcx.ty_to_str(formal_ty.ty),
|
||||||
bcx.expr_to_str(arg_expr),
|
bcx.expr_to_str(arg_expr),
|
||||||
ret_flag.map(|v| bcx.val_str(v)));
|
ret_flag.map(|v| bcx.val_str(*v)));
|
||||||
let _indenter = indenter();
|
let _indenter = indenter();
|
||||||
|
|
||||||
// translate the arg expr to a datum
|
// translate the arg expr to a datum
|
||||||
|
|
|
@ -1222,7 +1222,7 @@ fn node_id_type_params(bcx: block, id: ast::node_id) -> ~[ty::t] {
|
||||||
fn node_vtables(bcx: block, id: ast::node_id) -> Option<typeck::vtable_res> {
|
fn node_vtables(bcx: block, id: ast::node_id) -> Option<typeck::vtable_res> {
|
||||||
let raw_vtables = bcx.ccx().maps.vtable_map.find(id);
|
let raw_vtables = bcx.ccx().maps.vtable_map.find(id);
|
||||||
raw_vtables.map(
|
raw_vtables.map(
|
||||||
|vts| meth::resolve_vtables_in_fn_ctxt(bcx.fcx, vts))
|
|vts| meth::resolve_vtables_in_fn_ctxt(bcx.fcx, *vts))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_vtables_in_fn_ctxt(fcx: fn_ctxt, vts: typeck::vtable_res)
|
fn resolve_vtables_in_fn_ctxt(fcx: fn_ctxt, vts: typeck::vtable_res)
|
||||||
|
|
|
@ -192,16 +192,16 @@ fn lazily_emit_simplified_tydesc_glue(ccx: @crate_ctxt, field: uint,
|
||||||
lazily_emit_tydesc_glue(ccx, field, simpl_ti);
|
lazily_emit_tydesc_glue(ccx, field, simpl_ti);
|
||||||
if field == abi::tydesc_field_take_glue {
|
if field == abi::tydesc_field_take_glue {
|
||||||
ti.take_glue =
|
ti.take_glue =
|
||||||
simpl_ti.take_glue.map(|v| cast_glue(ccx, ti, v));
|
simpl_ti.take_glue.map(|v| cast_glue(ccx, ti, *v));
|
||||||
} else if field == abi::tydesc_field_drop_glue {
|
} else if field == abi::tydesc_field_drop_glue {
|
||||||
ti.drop_glue =
|
ti.drop_glue =
|
||||||
simpl_ti.drop_glue.map(|v| cast_glue(ccx, ti, v));
|
simpl_ti.drop_glue.map(|v| cast_glue(ccx, ti, *v));
|
||||||
} else if field == abi::tydesc_field_free_glue {
|
} else if field == abi::tydesc_field_free_glue {
|
||||||
ti.free_glue =
|
ti.free_glue =
|
||||||
simpl_ti.free_glue.map(|v| cast_glue(ccx, ti, v));
|
simpl_ti.free_glue.map(|v| cast_glue(ccx, ti, *v));
|
||||||
} else if field == abi::tydesc_field_visit_glue {
|
} else if field == abi::tydesc_field_visit_glue {
|
||||||
ti.visit_glue =
|
ti.visit_glue =
|
||||||
simpl_ti.visit_glue.map(|v| cast_glue(ccx, ti, v));
|
simpl_ti.visit_glue.map(|v| cast_glue(ccx, ti, *v));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) {
|
||||||
ty::ty_class(did, ref substs) => {
|
ty::ty_class(did, ref substs) => {
|
||||||
// Call the dtor if there is one
|
// Call the dtor if there is one
|
||||||
do option::map_default(&ty::ty_dtor(bcx.tcx(), did), bcx) |dt_id| {
|
do option::map_default(&ty::ty_dtor(bcx.tcx(), did), bcx) |dt_id| {
|
||||||
trans_class_drop(bcx, v, dt_id, did, substs)
|
trans_class_drop(bcx, v, *dt_id, did, substs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => bcx
|
_ => bcx
|
||||||
|
|
|
@ -1177,7 +1177,7 @@ fn fold_sty_to_ty(tcx: ty::ctxt, sty: &sty, foldop: fn(t) -> t) -> t {
|
||||||
fn fold_sty(sty: &sty, fldop: fn(t) -> t) -> sty {
|
fn fold_sty(sty: &sty, fldop: fn(t) -> t) -> sty {
|
||||||
fn fold_substs(substs: &substs, fldop: fn(t) -> t) -> substs {
|
fn fold_substs(substs: &substs, fldop: fn(t) -> t) -> substs {
|
||||||
{self_r: substs.self_r,
|
{self_r: substs.self_r,
|
||||||
self_ty: substs.self_ty.map(|t| fldop(t)),
|
self_ty: substs.self_ty.map(|t| fldop(*t)),
|
||||||
tps: substs.tps.map(|t| fldop(*t))}
|
tps: substs.tps.map(|t| fldop(*t))}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,8 +1273,8 @@ fn fold_regions_and_ty(
|
||||||
fldr: fn(r: region) -> region,
|
fldr: fn(r: region) -> region,
|
||||||
fldt: fn(t: t) -> t) -> substs {
|
fldt: fn(t: t) -> t) -> substs {
|
||||||
|
|
||||||
{self_r: substs.self_r.map(|r| fldr(r)),
|
{self_r: substs.self_r.map(|r| fldr(*r)),
|
||||||
self_ty: substs.self_ty.map(|t| fldt(t)),
|
self_ty: substs.self_ty.map(|t| fldt(*t)),
|
||||||
tps: substs.tps.map(|t| fldt(*t))}
|
tps: substs.tps.map(|t| fldt(*t))}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1403,8 +1403,8 @@ fn substs_is_noop(substs: &substs) -> bool {
|
||||||
|
|
||||||
fn substs_to_str(cx: ctxt, substs: &substs) -> ~str {
|
fn substs_to_str(cx: ctxt, substs: &substs) -> ~str {
|
||||||
fmt!("substs(self_r=%s, self_ty=%s, tps=%?)",
|
fmt!("substs(self_r=%s, self_ty=%s, tps=%?)",
|
||||||
substs.self_r.map_default(~"none", |r| region_to_str(cx, r)),
|
substs.self_r.map_default(~"none", |r| region_to_str(cx, *r)),
|
||||||
substs.self_ty.map_default(~"none", |t| ty_to_str(cx, t)),
|
substs.self_ty.map_default(~"none", |t| ty_to_str(cx, *t)),
|
||||||
tys_to_str(cx, substs.tps))
|
tys_to_str(cx, substs.tps))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ fn replace_bound_regions_in_fn_ty(
|
||||||
|
|
||||||
debug!("replace_bound_regions_in_fn_ty(self_info.self_ty=%?, fn_ty=%s, \
|
debug!("replace_bound_regions_in_fn_ty(self_info.self_ty=%?, fn_ty=%s, \
|
||||||
all_tys=%?)",
|
all_tys=%?)",
|
||||||
self_ty.map(|t| ty_to_str(tcx, t)),
|
self_ty.map(|t| ty_to_str(tcx, *t)),
|
||||||
ty_to_str(tcx, ty::mk_fn(tcx, *fn_ty)),
|
ty_to_str(tcx, ty::mk_fn(tcx, *fn_ty)),
|
||||||
all_tys.map(|t| ty_to_str(tcx, *t)));
|
all_tys.map(|t| ty_to_str(tcx, *t)));
|
||||||
let _i = indenter();
|
let _i = indenter();
|
||||||
|
@ -50,11 +50,11 @@ fn replace_bound_regions_in_fn_ty(
|
||||||
let t_fn = ty::fold_sty_to_ty(tcx, &ty_fn, |t| {
|
let t_fn = ty::fold_sty_to_ty(tcx, &ty_fn, |t| {
|
||||||
replace_bound_regions(tcx, isr, t)
|
replace_bound_regions(tcx, isr, t)
|
||||||
});
|
});
|
||||||
let t_self = self_ty.map(|t| replace_bound_regions(tcx, isr, t));
|
let t_self = self_ty.map(|t| replace_bound_regions(tcx, isr, *t));
|
||||||
|
|
||||||
debug!("result of replace_bound_regions_in_fn_ty: self_info.self_ty=%?, \
|
debug!("result of replace_bound_regions_in_fn_ty: self_info.self_ty=%?, \
|
||||||
fn_ty=%s",
|
fn_ty=%s",
|
||||||
t_self.map(|t| ty_to_str(tcx, t)),
|
t_self.map(|t| ty_to_str(tcx, *t)),
|
||||||
ty_to_str(tcx, t_fn));
|
ty_to_str(tcx, t_fn));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ fn fixup_substs(fcx: @fn_ctxt, expr: @ast::expr,
|
||||||
// use a dummy type just to package up the substs that need fixing up
|
// use a dummy type just to package up the substs that need fixing up
|
||||||
let t = ty::mk_trait(tcx, id, substs, ty::vstore_slice(ty::re_static));
|
let t = ty::mk_trait(tcx, id, substs, ty::vstore_slice(ty::re_static));
|
||||||
do fixup_ty(fcx, expr, t, is_early).map |t_f| {
|
do fixup_ty(fcx, expr, t, is_early).map |t_f| {
|
||||||
match ty::get(t_f).sty {
|
match ty::get(*t_f).sty {
|
||||||
ty::ty_trait(_, substs_f, _) => substs_f,
|
ty::ty_trait(_, substs_f, _) => substs_f,
|
||||||
_ => fail ~"t_f should be a trait"
|
_ => fail ~"t_f should be a trait"
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ fn config_from_opts(
|
||||||
let result = result::Ok(config);
|
let result = result::Ok(config);
|
||||||
let result = do result::chain(result) |config| {
|
let result = do result::chain(result) |config| {
|
||||||
let output_dir = getopts::opt_maybe_str(matches, opt_output_dir());
|
let output_dir = getopts::opt_maybe_str(matches, opt_output_dir());
|
||||||
let output_dir = output_dir.map(|s| Path(s));
|
let output_dir = output_dir.map(|s| Path(*s));
|
||||||
result::Ok({
|
result::Ok({
|
||||||
output_dir: output_dir.get_default(config.output_dir),
|
output_dir: output_dir.get_default(config.output_dir),
|
||||||
.. config
|
.. config
|
||||||
|
@ -152,7 +152,7 @@ fn config_from_opts(
|
||||||
matches, opt_output_format());
|
matches, opt_output_format());
|
||||||
do output_format.map_default(result::Ok(config))
|
do output_format.map_default(result::Ok(config))
|
||||||
|output_format| {
|
|output_format| {
|
||||||
do result::chain(parse_output_format(output_format))
|
do result::chain(parse_output_format(*output_format))
|
||||||
|output_format| {
|
|output_format| {
|
||||||
|
|
||||||
result::Ok({
|
result::Ok({
|
||||||
|
@ -167,7 +167,7 @@ fn config_from_opts(
|
||||||
getopts::opt_maybe_str(matches, opt_output_style());
|
getopts::opt_maybe_str(matches, opt_output_style());
|
||||||
do output_style.map_default(result::Ok(config))
|
do output_style.map_default(result::Ok(config))
|
||||||
|output_style| {
|
|output_style| {
|
||||||
do result::chain(parse_output_style(output_style))
|
do result::chain(parse_output_style(*output_style))
|
||||||
|output_style| {
|
|output_style| {
|
||||||
result::Ok({
|
result::Ok({
|
||||||
output_style: output_style,
|
output_style: output_style,
|
||||||
|
|
|
@ -32,7 +32,7 @@ fn run(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn maybe_apply_op(op: Op, s: Option<~str>) -> Option<~str> {
|
fn maybe_apply_op(op: Op, s: Option<~str>) -> Option<~str> {
|
||||||
s.map(|s| op(s) )
|
s.map(|s| op(*s) )
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fold_item(fold: fold::Fold<Op>, doc: doc::ItemDoc) -> doc::ItemDoc {
|
fn fold_item(fold: fold::Fold<Op>, doc: doc::ItemDoc) -> doc::ItemDoc {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue