aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp/middle')
-rw-r--r--src/comp/middle/capture.rs30
-rw-r--r--src/comp/middle/fold.rs98
-rw-r--r--src/comp/middle/metadata.rs274
-rw-r--r--src/comp/middle/resolve.rs94
-rw-r--r--src/comp/middle/trans.rs402
-rw-r--r--src/comp/middle/ty.rs192
-rw-r--r--src/comp/middle/typeck.rs176
-rw-r--r--src/comp/middle/typestate_check.rs212
-rw-r--r--src/comp/middle/walk.rs10
9 files changed, 744 insertions, 744 deletions
diff --git a/src/comp/middle/capture.rs b/src/comp/middle/capture.rs
index 02431580..003c3897 100644
--- a/src/comp/middle/capture.rs
+++ b/src/comp/middle/capture.rs
@@ -1,29 +1,29 @@
import driver.session;
import front.ast;
-import std.map.hashmap;
-import std.option;
-import std.option.some;
-import std.option.none;
-import std._int;
-import std._vec;
+import std.Map.hashmap;
+import std.Option;
+import std.Option.some;
+import std.Option.none;
+import std.Int;
+import std.Vec;
import util.common;
-type fn_id_of_local = std.map.hashmap[ast.def_id, ast.def_id];
+type fn_id_of_local = std.Map.hashmap[ast.def_id, ast.def_id];
type env = rec(mutable vec[ast.def_id] current_context, // fn or obj
fn_id_of_local idmap,
session.session sess);
fn current_context(&env e) -> ast.def_id {
- ret e.current_context.(_vec.len(e.current_context) - 1u);
+ ret e.current_context.(Vec.len(e.current_context) - 1u);
}
fn enter_item(@env e, @ast.item i) {
alt (i.node) {
case (ast.item_fn(?name, _, _, ?id, _)) {
- _vec.push(e.current_context, id);
+ Vec.push(e.current_context, id);
}
case (ast.item_obj(_, _, _, ?ids, _)) {
- _vec.push(e.current_context, ids.ty);
+ Vec.push(e.current_context, ids.ty);
}
case (_) {}
}
@@ -32,10 +32,10 @@ fn enter_item(@env e, @ast.item i) {
fn leave_item(@env e, @ast.item i) {
alt (i.node) {
case (ast.item_fn(?name, _, _, ?id, _)) {
- _vec.pop(e.current_context);
+ Vec.pop(e.current_context);
}
case (ast.item_obj(_, _, _, ?ids, _)) {
- _vec.pop(e.current_context);
+ Vec.pop(e.current_context);
}
case (_) {}
}
@@ -61,13 +61,13 @@ fn walk_expr(@env e, @ast.expr x) {
}
case (ast.expr_path(_, ?def, _)) {
auto local_id;
- alt (option.get(def)) {
+ alt (Option.get(def)) {
case (ast.def_local(?id)) { local_id = id; }
case (_) { ret; }
}
- auto df = ast.def_id_of_def(option.get(def));
- auto def_context = option.get(e.idmap.find(df));
+ auto df = ast.def_id_of_def(Option.get(def));
+ auto def_context = Option.get(e.idmap.find(df));
if (current_context(*e) != def_context) {
e.sess.span_err(x.span,
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs
index b37f7be8..ace45c2f 100644
--- a/src/comp/middle/fold.rs
+++ b/src/comp/middle/fold.rs
@@ -1,7 +1,7 @@
-import std.map.hashmap;
-import std.option;
-import std.option.some;
-import std.option.none;
+import std.Map.hashmap;
+import std.Option;
+import std.Option.some;
+import std.Option.none;
import util.common.new_str_hash;
import util.common.spanned;
@@ -32,8 +32,8 @@ import front.ast.ann;
import front.ast.mt;
import front.ast.purity;
-import std._uint;
-import std._vec;
+import std.UInt;
+import std.Vec;
type ast_fold[ENV] =
@rec
@@ -67,7 +67,7 @@ type ast_fold[ENV] =
@ty output) -> @ty) fold_ty_fn,
(fn(&ENV e, &span sp, ast.path p,
- &option.t[def] d) -> @ty) fold_ty_path,
+ &Option.t[def] d) -> @ty) fold_ty_path,
(fn(&ENV e, &span sp, @ty t) -> @ty) fold_ty_chan,
(fn(&ENV e, &span sp, @ty t) -> @ty) fold_ty_port,
@@ -82,7 +82,7 @@ type ast_fold[ENV] =
(fn(&ENV e, &span sp,
vec[ast.field] fields,
- option.t[@expr] base, ann a) -> @expr) fold_expr_rec,
+ Option.t[@expr] base, ann a) -> @expr) fold_expr_rec,
(fn(&ENV e, &span sp,
@expr f, vec[@expr] args,
@@ -92,11 +92,11 @@ type ast_fold[ENV] =
ident id, ann a) -> @expr) fold_expr_self_method,
(fn(&ENV e, &span sp,
- @expr f, vec[option.t[@expr]] args,
+ @expr f, vec[Option.t[@expr]] args,
ann a) -> @expr) fold_expr_bind,
(fn(&ENV e, &span sp,
- ast.spawn_dom dom, option.t[str] name,
+ ast.spawn_dom dom, Option.t[str] name,
@expr f, vec[@expr] args,
ann a) -> @expr) fold_expr_spawn,
@@ -118,7 +118,7 @@ type ast_fold[ENV] =
(fn(&ENV e, &span sp,
@expr cond, &block thn,
- &option.t[@expr] els,
+ &Option.t[@expr] els,
ann a) -> @expr) fold_expr_if,
(fn(&ENV e, &span sp,
@@ -169,12 +169,12 @@ type ast_fold[ENV] =
(fn(&ENV e, &span sp,
&path p,
- &option.t[def] d,
+ &Option.t[def] d,
ann a) -> @expr) fold_expr_path,
(fn(&ENV e, &span sp,
&path p, vec[@expr] args,
- option.t[str] body,
+ Option.t[str] body,
@expr expanded,
ann a) -> @expr) fold_expr_ext,
@@ -185,10 +185,10 @@ type ast_fold[ENV] =
(fn(&ENV e, &span sp, ann a) -> @expr) fold_expr_cont,
(fn(&ENV e, &span sp,
- &option.t[@expr] rv, ann a) -> @expr) fold_expr_ret,
+ &Option.t[@expr] rv, ann a) -> @expr) fold_expr_ret,
(fn(&ENV e, &span sp,
- &option.t[@expr] rv, ann a) -> @expr) fold_expr_put,
+ &Option.t[@expr] rv, ann a) -> @expr) fold_expr_put,
(fn(&ENV e, &span sp,
@expr e, ann a) -> @expr) fold_expr_be,
@@ -229,7 +229,7 @@ type ast_fold[ENV] =
(fn(&ENV e, &span sp,
path p, vec[@pat] args,
- option.t[ast.variant_def] d,
+ Option.t[ast.variant_def] d,
ann a) -> @pat) fold_pat_tag,
@@ -253,7 +253,7 @@ type ast_fold[ENV] =
def_id id, ann a) -> @item) fold_item_fn,
(fn(&ENV e, &span sp, ident ident,
- option.t[str] link_name,
+ Option.t[str] link_name,
&ast.fn_decl decl,
vec[ast.ty_param] ty_params,
def_id id, ann a) -> @native_item) fold_native_item_fn,
@@ -284,10 +284,10 @@ type ast_fold[ENV] =
// View Item folds.
(fn(&ENV e, &span sp, ident ident,
vec[@meta_item] meta_items,
- def_id id, option.t[int]) -> @view_item) fold_view_item_use,
+ def_id id, Option.t[int]) -> @view_item) fold_view_item_use,
(fn(&ENV e, &span sp, ident i, vec[ident] idents,
- def_id id, option.t[def]) -> @view_item) fold_view_item_import,
+ def_id id, Option.t[def]) -> @view_item) fold_view_item_import,
(fn(&ENV e, &span sp, ident i) -> @view_item) fold_view_item_export,
@@ -316,7 +316,7 @@ type ast_fold[ENV] =
(fn(&ENV e,
vec[ast.obj_field] fields,
vec[@ast.method] methods,
- option.t[@ast.method] dtor) -> ast._obj) fold_obj,
+ Option.t[@ast.method] dtor) -> ast._obj) fold_obj,
// Env updates.
(fn(&ENV e, @ast.crate c) -> ENV) update_env_for_crate,
@@ -341,7 +341,7 @@ type ast_fold[ENV] =
fn fold_path[ENV](&ENV env, ast_fold[ENV] fld, &path p) -> path {
let vec[@ast.ty] tys_ = vec();
for (@ast.ty t in p.node.types) {
- _vec.push[@ast.ty](tys_, fold_ty(env, fld, t));
+ Vec.push[@ast.ty](tys_, fold_ty(env, fld, t));
}
let ast.path_ p_ = rec(idents=p.node.idents, types=tys_);
ret fld.fold_path(env, p.span, p_);
@@ -382,7 +382,7 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
let vec[mt] elts_ = vec();
for (mt elt in elts) {
auto ty_ = fold_ty(env, fld, elt.ty);
- _vec.push[mt](elts_, rec(ty=ty_, mut=elt.mut));
+ Vec.push[mt](elts_, rec(ty=ty_, mut=elt.mut));
}
ret fld.fold_ty_tup(env_, t.span, elts_);
}
@@ -391,7 +391,7 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
let vec[ast.ty_field] flds_ = vec();
for (ast.ty_field f in flds) {
auto ty_ = fold_ty(env, fld, f.mt.ty);
- _vec.push[ast.ty_field]
+ Vec.push[ast.ty_field]
(flds_, rec(mt=rec(ty=ty_, mut=f.mt.mut) with f));
}
ret fld.fold_ty_rec(env_, t.span, flds_);
@@ -404,7 +404,7 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
m.inputs, m.output);
alt (tfn.node) {
case (ast.ty_fn(?p, ?ins, ?out)) {
- _vec.push[ast.ty_method]
+ Vec.push[ast.ty_method]
(meths_, rec(proto=p, inputs=ins,
output=out with m));
}
@@ -518,7 +518,7 @@ fn fold_pat[ENV](&ENV env, ast_fold[ENV] fld, @ast.pat p) -> @ast.pat {
fn fold_exprs[ENV](&ENV env, ast_fold[ENV] fld, vec[@expr] es) -> vec[@expr] {
let vec[@expr] exprs = vec();
for (@expr e in es) {
- _vec.push[@expr](exprs, fold_expr(env, fld, e));
+ Vec.push[@expr](exprs, fold_expr(env, fld, e));
}
ret exprs;
}
@@ -558,7 +558,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
case (ast.expr_rec(?fs, ?base, ?t)) {
let vec[ast.field] fields = vec();
- let option.t[@expr] b = none[@expr];
+ let Option.t[@expr] b = none[@expr];
for (ast.field f in fs) {
fields += vec(fold_rec_field(env, fld, f));
}
@@ -586,8 +586,8 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
case (ast.expr_bind(?f, ?args_opt, ?t)) {
auto ff = fold_expr(env_, fld, f);
- let vec[option.t[@ast.expr]] aargs_opt = vec();
- for (option.t[@ast.expr] t_opt in args_opt) {
+ let vec[Option.t[@ast.expr]] aargs_opt = vec();
+ for (Option.t[@ast.expr] t_opt in args_opt) {
alt (t_opt) {
case (none[@ast.expr]) {
aargs_opt += vec(none[@ast.expr]);
@@ -865,7 +865,7 @@ fn fold_block[ENV](&ENV env, ast_fold[ENV] fld, &block blk) -> block {
let vec[@ast.stmt] stmts = vec();
for (@ast.stmt s in blk.node.stmts) {
auto new_stmt = fold_stmt[ENV](env_, fld, s);
- _vec.push[@ast.stmt](stmts, new_stmt);
+ Vec.push[@ast.stmt](stmts, new_stmt);
ast.index_stmt(index, new_stmt);
}
@@ -935,7 +935,7 @@ fn fold_obj[ENV](&ENV env, ast_fold[ENV] fld, &ast._obj ob) -> ast._obj {
for (ast.obj_field f in ob.fields) {
fields += vec(fold_obj_field(env, fld, f));
}
- let option.t[@ast.method] dtor = none[@ast.method];
+ let Option.t[@ast.method] dtor = none[@ast.method];
alt (ob.dtor) {
case (none[@ast.method]) { }
case (some[@ast.method](?m)) {
@@ -954,7 +954,7 @@ fn fold_obj[ENV](&ENV env, ast_fold[ENV] fld, &ast._obj ob) -> ast._obj {
m.node.ann),
span=m.span);
let ENV _env = fld.update_env_for_item(env, i);
- _vec.push[@ast.method](meths, fold_method(_env, fld, m));
+ Vec.push[@ast.method](meths, fold_method(_env, fld, m));
}
ret fld.fold_obj(env, fields, meths, dtor);
}
@@ -1057,13 +1057,13 @@ fn fold_mod[ENV](&ENV e, ast_fold[ENV] fld, &ast._mod m) -> ast._mod {
for (@view_item vi in m.view_items) {
auto new_vi = fold_view_item[ENV](e, fld, vi);
- _vec.push[@view_item](view_items, new_vi);
+ Vec.push[@view_item](view_items, new_vi);
ast.index_view_item(index, new_vi);
}
for (@item i in m.items) {
auto new_item = fold_item[ENV](e, fld, i);
- _vec.push[@item](items, new_item);
+ Vec.push[@item](items, new_item);
ast.index_item(index, new_item);
}
@@ -1098,12 +1098,12 @@ fn fold_native_mod[ENV](&ENV e, ast_fold[ENV] fld,
for (@view_item vi in m.view_items) {
auto new_vi = fold_view_item[ENV](e, fld, vi);
- _vec.push[@view_item](view_items, new_vi);
+ Vec.push[@view_item](view_items, new_vi);
}
for (@native_item i in m.items) {
auto new_item = fold_native_item[ENV](e, fld, i);
- _vec.push[@native_item](items, new_item);
+ Vec.push[@native_item](items, new_item);
ast.index_native_item(index, new_item);
}
@@ -1202,7 +1202,7 @@ fn identity_fold_ty_fn[ENV](&ENV env, &span sp,
}
fn identity_fold_ty_path[ENV](&ENV env, &span sp, ast.path p,
- &option.t[def] d) -> @ty {
+ &Option.t[def] d) -> @ty {
ret @respan(sp, ast.ty_path(p, d));
}
@@ -1228,7 +1228,7 @@ fn identity_fold_expr_tup[ENV](&ENV env, &span sp,
fn identity_fold_expr_rec[ENV](&ENV env, &span sp,
vec[ast.field] fields,
- option.t[@expr] base, ann a) -> @expr {
+ Option.t[@expr] base, ann a) -> @expr {
ret @respan(sp, ast.expr_rec(fields, base, a));
}
@@ -1243,13 +1243,13 @@ fn identity_fold_expr_self_method[ENV](&ENV env, &span sp, ident id,
}
fn identity_fold_expr_bind[ENV](&ENV env, &span sp, @expr f,
- vec[option.t[@expr]] args_opt, ann a)
+ vec[Option.t[@expr]] args_opt, ann a)
-> @expr {
ret @respan(sp, ast.expr_bind(f, args_opt, a));
}
fn identity_fold_expr_spawn[ENV](&ENV env, &span sp,
- ast.spawn_dom dom, option.t[str] name,
+ ast.spawn_dom dom, Option.t[str] name,
@expr f, vec[@expr] args, ann a) -> @expr {
ret @respan(sp, ast.expr_spawn(dom, name, f, args, a));
}
@@ -1278,7 +1278,7 @@ fn identity_fold_expr_cast[ENV](&ENV env, &span sp, @ast.expr e,
fn identity_fold_expr_if[ENV](&ENV env, &span sp,
@expr cond, &block thn,
- &option.t[@expr] els, ann a) -> @expr {
+ &Option.t[@expr] els, ann a) -> @expr {
ret @respan(sp, ast.expr_if(cond, thn, els, a));
}
@@ -1347,14 +1347,14 @@ fn identity_fold_expr_index[ENV](&ENV env, &span sp,
}
fn identity_fold_expr_path[ENV](&ENV env, &span sp,
- &path p, &option.t[def] d,
+ &path p, &Option.t[def] d,
ann a) -> @expr {
ret @respan(sp, ast.expr_path(p, d, a));
}
fn identity_fold_expr_ext[ENV](&ENV env, &span sp,
&path p, vec[@expr] args,
- option.t[str] body,
+ Option.t[str] body,
@expr expanded,
ann a) -> @expr {
ret @respan(sp, ast.expr_ext(p, args, body, expanded, a));
@@ -1373,12 +1373,12 @@ fn identity_fold_expr_cont[ENV](&ENV env, &span sp, ann a) -> @expr {
}
fn identity_fold_expr_ret[ENV](&ENV env, &span sp,
- &option.t[@expr] rv, ann a) -> @expr {
+ &Option.t[@expr] rv, ann a) -> @expr {
ret @respan(sp, ast.expr_ret(rv, a));
}
fn identity_fold_expr_put[ENV](&ENV env, &span sp,
- &option.t[@expr] rv, ann a) -> @expr {
+ &Option.t[@expr] rv, ann a) -> @expr {
ret @respan(sp, ast.expr_put(rv, a));
}
@@ -1437,7 +1437,7 @@ fn identity_fold_pat_bind[ENV](&ENV e, &span sp, ident i, def_id did, ann a)
}
fn identity_fold_pat_tag[ENV](&ENV e, &span sp, path p, vec[@pat] args,
- option.t[ast.variant_def] d, ann a) -> @pat {
+ Option.t[ast.variant_def] d, ann a) -> @pat {
ret @respan(sp, ast.pat_tag(p, args, d, a));
}
@@ -1468,7 +1468,7 @@ fn identity_fold_item_fn[ENV](&ENV e, &span sp, ident i,
}
fn identity_fold_native_item_fn[ENV](&ENV e, &span sp, ident i,
- option.t[str] link_name,
+ Option.t[str] link_name,
&ast.fn_decl decl,
vec[ast.ty_param] ty_params,
def_id id, ann a) -> @native_item {
@@ -1513,14 +1513,14 @@ fn identity_fold_item_obj[ENV](&ENV e, &span sp, ident i,
fn identity_fold_view_item_use[ENV](&ENV e, &span sp, ident i,
vec[@meta_item] meta_items,
- def_id id, option.t[int] cnum)
+ def_id id, Option.t[int] cnum)
-> @view_item {
ret @respan(sp, ast.view_item_use(i, meta_items, id, cnum));
}
fn identity_fold_view_item_import[ENV](&ENV e, &span sp, ident i,
vec[ident] is, def_id id,
- option.t[def] target_def)
+ Option.t[def] target_def)
-> @view_item {
ret @respan(sp, ast.view_item_import(i, is, id, target_def));
}
@@ -1574,7 +1574,7 @@ fn identity_fold_crate[ENV](&ENV e, &span sp,
fn identity_fold_obj[ENV](&ENV e,
vec[ast.obj_field] fields,
vec[@ast.method] methods,
- option.t[@ast.method] dtor) -> ast._obj {
+ Option.t[@ast.method] dtor) -> ast._obj {
ret rec(fields=fields, methods=methods, dtor=dtor);
}
diff --git a/src/comp/middle/metadata.rs b/src/comp/middle/metadata.rs
index ce37822d..f8e7a96e 100644
--- a/src/comp/middle/metadata.rs
+++ b/src/comp/middle/metadata.rs
@@ -1,12 +1,12 @@
-import std._str;
-import std._uint;
-import std._vec;
-import std.map.hashmap;
-import std.ebml;
-import std.io;
-import std.option;
-import std.option.some;
-import std.option.none;
+import std.Str;
+import std.UInt;
+import std.Vec;
+import std.Map.hashmap;
+import std.EBML;
+import std.IO;
+import std.Option;
+import std.Option.some;
+import std.Option.none;
import front.ast;
import middle.fold;
@@ -75,12 +75,12 @@ mod Encode {
fn ty_str(@ctxt cx, ty.t t) -> str {
assert (!cx_uses_abbrevs(cx));
- auto sw = io.string_writer();
+ auto sw = IO.string_writer();
enc_ty(sw.get_writer(), cx, t);
ret sw.get_str();
}
- fn enc_ty(io.writer w, @ctxt cx, ty.t t) {
+ fn enc_ty(IO.writer w, @ctxt cx, ty.t t) {
alt (cx.abbrevs) {
case (ac_no_abbrevs) { enc_sty(w, cx, ty.struct(cx.tcx, t)); }
case (ac_use_abbrevs(?abbrevs)) {
@@ -109,8 +109,8 @@ mod Encode {
if (abbrev_len < len) {
// I.e. it's actually an abbreviation.
auto s = ("#"
- + _uint.to_str(pos, 16u) + ":"
- + _uint.to_str(len, 16u) + "#");
+ + UInt.to_str(pos, 16u) + ":"
+ + UInt.to_str(len, 16u) + "#");
auto a = rec(pos=pos, len=len, s=s);
abbrevs.insert(t, a);
}
@@ -121,7 +121,7 @@ mod Encode {
}
}
- fn enc_mt(io.writer w, @ctxt cx, &ty.mt mt) {
+ fn enc_mt(IO.writer w, @ctxt cx, &ty.mt mt) {
alt (mt.mut) {
case (ast.imm) { }
case (ast.mut) { w.write_char('m'); }
@@ -130,7 +130,7 @@ mod Encode {
enc_ty(w, cx, mt.ty);
}
- fn enc_sty(io.writer w, @ctxt cx, ty.sty st) {
+ fn enc_sty(IO.writer w, @ctxt cx, ty.sty st) {
alt (st) {
case (ty.ty_nil) { w.write_char('n'); }
case (ty.ty_bool) { w.write_char('b'); }
@@ -231,14 +231,14 @@ mod Encode {
}
}
- fn enc_proto(io.writer w, ast.proto proto) {
+ fn enc_proto(IO.writer w, ast.proto proto) {
alt (proto) {
case (ast.proto_iter) { w.write_char('W'); }
case (ast.proto_fn) { w.write_char('F'); }
}
}
- fn enc_ty_fn(io.writer w, @ctxt cx, vec[ty.arg] args, ty.t out) {
+ fn enc_ty_fn(IO.writer w, @ctxt cx, vec[ty.arg] args, ty.t out) {
w.write_char('[');
for (ty.arg arg in args) {
if (arg.mode == ast.alias) { w.write_char('&'); }
@@ -253,46 +253,46 @@ mod Encode {
// Returns a Plain Old LLVM String.
fn C_postr(str s) -> ValueRef {
- ret llvm.LLVMConstString(_str.buf(s), _str.byte_len(s), False);
+ ret llvm.LLVMConstString(Str.buf(s), Str.byte_len(s), False);
}
// Path table encoding
-fn encode_name(&ebml.writer ebml_w, str name) {
- ebml.start_tag(ebml_w, tag_paths_data_name);
- ebml_w.writer.write(_str.bytes(name));
- ebml.end_tag(ebml_w);
+fn encode_name(&EBML.writer ebml_w, str name) {
+ EBML.start_tag(ebml_w, tag_paths_data_name);
+ ebml_w.writer.write(Str.bytes(name));
+ EBML.end_tag(ebml_w);
}
-fn encode_def_id(&ebml.writer ebml_w, &ast.def_id id) {
- ebml.start_tag(ebml_w, tag_def_id);
- ebml_w.writer.write(_str.bytes(def_to_str(id)));
- ebml.end_tag(ebml_w);
+fn encode_def_id(&EBML.writer ebml_w, &ast.def_id id) {
+ EBML.start_tag(ebml_w, tag_def_id);
+ ebml_w.writer.write(Str.bytes(def_to_str(id)));
+ EBML.end_tag(ebml_w);
}
-fn encode_tag_variant_paths(&ebml.writer ebml_w,
+fn encode_tag_variant_paths(&EBML.writer ebml_w,
vec[ast.variant] variants,
vec[str] path,
&mutable vec[tup(str, uint)] index) {
for (ast.variant variant in variants) {
add_to_index(ebml_w, path, index, variant.node.name);
- ebml.start_tag(ebml_w, tag_paths_data_item);
+ EBML.start_tag(ebml_w, tag_paths_data_item);
encode_name(ebml_w, variant.node.name);
encode_def_id(ebml_w, variant.node.id);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
}
-fn add_to_index(&ebml.writer ebml_w,
+fn add_to_index(&EBML.writer ebml_w,
vec[str] path,
&mutable vec[tup(str, uint)] index,
str name) {
auto full_path = path + vec(name);
- index += vec(tup(_str.connect(full_path, "."), ebml_w.writer.tell()));
+ index += vec(tup(Str.connect(full_path, "."), ebml_w.writer.tell()));
}
-fn encode_native_module_item_paths(&ebml.writer ebml_w,
+fn encode_native_module_item_paths(&EBML.writer ebml_w,
&ast.native_mod nmod,
vec[str] path,
&mutable vec[tup(str, uint)] index) {
@@ -300,23 +300,23 @@ fn encode_native_module_item_paths(&ebml.writer ebml_w,
alt (nitem.node) {
case (ast.native_item_ty(?id, ?did)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_item);
+ EBML.start_tag(ebml_w, tag_paths_data_item);
encode_name(ebml_w, id);
encode_def_id(ebml_w, did);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.native_item_fn(?id, _, _, _, ?did, _)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_item);
+ EBML.start_tag(ebml_w, tag_paths_data_item);
encode_name(ebml_w, id);
encode_def_id(ebml_w, did);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
}
}
}
-fn encode_module_item_paths(&ebml.writer ebml_w,
+fn encode_module_item_paths(&EBML.writer ebml_w,
&ast._mod module,
vec[str] path,
&mutable vec[tup(str, uint)] index) {
@@ -325,197 +325,197 @@ fn encode_module_item_paths(&ebml.writer ebml_w,
alt (it.node) {
case (ast.item_const(?id, _, ?tps, ?did, ?ann)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_item);
+ EBML.start_tag(ebml_w, tag_paths_data_item);
encode_name(ebml_w, id);
encode_def_id(ebml_w, did);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_fn(?id, _, ?tps, ?did, ?ann)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_item);
+ EBML.start_tag(ebml_w, tag_paths_data_item);
encode_name(ebml_w, id);
encode_def_id(ebml_w, did);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_mod(?id, ?_mod, ?did)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_mod);
+ EBML.start_tag(ebml_w, tag_paths_data_mod);
encode_name(ebml_w, id);
encode_def_id(ebml_w, did);
encode_module_item_paths(ebml_w, _mod, path + vec(id), index);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_native_mod(?id, ?nmod, ?did)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_mod);
+ EBML.start_tag(ebml_w, tag_paths_data_mod);
encode_name(ebml_w, id);
encode_def_id(ebml_w, did);
encode_native_module_item_paths(ebml_w, nmod, path + vec(id),
index);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_ty(?id, _, ?tps, ?did, ?ann)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_item);
+ EBML.start_tag(ebml_w, tag_paths_data_item);
encode_name(ebml_w, id);
encode_def_id(ebml_w, did);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_tag(?id, ?variants, ?tps, ?did, _)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_item);
+ EBML.start_tag(ebml_w, tag_paths_data_item);
encode_name(ebml_w, id);
encode_def_id(ebml_w, did);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
encode_tag_variant_paths(ebml_w, variants, path, index);
}
case (ast.item_obj(?id, _, ?tps, ?odid, ?ann)) {
add_to_index(ebml_w, path, index, id);
- ebml.start_tag(ebml_w, tag_paths_data_item);
+ EBML.start_tag(ebml_w, tag_paths_data_item);
encode_name(ebml_w, id);
encode_def_id(ebml_w, odid.ctor);
encode_obj_type_id(ebml_w, odid.ty);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
}
}
}
-fn encode_item_paths(&ebml.writer ebml_w, @ast.crate crate)
+fn encode_item_paths(&EBML.writer ebml_w, @ast.crate crate)
-> vec[tup(str, uint)] {
let vec[tup(str, uint)] index = vec();
let vec[str] path = vec();
- ebml.start_tag(ebml_w, tag_paths);
+ EBML.start_tag(ebml_w, tag_paths);
encode_module_item_paths(ebml_w, crate.node.module, path, index);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
ret index;
}
// Item info table encoding
-fn encode_kind(&ebml.writer ebml_w, u8 c) {
- ebml.start_tag(ebml_w, tag_items_data_item_kind);
+fn encode_kind(&EBML.writer ebml_w, u8 c) {
+ EBML.start_tag(ebml_w, tag_items_data_item_kind);
ebml_w.writer.write(vec(c));
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
fn def_to_str(ast.def_id did) -> str {
ret #fmt("%d:%d", did._0, did._1);
}
-fn encode_type_param_count(&ebml.writer ebml_w, vec[ast.ty_param] tps) {
- ebml.start_tag(ebml_w, tag_items_data_item_ty_param_count);
- ebml.write_vint(ebml_w.writer, _vec.len[ast.ty_param](tps));
- ebml.end_tag(ebml_w);
+fn encode_type_param_count(&EBML.writer ebml_w, vec[ast.ty_param] tps) {
+ EBML.start_tag(ebml_w, tag_items_data_item_ty_param_count);
+ EBML.write_vint(ebml_w.writer, Vec.len[ast.ty_param](tps));
+ EBML.end_tag(ebml_w);
}
-fn encode_variant_id(&ebml.writer ebml_w, ast.def_id vid) {
- ebml.start_tag(ebml_w, tag_items_data_item_variant);
- ebml_w.writer.write(_str.bytes(def_to_str(vid)));
- ebml.end_tag(ebml_w);
+fn encode_variant_id(&EBML.writer ebml_w, ast.def_id vid) {
+ EBML.start_tag(ebml_w, tag_items_data_item_variant);
+ ebml_w.writer.write(Str.bytes(def_to_str(vid)));
+ EBML.end_tag(ebml_w);
}
-fn encode_type(@trans.crate_ctxt cx, &ebml.writer ebml_w, ty.t typ) {
- ebml.start_tag(ebml_w, tag_items_data_item_type);
+fn encode_type(@trans.crate_ctxt cx, &EBML.writer ebml_w, ty.t typ) {
+ EBML.start_tag(ebml_w, tag_items_data_item_type);
auto f = def_to_str;
auto ty_str_ctxt = @rec(ds=f, tcx=cx.tcx,
abbrevs=ac_use_abbrevs(cx.type_abbrevs));
- Encode.enc_ty(io.new_writer_(ebml_w.writer), ty_str_ctxt, typ);
- ebml.end_tag(ebml_w);
+ Encode.enc_ty(IO.new_writer_(ebml_w.writer), ty_str_ctxt, typ);
+ EBML.end_tag(ebml_w);
}
-fn encode_symbol(@trans.crate_ctxt cx, &ebml.writer ebml_w, ast.def_id did) {
- ebml.start_tag(ebml_w, tag_items_data_item_symbol);
- ebml_w.writer.write(_str.bytes(cx.item_symbols.get(did)));
- ebml.end_tag(ebml_w);
+fn encode_symbol(@trans.crate_ctxt cx, &EBML.writer ebml_w, ast.def_id did) {
+ EBML.start_tag(ebml_w, tag_items_data_item_symbol);
+ ebml_w.writer.write(Str.bytes(cx.item_symbols.get(did)));
+ EBML.end_tag(ebml_w);
}
-fn encode_discriminant(@trans.crate_ctxt cx, &ebml.writer ebml_w,
+fn encode_discriminant(@trans.crate_ctxt cx, &EBML.writer ebml_w,
ast.def_id did) {
- ebml.start_tag(ebml_w, tag_items_data_item_symbol);
- ebml_w.writer.write(_str.bytes(cx.discrim_symbols.get(did)));
- ebml.end_tag(ebml_w);
+ EBML.start_tag(ebml_w, tag_items_data_item_symbol);
+ ebml_w.writer.write(Str.bytes(cx.discrim_symbols.get(did)));
+ EBML.end_tag(ebml_w);
}
-fn encode_tag_id(&ebml.writer ebml_w, &ast.def_id id) {
- ebml.start_tag(ebml_w, tag_items_data_item_tag_id);
- ebml_w.writer.write(_str.bytes(def_to_str(id)));
- ebml.end_tag(ebml_w);
+fn encode_tag_id(&EBML.writer ebml_w, &ast.def_id id) {
+ EBML.start_tag(ebml_w, tag_items_data_item_tag_id);
+ ebml_w.writer.write(Str.bytes(def_to_str(id)));
+ EBML.end_tag(ebml_w);
}
-fn encode_obj_type_id(&ebml.writer ebml_w, &ast.def_id id) {
- ebml.start_tag(ebml_w, tag_items_data_item_obj_type_id);
- ebml_w.writer.write(_str.bytes(def_to_str(id)));
- ebml.end_tag(ebml_w);
+fn encode_obj_type_id(&EBML.writer ebml_w, &ast.def_id id) {
+ EBML.start_tag(ebml_w, tag_items_data_item_obj_type_id);
+ ebml_w.writer.write(Str.bytes(def_to_str(id)));
+ EBML.end_tag(ebml_w);
}
-fn encode_tag_variant_info(@trans.crate_ctxt cx, &ebml.writer ebml_w,
+fn encode_tag_variant_info(@trans.crate_ctxt cx, &EBML.writer ebml_w,
ast.def_id did, vec[ast.variant] variants,
&mutable vec[tup(int, uint)] index,
vec[ast.ty_param] ty_params) {
for (ast.variant variant in variants) {
index += vec(tup(variant.node.id._1, ebml_w.writer.tell()));
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, variant.node.id);
encode_kind(ebml_w, 'v' as u8);
encode_tag_id(ebml_w, did);
encode_type(cx, ebml_w, trans.node_ann_type(cx, variant.node.ann));
- if (_vec.len[ast.variant_arg](variant.node.args) > 0u) {
+ if (Vec.len[ast.variant_arg](variant.node.args) > 0u) {
encode_symbol(cx, ebml_w, variant.node.id);
}
encode_discriminant(cx, ebml_w, variant.node.id);
encode_type_param_count(ebml_w, ty_params);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
}
-fn encode_info_for_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
+fn encode_info_for_item(@trans.crate_ctxt cx, &EBML.writer ebml_w,
@ast.item item, &mutable vec[tup(int, uint)] index) {
alt (item.node) {
case (ast.item_const(_, _, _, ?did, ?ann)) {
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, did);
encode_kind(ebml_w, 'c' as u8);
encode_type(cx, ebml_w, trans.node_ann_type(cx, ann));
encode_symbol(cx, ebml_w, did);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_fn(_, _, ?tps, ?did, ?ann)) {
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, did);
encode_kind(ebml_w, 'f' as u8);
encode_type_param_count(ebml_w, tps);
encode_type(cx, ebml_w, trans.node_ann_type(cx, ann));
encode_symbol(cx, ebml_w, did);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_mod(_, _, ?did)) {
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, did);
encode_kind(ebml_w, 'm' as u8);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_native_mod(_, _, ?did)) {
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, did);
encode_kind(ebml_w, 'n' as u8);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_ty(?id, _, ?tps, ?did, ?ann)) {
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, did);
encode_kind(ebml_w, 'y' as u8);
encode_type_param_count(ebml_w, tps);
encode_type(cx, ebml_w, trans.node_ann_type(cx, ann));
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
case (ast.item_tag(?id, ?variants, ?tps, ?did, ?ann)) {
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, did);
encode_kind(ebml_w, 't' as u8);
encode_type_param_count(ebml_w, tps);
@@ -523,33 +523,33 @@ fn encode_info_for_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
for (ast.variant v in variants) {
encode_variant_id(ebml_w, v.node.id);
}
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
encode_tag_variant_info(cx, ebml_w, did, variants, index, tps);
}
case (ast.item_obj(?id, _, ?tps, ?odid, ?ann)) {
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, odid.ctor);
encode_kind(ebml_w, 'o' as u8);
encode_type_param_count(ebml_w, tps);
auto fn_ty = trans.node_ann_type(cx, ann);
encode_type(cx, ebml_w, fn_ty);
encode_symbol(cx, ebml_w, odid.ctor);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
encode_def_id(ebml_w, odid.ty);
encode_kind(ebml_w, 'y' as u8);
encode_type_param_count(ebml_w, tps);
encode_type(cx, ebml_w, ty.ty_fn_ret(cx.tcx, fn_ty));
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
}
}
-fn encode_info_for_native_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
+fn encode_info_for_native_item(@trans.crate_ctxt cx, &EBML.writer ebml_w,
@ast.native_item nitem) {
- ebml.start_tag(ebml_w, tag_items_data_item);
+ EBML.start_tag(ebml_w, tag_items_data_item);
alt (nitem.node) {
case (ast.native_item_ty(_, ?did)) {
encode_def_id(ebml_w, did);
@@ -564,14 +564,14 @@ fn encode_info_for_native_item(@trans.crate_ctxt cx, &ebml.writer ebml_w,
encode_symbol(cx, ebml_w, did);
}
}
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
-fn encode_info_for_items(@trans.crate_ctxt cx, &ebml.writer ebml_w)
+fn encode_info_for_items(@trans.crate_ctxt cx, &EBML.writer ebml_w)
-> vec[tup(int, uint)] {
let vec[tup(int, uint)] index = vec();
- ebml.start_tag(ebml_w, tag_items_data);
+ EBML.start_tag(ebml_w, tag_items_data);
for each (@tup(ast.def_id, @ast.item) kvp in cx.items.items()) {
index += vec(tup(kvp._0._1, ebml_w.writer.tell()));
encode_info_for_item(cx, ebml_w, kvp._1, index);
@@ -581,7 +581,7 @@ fn encode_info_for_items(@trans.crate_ctxt cx, &ebml.writer ebml_w)
index += vec(tup(kvp._0._1, ebml_w.writer.tell()));
encode_info_for_native_item(cx, ebml_w, kvp._1);
}
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
ret index;
}
@@ -597,7 +597,7 @@ fn hash_def_num(&int def_num) -> uint {
fn hash_path(&str s) -> uint {
auto h = 5381u;
- for (u8 ch in _str.bytes(s)) {
+ for (u8 ch in Str.bytes(s)) {
h = ((h << 5u) + h) ^ (ch as uint);
}
ret h;
@@ -606,7 +606,7 @@ fn hash_path(&str s) -> uint {
fn create_index[T](vec[tup(T, uint)] index, fn(&T) -> uint hash_fn)
-> vec[vec[tup(T, uint)]] {
let vec[vec[tup(T, uint)]] buckets = vec();
- for each (uint i in _uint.range(0u, 256u)) {
+ for each (uint i in UInt.range(0u, 256u)) {
let vec[tup(T, uint)] bucket = vec();
buckets += vec(bucket);
}
@@ -619,69 +619,69 @@ fn create_index[T](vec[tup(T, uint)] index, fn(&T) -> uint hash_fn)
ret buckets;
}
-fn encode_index[T](&ebml.writer ebml_w, vec[vec[tup(T, uint)]] buckets,
- fn(io.writer, &T) write_fn) {
- auto writer = io.new_writer_(ebml_w.writer);
+fn encode_index[T](&EBML.writer ebml_w, vec[vec[tup(T, uint)]] buckets,
+ fn(IO.writer, &T) write_fn) {
+ auto writer = IO.new_writer_(ebml_w.writer);
- ebml.start_tag(ebml_w, tag_index);
+ EBML.start_tag(ebml_w, tag_index);
let vec[uint] bucket_locs = vec();
- ebml.start_tag(ebml_w, tag_index_buckets);
+ EBML.start_tag(ebml_w, tag_index_buckets);
for (vec[tup(T, uint)] bucket in buckets) {
bucket_locs += vec(ebml_w.writer.tell());
- ebml.start_tag(ebml_w, tag_index_buckets_bucket);
+ EBML.start_tag(ebml_w, tag_index_buckets_bucket);
for (tup(T, uint) elt in bucket) {
- ebml.start_tag(ebml_w, tag_index_buckets_bucket_elt);
+ EBML.start_tag(ebml_w, tag_index_buckets_bucket_elt);
writer.write_be_uint(elt._1, 4u);
write_fn(writer, elt._0);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
- ebml.start_tag(ebml_w, tag_index_table);
+ EBML.start_tag(ebml_w, tag_index_table);
for (uint pos in bucket_locs) {
writer.write_be_uint(pos, 4u);
}
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
}
-fn write_str(io.writer writer, &str s) {
+fn write_str(IO.writer writer, &str s) {
writer.write_str(s);
}
-fn write_int(io.writer writer, &int n) {
+fn write_int(IO.writer writer, &int n) {
writer.write_be_uint(n as uint, 4u);
}
fn encode_metadata(@trans.crate_ctxt cx, @ast.crate crate)
-> ValueRef {
- auto string_w = io.string_writer();
+ auto string_w = IO.string_writer();
auto buf_w = string_w.get_writer().get_buf_writer();
- auto ebml_w = ebml.create_writer(buf_w);
+ auto ebml_w = EBML.create_writer(buf_w);
// Encode and index the paths.
- ebml.start_tag(ebml_w, tag_paths);
+ EBML.start_tag(ebml_w, tag_paths);
auto paths_index = encode_item_paths(ebml_w, crate);
auto str_writer = write_str;
auto path_hasher = hash_path;
auto paths_buckets = create_index[str](paths_index, path_hasher);
encode_index[str](ebml_w, paths_buckets, str_writer);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
// Encode and index the items.
- ebml.start_tag(ebml_w, tag_items);
+ EBML.start_tag(ebml_w, tag_items);
auto items_index = encode_info_for_items(cx, ebml_w);
auto int_writer = write_int;
auto item_hasher = hash_def_num;
auto items_buckets = create_index[int](items_index, item_hasher);
encode_index[int](ebml_w, items_buckets, int_writer);
- ebml.end_tag(ebml_w);
+ EBML.end_tag(ebml_w);
// Pad this, since something (LLVM, presumably) is cutting off the
// remaining % 4 bytes.
@@ -698,9 +698,9 @@ fn write_metadata(@trans.crate_ctxt cx, @ast.crate crate) {
auto llconst = trans.C_struct(vec(llmeta));
auto llglobal = llvm.LLVMAddGlobal(cx.llmod, trans.val_ty(llconst),
- _str.buf("rust_metadata"));
+ Str.buf("rust_metadata"));
llvm.LLVMSetInitializer(llglobal, llconst);
- llvm.LLVMSetSection(llglobal, _str.buf(x86.get_meta_sect_name()));
+ llvm.LLVMSetSection(llglobal, Str.buf(x86.get_meta_sect_name()));
}
//
diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs
index 8b92cabd..433b4734 100644
--- a/src/comp/middle/resolve.rs
+++ b/src/comp/middle/resolve.rs
@@ -7,15 +7,15 @@ import driver.session;
import util.common.new_def_hash;
import util.common.span;
import util.typestate_ann.ts_ann;
-import std.map.hashmap;
-import std.list.list;
-import std.list.nil;
-import std.list.cons;
-import std.option;
-import std.option.some;
-import std.option.none;
-import std._str;
-import std._vec;
+import std.Map.hashmap;
+import std.List.list;
+import std.List.nil;
+import std.List.cons;
+import std.Option;
+import std.Option.some;
+import std.Option.none;
+import std.Str;
+import std.Vec;
tag scope {
scope_crate(@ast.crate);
@@ -43,7 +43,7 @@ tag direction {
down;
}
-type import_map = std.map.hashmap[ast.def_id,def_wrap];
+type import_map = std.Map.hashmap[ast.def_id,def_wrap];
// A simple wrapper over defs that stores a bit more information about modules
// and uses so that we can use the regular lookup_name when resolving imports.
@@ -112,7 +112,7 @@ fn unwrap_def(def_wrap d) -> def {
}
fn lookup_external_def(session.session sess, int cnum, vec[ident] idents)
- -> option.t[def_wrap] {
+ -> Option.t[def_wrap] {
alt (creader.lookup_def(sess, cnum, idents)) {
case (none[ast.def]) {
ret none[def_wrap];
@@ -141,7 +141,7 @@ fn lookup_external_def(session.session sess, int cnum, vec[ident] idents)
fn find_final_def(&env e, import_map index,
&span sp, vec[ident] idents, namespace ns,
- option.t[ast.def_id] import_id) -> def_wrap {
+ Option.t[ast.def_id] import_id) -> def_wrap {
// We are given a series of identifiers (p.q.r) and we know that
// in the environment 'e' the identifier 'p' was resolved to 'd'. We
@@ -153,8 +153,8 @@ fn find_final_def(&env e, import_map index,
fn found_mod(&env e, &import_map index, &span sp,
vec[ident] idents, namespace ns,
@ast.item i) -> def_wrap {
- auto len = _vec.len[ident](idents);
- auto rest_idents = _vec.slice[ident](idents, 1u, len);
+ auto len = Vec.len[ident](idents);
+ auto rest_idents = Vec.slice[ident](idents, 1u, len);
auto empty_e = rec(scopes = nil[scope],
sess = e.sess);
auto tmp_e = update_env_for_item(empty_e, i);
@@ -178,8 +178,8 @@ fn find_final_def(&env e, import_map index,
vec[ident] idents, namespace ns,
ast.def_id mod_id)
-> def_wrap {
- auto len = _vec.len[ident](idents);
- auto rest_idents = _vec.slice[ident](idents, 1u, len);
+ auto len = Vec.len[ident](idents);
+ auto rest_idents = Vec.slice[ident](idents, 1u, len);
auto empty_e = rec(scopes = nil[scope],
sess = e.sess);
auto tmp_e = update_env_for_external_mod(empty_e, mod_id, idents);
@@ -202,12 +202,12 @@ fn find_final_def(&env e, import_map index,
fn found_crate(&env e, &import_map index, &span sp,
vec[ident] idents, int cnum) -> def_wrap {
- auto len = _vec.len[ident](idents);
- auto rest_idents = _vec.slice[ident](idents, 1u, len);
+ auto len = Vec.len[ident](idents);
+ auto rest_idents = Vec.slice[ident](idents, 1u, len);
alt (lookup_external_def(e.sess, cnum, rest_idents)) {
case (none[def_wrap]) {
e.sess.span_err(sp, #fmt("unbound name '%s'",
- _str.connect(idents, ".")));
+ Str.connect(idents, ".")));
fail;
}
case (some[def_wrap](?dw)) { ret dw; }
@@ -227,7 +227,7 @@ fn find_final_def(&env e, import_map index,
case (_) {
}
}
- auto len = _vec.len[ident](idents);
+ auto len = Vec.len[ident](idents);
if (len == 1u) {
ret d;
}
@@ -247,13 +247,13 @@ fn find_final_def(&env e, import_map index,
case (def_wrap_use(?vi)) {
alt (vi.node) {
case (ast.view_item_use(_, _, _, ?cnum_opt)) {
- auto cnum = option.get[int](cnum_opt);
+ auto cnum = Option.get[int](cnum_opt);
ret found_crate(e, index, sp, idents, cnum);
}
}
}
case (def_wrap_other(?d)) {
- let uint l = _vec.len[ident](idents);
+ let uint l = Vec.len[ident](idents);
ret def_wrap_expr_field(l, d);
}
}
@@ -261,7 +261,7 @@ fn find_final_def(&env e, import_map index,
}
if (import_id != none[ast.def_id]) {
- alt (index.find(option.get[ast.def_id](import_id))) {
+ alt (index.find(Option.get[ast.def_id](import_id))) {
case (some[def_wrap](?x)) {
alt (x) {
case (def_wrap_resolving) {
@@ -276,7 +276,7 @@ fn find_final_def(&env e, import_map index,
case (none[def_wrap]) {
}
}
- index.insert(option.get[ast.def_id](import_id), def_wrap_resolving);
+ index.insert(Option.get[ast.def_id](import_id), def_wrap_resolving);
}
auto first = idents.(0);
auto d_ = lookup_name_wrapped(e, first, ns, up);
@@ -288,7 +288,7 @@ fn find_final_def(&env e, import_map index,
case (some[tup(@env, def_wrap)](?d)) {
auto x = found_something(*d._0, index, sp, idents, ns, d._1);
if (import_id != none[ast.def_id]) {
- index.insert(option.get[ast.def_id](import_id), x);
+ index.insert(Option.get[ast.def_id](import_id), x);
}
ret x;
}
@@ -296,7 +296,7 @@ fn find_final_def(&env e, import_map index,
}
fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
- -> option.t[tup(@env, def_wrap)] {
+ -> Option.t[tup(@env, def_wrap)] {
// log "resolving name " + i;
@@ -357,7 +357,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
}
fn check_mod(ast.ident i, ast._mod m, namespace ns,
- direction dir) -> option.t[def_wrap] {
+ direction dir) -> Option.t[def_wrap] {
fn visible(ast.ident i, ast._mod m, direction dir) -> bool {
@@ -411,7 +411,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
}
}
- fn check_native_mod(ast.ident i, ast.native_mod m) -> option.t[def_wrap] {
+ fn check_native_mod(ast.ident i, ast.native_mod m) -> Option.t[def_wrap] {
alt (m.index.find(i)) {
case (some[ast.native_mod_index_entry](?ent)) {
@@ -431,9 +431,9 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
}
fn handle_fn_decl(ast.ident identifier, &ast.fn_decl decl,
- &vec[ast.ty_param] ty_params) -> option.t[def_wrap] {
+ &vec[ast.ty_param] ty_params) -> Option.t[def_wrap] {
for (ast.arg a in decl.inputs) {
- if (_str.eq(a.ident, identifier)) {
+ if (Str.eq(a.ident, identifier)) {
auto t = ast.def_arg(a.id);
ret some(def_wrap_other(t));
}
@@ -441,7 +441,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
auto i = 0u;
for (ast.ty_param tp in ty_params) {
- if (_str.eq(tp, identifier)) {
+ if (Str.eq(tp, identifier)) {
auto t = ast.def_ty_arg(i);
ret some(def_wrap_other(t));
}
@@ -465,7 +465,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
}
fn check_block(ast.ident i, &ast.block_ b, namespace ns)
- -> option.t[def_wrap] {
+ -> Option.t[def_wrap] {
alt (b.index.find(i)) {
case (some[ast.block_index_entry](?ix)) {
alt(ix) {
@@ -486,7 +486,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
}
fn in_scope(&session.session sess, ast.ident identifier, &scope s,
- namespace ns, direction dir) -> option.t[def_wrap] {
+ namespace ns, direction dir) -> Option.t[def_wrap] {
alt (s) {
case (scope_crate(?c)) {
@@ -500,7 +500,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
}
case (ast.item_obj(_, ?ob, ?ty_params, _, _)) {
for (ast.obj_field f in ob.fields) {
- if (_str.eq(f.ident, identifier)) {
+ if (Str.eq(f.ident, identifier)) {
auto t = ast.def_obj_field(f.id);
ret some(def_wrap_other(t));
}
@@ -508,7 +508,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
auto i = 0u;
for (ast.ty_param tp in ty_params) {
- if (_str.eq(tp, identifier)) {
+ if (Str.eq(tp, identifier)) {
auto t = ast.def_ty_arg(i);
ret some(def_wrap_other(t));
}
@@ -518,7 +518,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
case (ast.item_tag(_,?variants,?ty_params,?tag_id,_)) {
auto i = 0u;
for (ast.ty_param tp in ty_params) {
- if (_str.eq(tp, identifier)) {
+ if (Str.eq(tp, identifier)) {
auto t = ast.def_ty_arg(i);
ret some(def_wrap_other(t));
}
@@ -534,7 +534,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
case (ast.item_ty(_, _, ?ty_params, _, _)) {
auto i = 0u;
for (ast.ty_param tp in ty_params) {
- if (_str.eq(tp, identifier)) {
+ if (Str.eq(tp, identifier)) {
auto t = ast.def_ty_arg(i);
ret some(def_wrap_other(t));
}
@@ -560,7 +560,7 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
case (scope_loop(?d)) {
alt (d.node) {
case (ast.decl_local(?local)) {
- if (_str.eq(local.ident, identifier)) {
+ if (Str.eq(local.ident, identifier)) {
auto lc = ast.def_local(local.id);
ret some(def_wrap_other(lc));
}
@@ -605,9 +605,9 @@ fn lookup_name_wrapped(&env e, ast.ident i, namespace ns, direction dir)
}
fn fold_pat_tag(&env e, &span sp, ast.path p, vec[@ast.pat] args,
- option.t[ast.variant_def] old_def,
+ Option.t[ast.variant_def] old_def,
ann a) -> @ast.pat {
- auto len = _vec.len[ast.ident](p.node.idents);
+ auto len = Vec.len[ast.ident](p.node.idents);
auto last_id = p.node.idents.(len - 1u);
auto new_def;
auto index = new_def_hash[def_wrap]();
@@ -646,9 +646,9 @@ fn fold_pat_tag(&env e, &span sp, ast.path p, vec[@ast.pat] args,
// and split that off as the 'primary' expr_path, with secondary expr_field
// expressions tacked on the end.
-fn fold_expr_path(&env e, &span sp, &ast.path p, &option.t[def] d,
+fn fold_expr_path(&env e, &span sp, &ast.path p, &Option.t[def] d,
ann a) -> @ast.expr {
- auto n_idents = _vec.len[ast.ident](p.node.idents);
+ auto n_idents = Vec.len[ast.ident](p.node.idents);
assert (n_idents != 0u);
auto index = new_def_hash[def_wrap]();
@@ -669,7 +669,7 @@ fn fold_expr_path(&env e, &span sp, &ast.path p, &option.t[def] d,
}
}
auto path_elems =
- _vec.slice[ident](p.node.idents, 0u, path_len);
+ Vec.slice[ident](p.node.idents, 0u, path_len);
auto p_ = rec(node=rec(idents = path_elems with p.node) with p);
auto d_ = some(unwrap_def(d));
auto ex = @fold.respan[ast.expr_](sp, ast.expr_path(p_, d_, a));
@@ -685,9 +685,9 @@ fn fold_expr_path(&env e, &span sp, &ast.path p, &option.t[def] d,
fn fold_view_item_import(&env e, &span sp,
import_map index, ident i,
vec[ident] is, ast.def_id id,
- option.t[def] target_id) -> @ast.view_item {
+ Option.t[def] target_id) -> @ast.view_item {
// Produce errors for invalid imports
- auto len = _vec.len[ast.ident](is);
+ auto len = Vec.len[ast.ident](is);
auto last_id = is.(len - 1u);
auto d = find_final_def(e, index, sp, is, ns_value, some(id));
alt (d) {
@@ -698,12 +698,12 @@ fn fold_view_item_import(&env e, &span sp,
case (_) {
}
}
- let option.t[def] target_def = some(unwrap_def(d));
+ let Option.t[def] target_def = some(unwrap_def(d));
ret @fold.respan[ast.view_item_](sp, ast.view_item_import(i, is, id,
target_def));
}
-fn fold_ty_path(&env e, &span sp, ast.path p, &option.t[def] d) -> @ast.ty {
+fn fold_ty_path(&env e, &span sp, ast.path p, &Option.t[def] d) -> @ast.ty {
auto index = new_def_hash[def_wrap]();
auto d = find_final_def(e, index, sp, p.node.idents, ns_type,
none[ast.def_id]);
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 86ddcddf..9f10097d 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -1,14 +1,14 @@
-import std._int;
-import std._str;
-import std._uint;
-import std._vec;
-import std._str.rustrt.sbuf;
-import std._vec.rustrt.vbuf;
-import std.map;
-import std.map.hashmap;
-import std.option;
-import std.option.some;
-import std.option.none;
+import std.Int;
+import std.Str;
+import std.UInt;
+import std.Vec;
+import std.Str.rustrt.sbuf;
+import std.Vec.rustrt.vbuf;
+import std.Map;
+import std.Map.hashmap;
+import std.Option;
+import std.Option.some;
+import std.Option.none;
import front.ast;
import front.creader;
@@ -110,7 +110,7 @@ state type crate_ctxt = rec(session.session sess,
hashmap[ty.t, TypeRef] lltypes,
@glue_fns glues,
namegen names,
- std.sha1.sha1 sha,
+ std.SHA1.sha1 sha,
hashmap[ty.t, str] type_sha1s,
hashmap[ty.t, metadata.ty_abbrev] type_abbrevs,
ty.ctxt tcx);
@@ -129,8 +129,8 @@ state type fn_ctxt = rec(ValueRef llfn,
ValueRef llenv,
ValueRef llretptr,
mutable BasicBlockRef llallocas,
- mutable option.t[self_vt] llself,
- mutable option.t[ValueRef] lliterbody,
+ mutable Option.t[self_vt] llself,
+ mutable Option.t[ValueRef] lliterbody,
hashmap[ast.def_id, ValueRef] llargs,
hashmap[ast.def_id, ValueRef] llobjfields,
hashmap[ast.def_id, ValueRef] lllocals,
@@ -145,7 +145,7 @@ tag cleanup {
tag block_kind {
SCOPE_BLOCK;
- LOOP_SCOPE_BLOCK(option.t[@block_ctxt], @block_ctxt);
+ LOOP_SCOPE_BLOCK(Option.t[@block_ctxt], @block_ctxt);
NON_SCOPE_BLOCK;
}
@@ -156,7 +156,7 @@ state type block_ctxt = rec(BasicBlockRef llbb,
mutable vec[cleanup] cleanups,
@fn_ctxt fcx);
-// FIXME: we should be able to use option.t[@block_parent] here but
+// FIXME: we should be able to use Option.t[@block_parent] here but
// the infinite-tag check in rustboot gets upset.
tag block_parent {
@@ -177,7 +177,7 @@ fn extend_path(@local_ctxt cx, str name) -> @local_ctxt {
}
fn path_name(vec[str] path) -> str {
- ret _str.connect(path, sep());
+ ret Str.connect(path, sep());
}
@@ -192,7 +192,7 @@ fn get_type_sha1(@crate_ctxt ccx, ty.t t) -> str {
// to be independent of one another in the crate.
auto cx = @rec(ds=f, tcx=ccx.tcx, abbrevs=metadata.ac_no_abbrevs);
ccx.sha.input_str(metadata.Encode.ty_str(cx, t));
- hash = _str.substr(ccx.sha.result_str(), 0u, 16u);
+ hash = Str.substr(ccx.sha.result_str(), 0u, 16u);
ccx.type_sha1s.insert(t, hash);
}
}
@@ -306,8 +306,8 @@ fn T_char() -> TypeRef {
fn T_fn(vec[TypeRef] inputs, TypeRef output) -> TypeRef {
ret llvm.LLVMFunctionType(output,
- _vec.buf[TypeRef](inputs),
- _vec.len[TypeRef](inputs),
+ Vec.buf[TypeRef](inputs),
+ Vec.len[TypeRef](inputs),
False);
}
@@ -321,8 +321,8 @@ fn T_ptr(TypeRef t) -> TypeRef {
}
fn T_struct(vec[TypeRef] elts) -> TypeRef {
- ret llvm.LLVMStructType(_vec.buf[TypeRef](elts),
- _vec.len[TypeRef](elts),
+ ret llvm.LLVMStructType(Vec.buf[TypeRef](elts),
+ Vec.len[TypeRef](elts),
False);
}
@@ -352,9 +352,9 @@ fn T_task(type_names tn) -> TypeRef {
fn T_tydesc_field(type_names tn, int field) -> TypeRef {
// Bit of a kludge: pick the fn typeref out of the tydesc..
let vec[TypeRef] tydesc_elts =
- _vec.init_elt[TypeRef](T_nil(), abi.n_tydesc_fields as uint);
+ Vec.init_elt[TypeRef](T_nil(), abi.n_tydesc_fields as uint);
llvm.LLVMGetStructElementTypes(T_tydesc(tn),
- _vec.buf[TypeRef](tydesc_elts));
+ Vec.buf[TypeRef](tydesc_elts));
auto t = llvm.LLVMGetElementType(tydesc_elts.(field));
ret t;
}
@@ -372,7 +372,7 @@ fn T_glue_fn(type_names tn) -> TypeRef {
fn T_dtor(@crate_ctxt ccx, TypeRef llself_ty) -> TypeRef {
ret type_of_fn_full(ccx, ast.proto_fn, some[TypeRef](llself_ty),
- _vec.empty[ty.arg](), ty.mk_nil(ccx.tcx), 0u);
+ Vec.empty[ty.arg](), ty.mk_nil(ccx.tcx), 0u);
}
fn T_cmp_glue_fn(type_names tn) -> TypeRef {
@@ -535,7 +535,7 @@ fn T_opaque_closure_ptr(type_names tn) -> TypeRef {
}
fn T_tag(type_names tn, uint size) -> TypeRef {
- auto s = "tag_" + _uint.to_str(size, 10u);
+ auto s = "tag_" + UInt.to_str(size, 10u);
if (tn.name_has_type(s)) {
ret tn.get_type(s);
}
@@ -559,7 +559,7 @@ fn T_opaque_tag_ptr(type_names tn) -> TypeRef {
}
fn T_captured_tydescs(type_names tn, uint n) -> TypeRef {
- ret T_struct(_vec.init_elt[TypeRef](T_ptr(T_tydesc(tn)), n));
+ ret T_struct(Vec.init_elt[TypeRef](T_ptr(T_tydesc(tn)), n));
}
fn T_obj_ptr(type_names tn, uint n_captured_tydescs) -> TypeRef {
@@ -623,7 +623,7 @@ fn type_of_explicit_args(@crate_ctxt cx, vec[ty.arg] inputs) -> vec[TypeRef] {
fn type_of_fn_full(@crate_ctxt cx,
ast.proto proto,
- option.t[TypeRef] obj_self,
+ Option.t[TypeRef] obj_self,
vec[ty.arg] inputs,
ty.t output,
uint ty_param_count) -> TypeRef {
@@ -811,7 +811,7 @@ fn type_of_inner(@crate_ctxt cx, ty.t t) -> TypeRef {
}
assert (llty as int != 0);
- llvm.LLVMAddTypeName(cx.llmod, _str.buf(ty.ty_to_short_str(cx.tcx, t)),
+ llvm.LLVMAddTypeName(cx.llmod, Str.buf(ty.ty_to_short_str(cx.tcx, t)),
llty);
cx.lltypes.insert(t, llty);
ret llty;
@@ -872,7 +872,7 @@ fn sanitize(str s) -> str {
c != (' ' as u8) && c != ('\t' as u8) &&
c != (';' as u8)) {
auto v = vec(c);
- result += _str.from_bytes(v);
+ result += Str.from_bytes(v);
}
}
}
@@ -894,15 +894,15 @@ fn C_integral(int i, TypeRef t) -> ValueRef {
//
// ret llvm.LLVMConstInt(T_int(), t as LLVM.ULongLong, False);
//
- ret llvm.LLVMConstIntOfString(t, _str.buf(istr(i)), 10);
+ ret llvm.LLVMConstIntOfString(t, Str.buf(istr(i)), 10);
}
fn C_float(str s) -> ValueRef {
- ret llvm.LLVMConstRealOfString(T_float(), _str.buf(s));
+ ret llvm.LLVMConstRealOfString(T_float(), Str.buf(s));
}
fn C_floating(str s, TypeRef t) -> ValueRef {
- ret llvm.LLVMConstRealOfString(t, _str.buf(s));
+ ret llvm.LLVMConstRealOfString(t, Str.buf(s));
}
fn C_nil() -> ValueRef {
@@ -929,9 +929,9 @@ fn C_i8(uint i) -> ValueRef {
// This is a 'c-like' raw string, which differs from
// our boxed-and-length-annotated strings.
fn C_cstr(@crate_ctxt cx, str s) -> ValueRef {
- auto sc = llvm.LLVMConstString(_str.buf(s), _str.byte_len(s), False);
+ auto sc = llvm.LLVMConstString(Str.buf(s), Str.byte_len(s), False);
auto g = llvm.LLVMAddGlobal(cx.llmod, val_ty(sc),
- _str.buf(cx.names.next("str")));
+ Str.buf(cx.names.next("str")));
llvm.LLVMSetInitializer(g, sc);
llvm.LLVMSetGlobalConstant(g, True);
llvm.LLVMSetLinkage(g, lib.llvm.LLVMInternalLinkage
@@ -941,15 +941,15 @@ fn C_cstr(@crate_ctxt cx, str s) -> ValueRef {
// A rust boxed-and-length-annotated string.
fn C_str(@crate_ctxt cx, str s) -> ValueRef {
- auto len = _str.byte_len(s);
+ auto len = Str.byte_len(s);
auto box = C_struct(vec(C_int(abi.const_refcount as int),
C_int(len + 1u as int), // 'alloc'
C_int(len + 1u as int), // 'fill'
C_int(0), // 'pad'
- llvm.LLVMConstString(_str.buf(s),
+ llvm.LLVMConstString(Str.buf(s),
len, False)));
auto g = llvm.LLVMAddGlobal(cx.llmod, val_ty(box),
- _str.buf(cx.names.next("str")));
+ Str.buf(cx.names.next("str")));
llvm.LLVMSetInitializer(g, box);
llvm.LLVMSetGlobalConstant(g, True);
llvm.LLVMSetLinkage(g, lib.llvm.LLVMInternalLinkage
@@ -964,24 +964,24 @@ fn C_zero_byte_arr(uint size) -> ValueRef {
elts += vec(C_integral(0, T_i8()));
i += 1u;
}
- ret llvm.LLVMConstArray(T_i8(), _vec.buf[ValueRef](elts),
- _vec.len[ValueRef](elts));
+ ret llvm.LLVMConstArray(T_i8(), Vec.buf[ValueRef](elts),
+ Vec.len[ValueRef](elts));
}
fn C_struct(vec[ValueRef] elts) -> ValueRef {
- ret llvm.LLVMConstStruct(_vec.buf[ValueRef](elts),
- _vec.len[ValueRef](elts),
+ ret llvm.LLVMConstStruct(Vec.buf[ValueRef](elts),
+ Vec.len[ValueRef](elts),
False);
}
fn C_array(TypeRef ty, vec[ValueRef] elts) -> ValueRef {
- ret llvm.LLVMConstArray(ty, _vec.buf[ValueRef](elts),
- _vec.len[ValueRef](elts));
+ ret llvm.LLVMConstArray(ty, Vec.buf[ValueRef](elts),
+ Vec.len[ValueRef](elts));
}
fn decl_fn(ModuleRef llmod, str name, uint cc, TypeRef llty) -> ValueRef {
let ValueRef llfn =
- llvm.LLVMAddFunction(llmod, _str.buf(name), llty);
+ llvm.LLVMAddFunction(llmod, Str.buf(name), llty);
llvm.LLVMSetFunctionCallConv(llfn, cc);
ret llfn;
}
@@ -1026,7 +1026,7 @@ fn decl_native_glue(ModuleRef llmod, type_names tn,
args += vec(T_int()); // taskptr, will not be passed
}
- args += _vec.init_elt[TypeRef](T_int(), n as uint);
+ args += Vec.init_elt[TypeRef](T_int(), n as uint);
ret decl_fastcall_fn(llmod, s, T_fn(args, T_int()));
}
@@ -1047,14 +1047,14 @@ fn get_extern_const(&hashmap[str, ValueRef] externs,
if (externs.contains_key(name)) {
ret externs.get(name);
}
- auto c = llvm.LLVMAddGlobal(llmod, ty, _str.buf(name));
+ auto c = llvm.LLVMAddGlobal(llmod, ty, Str.buf(name));
externs.insert(name, c);
ret c;
}
fn get_simple_extern_fn(&hashmap[str, ValueRef] externs,
ModuleRef llmod, str name, int n_args) -> ValueRef {
- auto inputs = _vec.init_elt[TypeRef](T_int(), n_args as uint);
+ auto inputs = Vec.init_elt[TypeRef](T_int(), n_args as uint);
auto output = T_int();
auto t = T_fn(inputs, output);
ret get_extern_fn(externs, llmod, name, lib.llvm.LLVMCCallConv, t);
@@ -1075,7 +1075,7 @@ fn trans_native_call(builder b, @glue_fns glues, ValueRef lltaskptr,
&hashmap[str, ValueRef] externs,
type_names tn, ModuleRef llmod, str name,
bool pass_task, vec[ValueRef] args) -> ValueRef {
- let int n = (_vec.len[ValueRef](args) as int);
+ let int n = (Vec.len[ValueRef](args) as int);
let ValueRef llnative = get_simple_extern_fn(externs, llmod, name, n);
llnative = llvm.LLVMConstPointerCast(llnative, T_int());
@@ -1395,7 +1395,7 @@ fn GEP_tup_like(@block_ctxt cx, ty.t t,
fn split_type(@crate_ctxt ccx, ty.t t, vec[int] ixs, uint n)
-> rec(vec[ty.t] prefix, ty.t target) {
- let uint len = _vec.len[int](ixs);
+ let uint len = Vec.len[int](ixs);
// We don't support 0-index or 1-index GEPs. The former is nonsense
// and the latter would only be meaningful if we supported non-0
@@ -1417,7 +1417,7 @@ fn GEP_tup_like(@block_ctxt cx, ty.t t,
let vec[ty.t] prefix = vec();
let int i = 0;
while (i < ix) {
- _vec.push[ty.t](prefix,
+ Vec.push[ty.t](prefix,
ty.get_element_type(ccx.tcx, t, i as uint));
i += 1 ;
}
@@ -1617,8 +1617,8 @@ fn mk_derived_tydesc(@block_ctxt cx, ty.t t, bool escapes) -> result {
let uint n_params = ty.count_ty_params(cx.fcx.lcx.ccx.tcx, t);
auto tys = linearize_ty_params(cx, t);
- assert (n_params == _vec.len[uint](tys._0));
- assert (n_params == _vec.len[ValueRef](tys._1));
+ assert (n_params == Vec.len[uint](tys._0));
+ assert (n_params == Vec.len[ValueRef](tys._1));
auto root = get_static_tydesc(cx, t, tys._0).tydesc;
@@ -1746,7 +1746,7 @@ fn declare_tydesc(@local_ctxt cx, ty.t t) -> @tydesc_info {
auto name = mangle_name_by_type_only(ccx, t, "tydesc");
auto gvar = llvm.LLVMAddGlobal(ccx.llmod, T_tydesc(ccx.tn),
- _str.buf(name));
+ Str.buf(name));
auto tydesc = C_struct(vec(C_null(T_ptr(T_ptr(T_tydesc(ccx.tn)))),
llsize,
llalign,
@@ -1827,20 +1827,20 @@ fn make_generic_glue(@local_ctxt cx,
llty = T_ptr(type_of(cx.ccx, t));
}
- auto ty_param_count = _vec.len[uint](ty_params);
+ auto ty_param_count = Vec.len[uint](ty_params);
auto lltyparams = llvm.LLVMGetParam(llfn, 3u);
- auto lltydescs = _vec.empty_mut[ValueRef]();
+ auto lltydescs = Vec.empty_mut[ValueRef]();
auto p = 0u;
while (p < ty_param_count) {
auto llparam = bcx.build.GEP(lltyparams, vec(C_int(p as int)));
llparam = bcx.build.Load(llparam);
- _vec.grow_set[ValueRef](lltydescs, ty_params.(p), 0 as ValueRef,
+ Vec.grow_set[ValueRef](lltydescs, ty_params.(p), 0 as ValueRef,
llparam);
p += 1u;
}
- bcx.fcx.lltydescs = _vec.freeze[ValueRef](lltydescs);
+ bcx.fcx.lltydescs = Vec.freeze[ValueRef](lltydescs);
auto llrawptr0 = llvm.LLVMGetParam(llfn, 4u);
auto llval0 = bcx.build.BitCast(llrawptr0, llty);
@@ -2157,7 +2157,7 @@ fn make_cmp_glue(@block_ctxt cx,
*/
auto flag = alloca(scx, T_i1());
- llvm.LLVMSetValueName(flag, _str.buf("flag"));
+ llvm.LLVMSetValueName(flag, Str.buf("flag"));
auto r;
if (ty.type_is_sequence(cx.fcx.lcx.ccx.tcx, t)) {
@@ -2378,7 +2378,7 @@ fn tag_variants(@crate_ctxt cx, ast.def_id id) -> vec[variant_info] {
for (ast.variant variant in variants) {
auto ctor_ty = node_ann_type(cx, variant.node.ann);
let vec[ty.t] arg_tys = vec();
- if (_vec.len[ast.variant_arg](variant.node.args) > 0u) {
+ if (Vec.len[ast.variant_arg](variant.node.args) > 0u) {
for (ty.arg a in ty.ty_fn_args(cx.tcx, ctor_ty)) {
arg_tys += vec(a.ty);
}
@@ -2399,7 +2399,7 @@ fn tag_variant_with_id(@crate_ctxt cx,
auto variants = tag_variants(cx, tag_id);
auto i = 0u;
- while (i < _vec.len[variant_info](variants)) {
+ while (i < Vec.len[variant_info](variants)) {
auto variant = variants.(i);
if (common.def_eq(variant.id, variant_id)) {
ret variant;
@@ -2495,7 +2495,7 @@ fn iter_structural_ty_full(@block_ctxt cx,
}
case (ty.ty_tag(?tid, ?tps)) {
auto variants = tag_variants(cx.fcx.lcx.ccx, tid);
- auto n_variants = _vec.len[variant_info](variants);
+ auto n_variants = Vec.len[variant_info](variants);
// Cast the tags to types we can GEP into.
auto lltagty = T_opaque_tag_ptr(cx.fcx.lcx.ccx.tn);
@@ -2532,10 +2532,10 @@ fn iter_structural_ty_full(@block_ctxt cx,
for (variant_info variant in variants) {
auto variant_cx = new_sub_block_ctxt(bcx,
"tag-iter-variant-" +
- _uint.to_str(i, 10u));
+ UInt.to_str(i, 10u));
llvm.LLVMAddCase(llswitch, C_int(i as int), variant_cx.llbb);
- if (_vec.len[ty.t](variant.args) > 0u) {
+ if (Vec.len[ty.t](variant.args) > 0u) {
// N-ary variant.
auto fn_ty = variant.ctor_ty;
alt (ty.struct(bcx.fcx.lcx.ccx.tcx, fn_ty)) {
@@ -3386,12 +3386,12 @@ fn join_results(@block_ctxt parent_cx,
}
}
- alt (_vec.len[result](live)) {
+ alt (Vec.len[result](live)) {
case (0u) {
// No incoming edges are live, so we're in dead-code-land.
// Arbitrarily pick the first dead edge, since the caller
// is just going to propagate it outward.
- assert (_vec.len[result](ins) >= 1u);
+ assert (Vec.len[result](ins) >= 1u);
ret ins.(0);
}
@@ -3408,7 +3408,7 @@ fn join_results(@block_ctxt parent_cx,
}
fn trans_if(@block_ctxt cx, @ast.expr cond,
- &ast.block thn, &option.t[@ast.expr] els) -> result {
+ &ast.block thn, &Option.t[@ast.expr] els) -> result {
auto cond_res = trans_expr(cx, cond);
@@ -3472,7 +3472,7 @@ fn trans_for(@block_ctxt cx,
auto next_cx = new_sub_block_ctxt(cx, "next");
auto scope_cx =
- new_loop_scope_block_ctxt(cx, option.some[@block_ctxt](next_cx),
+ new_loop_scope_block_ctxt(cx, Option.some[@block_ctxt](next_cx),
outer_next_cx, "for loop scope");
cx.build.Br(scope_cx.llbb);
@@ -3517,15 +3517,15 @@ fn collect_upvars(@block_ctxt cx, &ast.block bloc, &ast.def_id initial_decl)
fn walk_expr(env e, @ast.expr expr) {
alt (expr.node) {
case (ast.expr_path(?path, ?d, _)) {
- alt (option.get[ast.def](d)) {
+ alt (Option.get[ast.def](d)) {
case (ast.def_arg(?did)) {
- _vec.push[ast.def_id](e.refs, did);
+ Vec.push[ast.def_id](e.refs, did);
}
case (ast.def_local(?did)) {
- _vec.push[ast.def_id](e.refs, did);
+ Vec.push[ast.def_id](e.refs, did);
}
case (ast.def_upvar(?did)) {
- _vec.push[ast.def_id](e.refs, did);
+ Vec.push[ast.def_id](e.refs, did);
}
case (_) {}
}
@@ -3606,7 +3606,7 @@ fn trans_for_each(@block_ctxt cx,
}
auto upvars = collect_upvars(cx, body, decl_id);
- auto upvar_count = _vec.len[ast.def_id](upvars);
+ auto upvar_count = Vec.len[ast.def_id](upvars);
auto llbindingsptr;
if (upvar_count > 0u) {
@@ -3645,7 +3645,7 @@ fn trans_for_each(@block_ctxt cx,
}
// Create an environment and populate it with the bindings.
- auto tydesc_count = _vec.len[ValueRef](cx.fcx.lltydescs);
+ auto tydesc_count = Vec.len[ValueRef](cx.fcx.lltydescs);
auto llenvptrty = T_closure_ptr(lcx.ccx.tn, T_ptr(T_nil()),
val_ty(llbindingsptr), tydesc_count);
auto llenvptr = alloca(cx, llvm.LLVMGetElementType(llenvptrty));
@@ -3776,7 +3776,7 @@ fn trans_while(@block_ctxt cx, @ast.expr cond,
auto cond_cx = new_scope_block_ctxt(cx, "while cond");
auto next_cx = new_sub_block_ctxt(cx, "next");
- auto body_cx = new_loop_scope_block_ctxt(cx, option.none[@block_ctxt],
+ auto body_cx = new_loop_scope_block_ctxt(cx, Option.none[@block_ctxt],
next_cx, "while loop body");
auto body_res = trans_block(body_cx, body);
@@ -3795,7 +3795,7 @@ fn trans_do_while(@block_ctxt cx, &ast.block body,
@ast.expr cond) -> result {
auto next_cx = new_sub_block_ctxt(cx, "next");
- auto body_cx = new_loop_scope_block_ctxt(cx, option.none[@block_ctxt],
+ auto body_cx = new_loop_scope_block_ctxt(cx, Option.none[@block_ctxt],
next_cx, "do-while loop body");
auto body_res = trans_block(body_cx, body);
@@ -3834,7 +3834,7 @@ fn trans_pat_match(@block_ctxt cx, @ast.pat pat, ValueRef llval,
vec(C_int(0), C_int(0)));
auto lldiscrim = cx.build.Load(lldiscrimptr);
- auto vdef = option.get[ast.variant_def](vdef_opt);
+ auto vdef = Option.get[ast.variant_def](vdef_opt);
auto variant_id = vdef._1;
auto variant_tag = 0;
@@ -3857,7 +3857,7 @@ fn trans_pat_match(@block_ctxt cx, @ast.pat pat, ValueRef llval,
auto ty_params = node_ann_ty_params(ann);
- if (_vec.len[@ast.pat](subpats) > 0u) {
+ if (Vec.len[@ast.pat](subpats) > 0u) {
auto llblobptr = matched_cx.build.GEP(lltagptr,
vec(C_int(0), C_int(1)));
auto i = 0;
@@ -3899,7 +3899,7 @@ fn trans_pat_binding(@block_ctxt cx, @ast.pat pat,
auto rslt = alloc_ty(cx, t);
auto dst = rslt.val;
auto bcx = rslt.bcx;
- llvm.LLVMSetValueName(dst, _str.buf(id));
+ llvm.LLVMSetValueName(dst, Str.buf(id));
bcx.fcx.lllocals.insert(def_id, dst);
bcx.cleanups +=
vec(clean(bind drop_slot(_, dst, t)));
@@ -3907,10 +3907,10 @@ fn trans_pat_binding(@block_ctxt cx, @ast.pat pat,
}
}
case (ast.pat_tag(_, ?subpats, ?vdef_opt, ?ann)) {
- if (_vec.len[@ast.pat](subpats) == 0u) { ret res(cx, llval); }
+ if (Vec.len[@ast.pat](subpats) == 0u) { ret res(cx, llval); }
// Get the appropriate variant for this tag.
- auto vdef = option.get[ast.variant_def](vdef_opt);
+ auto vdef = Option.get[ast.variant_def](vdef_opt);
auto lltagptr = cx.build.PointerCast(llval,
T_opaque_tag_ptr(cx.fcx.lcx.ccx.tn));
@@ -3982,9 +3982,9 @@ type generic_info = rec(ty.t item_type,
type lval_result = rec(result res,
bool is_mem,
- option.t[generic_info] generic,
- option.t[ValueRef] llobj,
- option.t[ty.t] method_ty);
+ Option.t[generic_info] generic,
+ Option.t[ValueRef] llobj,
+ Option.t[ty.t] method_ty);
fn lval_mem(@block_ctxt cx, ValueRef val) -> lval_result {
ret rec(res=res(cx, val),
@@ -4035,18 +4035,18 @@ fn lval_generic_fn(@block_ctxt cx,
}
case (ast.ann_type(?monoty_, ?tps, _)) {
monoty = monoty_;
- tys = option.get[vec[ty.t]](tps);
+ tys = Option.get[vec[ty.t]](tps);
}
}
- if (_vec.len[ty.t](tys) != 0u) {
+ if (Vec.len[ty.t](tys) != 0u) {
auto bcx = lv.res.bcx;
let vec[ValueRef] tydescs = vec();
for (ty.t t in tys) {
// TODO: Doesn't always escape.
auto td = get_tydesc(bcx, t, true);
bcx = td.bcx;
- _vec.push[ValueRef](tydescs, td.val);
+ Vec.push[ValueRef](tydescs, td.val);
}
auto gen = rec( item_type = tpt._1,
tydescs = tydescs );
@@ -4065,7 +4065,7 @@ fn lookup_discriminant(@local_ctxt lcx, ast.def_id tid, ast.def_id vid)
assert (lcx.ccx.sess.get_targ_crate_num() != vid._0);
auto sym = creader.get_symbol(lcx.ccx.sess, vid);
auto gvar = llvm.LLVMAddGlobal(lcx.ccx.llmod, T_int(),
- _str.buf(sym));
+ Str.buf(sym));
llvm.LLVMSetLinkage(gvar,
lib.llvm.LLVMExternalLinkage as llvm.Linkage);
llvm.LLVMSetGlobalConstant(gvar, True);
@@ -4076,7 +4076,7 @@ fn lookup_discriminant(@local_ctxt lcx, ast.def_id tid, ast.def_id vid)
}
}
-fn trans_path(@block_ctxt cx, &ast.path p, &option.t[ast.def] dopt,
+fn trans_path(@block_ctxt cx, &ast.path p, &Option.t[ast.def] dopt,
&ast.ann ann) -> lval_result {
alt (dopt) {
case (some[ast.def](?def)) {
@@ -4246,10 +4246,10 @@ fn trans_index(@block_ctxt cx, &ast.span sp, @ast.expr base,
auto unit_ty = node_ann_type(cx.fcx.lcx.ccx, ann);
auto unit_sz = size_of(bcx, unit_ty);
bcx = unit_sz.bcx;
- llvm.LLVMSetValueName(unit_sz.val, _str.buf("unit_sz"));
+ llvm.LLVMSetValueName(unit_sz.val, Str.buf("unit_sz"));
auto scaled_ix = bcx.build.Mul(ix_val, unit_sz.val);
- llvm.LLVMSetValueName(scaled_ix, _str.buf("scaled_ix"));
+ llvm.LLVMSetValueName(scaled_ix, Str.buf("scaled_ix"));
auto lim = bcx.build.GEP(v, vec(C_int(0), C_int(abi.vec_elt_fill)));
lim = bcx.build.Load(lim);
@@ -4369,7 +4369,7 @@ fn trans_cast(@block_ctxt cx, @ast.expr e, &ast.ann ann) -> result {
fn trans_bind_thunk(@local_ctxt cx,
ty.t incoming_fty,
ty.t outgoing_fty,
- vec[option.t[@ast.expr]] args,
+ vec[Option.t[@ast.expr]] args,
ty.t closure_ty,
vec[ty.t] bound_tys,
uint ty_param_count) -> ValueRef {
@@ -4433,7 +4433,7 @@ fn trans_bind_thunk(@local_ctxt cx,
let vec[TypeRef] llout_arg_tys =
type_of_explicit_args(cx.ccx, outgoing_args);
- for (option.t[@ast.expr] arg in args) {
+ for (Option.t[@ast.expr] arg in args) {
auto out_arg = outgoing_args.(outgoing_arg_index);
auto llout_arg_ty = llout_arg_tys.(outgoing_arg_index);
@@ -4516,7 +4516,7 @@ fn trans_bind_thunk(@local_ctxt cx,
}
fn trans_bind(@block_ctxt cx, @ast.expr f,
- vec[option.t[@ast.expr]] args,
+ vec[Option.t[@ast.expr]] args,
&ast.ann ann) -> result {
auto f_res = trans_lval(cx, f);
if (f_res.is_mem) {
@@ -4524,12 +4524,12 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
} else {
let vec[@ast.expr] bound = vec();
- for (option.t[@ast.expr] argopt in args) {
+ for (Option.t[@ast.expr] argopt in args) {
alt (argopt) {
case (none[@ast.expr]) {
}
case (some[@ast.expr](?e)) {
- _vec.push[@ast.expr](bound, e);
+ Vec.push[@ast.expr](bound, e);
}
}
}
@@ -4547,9 +4547,9 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
lltydescs = ginfo.tydescs;
}
}
- auto ty_param_count = _vec.len[ValueRef](lltydescs);
+ auto ty_param_count = Vec.len[ValueRef](lltydescs);
- if (_vec.len[@ast.expr](bound) == 0u && ty_param_count == 0u) {
+ if (Vec.len[@ast.expr](bound) == 0u && ty_param_count == 0u) {
// Trivial 'binding': just return the static pair-ptr.
ret f_res.res;
} else {
@@ -4565,8 +4565,8 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
auto arg = trans_expr(bcx, e);
bcx = arg.bcx;
- _vec.push[ValueRef](bound_vals, arg.val);
- _vec.push[ty.t](bound_tys,
+ Vec.push[ValueRef](bound_vals, arg.val);
+ Vec.push[ty.t](bound_tys,
ty.expr_ty(cx.fcx.lcx.ccx.tcx, e));
i += 1u;
@@ -4582,7 +4582,7 @@ fn trans_bind(@block_ctxt cx, @ast.expr f,
let ty.t tydesc_ty = ty.mk_type(cx.fcx.lcx.ccx.tcx);
let vec[ty.t] captured_tys =
- _vec.init_elt[ty.t](tydesc_ty, ty_param_count);
+ Vec.init_elt[ty.t](tydesc_ty, ty_param_count);
let vec[ty.t] closure_tys =
vec(tydesc_ty,
@@ -4778,9 +4778,9 @@ fn trans_arg_expr(@block_ctxt cx,
fn trans_args(@block_ctxt cx,
ValueRef llenv,
- option.t[ValueRef] llobj,
- option.t[generic_info] gen,
- option.t[ValueRef] lliterbody,
+ Option.t[ValueRef] llobj,
+ Option.t[generic_info] gen,
+ Option.t[ValueRef] lliterbody,
&vec[@ast.expr] es,
ty.t fn_ty)
-> tup(@block_ctxt, vec[ValueRef], ValueRef) {
@@ -4869,7 +4869,7 @@ fn trans_args(@block_ctxt cx,
}
fn trans_call(@block_ctxt cx, @ast.expr f,
- option.t[ValueRef] lliterbody,
+ Option.t[ValueRef] lliterbody,
vec[@ast.expr] args,
&ast.ann ann) -> result {
@@ -4997,7 +4997,7 @@ fn trans_vec(@block_ctxt cx, vec[@ast.expr] args,
auto bcx = cx;
auto unit_sz = size_of(bcx, unit_ty);
bcx = unit_sz.bcx;
- auto data_sz = bcx.build.Mul(C_int(_vec.len[@ast.expr](args) as int),
+ auto data_sz = bcx.build.Mul(C_int(Vec.len[@ast.expr](args) as int),
unit_sz.val);
// FIXME: pass tydesc properly.
@@ -5015,8 +5015,8 @@ fn trans_vec(@block_ctxt cx, vec[@ast.expr] args,
auto pseudo_tup_ty =
ty.mk_imm_tup(cx.fcx.lcx.ccx.tcx,
- _vec.init_elt[ty.t](unit_ty,
- _vec.len[@ast.expr](args)));
+ Vec.init_elt[ty.t](unit_ty,
+ Vec.len[@ast.expr](args)));
let int i = 0;
for (@ast.expr e in args) {
@@ -5056,7 +5056,7 @@ fn trans_vec(@block_ctxt cx, vec[@ast.expr] args,
}
fn trans_rec(@block_ctxt cx, vec[ast.field] fields,
- option.t[@ast.expr] base, &ast.ann ann) -> result {
+ Option.t[@ast.expr] base, &ast.ann ann) -> result {
auto bcx = cx;
auto t = node_ann_type(bcx.fcx.lcx.ccx, ann);
@@ -5093,7 +5093,7 @@ fn trans_rec(@block_ctxt cx, vec[ast.field] fields,
auto src_res = res(bcx, C_nil());
for (ast.field f in fields) {
- if (_str.eq(f.ident, tf.ident)) {
+ if (Str.eq(f.ident, tf.ident)) {
expr_provided = true;
src_res = trans_expr(bcx, f.expr);
}
@@ -5326,13 +5326,13 @@ fn load_if_immediate(@block_ctxt cx, ValueRef v, ty.t t) -> ValueRef {
fn trans_log(int lvl, @block_ctxt cx, @ast.expr e) -> result {
auto lcx = cx.fcx.lcx;
- auto modname = _str.connect(lcx.module_path, ".");
+ auto modname = Str.connect(lcx.module_path, ".");
auto global;
if (lcx.ccx.module_data.contains_key(modname)) {
global = lcx.ccx.module_data.get(modname);
} else {
global = llvm.LLVMAddGlobal(lcx.ccx.llmod, T_int(),
- _str.buf("_rust_mod_log_" + modname));
+ Str.buf("_rust_mod_log_" + modname));
llvm.LLVMSetGlobalConstant(global, False);
llvm.LLVMSetInitializer(global, C_null(T_int()));
llvm.LLVMSetLinkage(global, lib.llvm.LLVMInternalLinkage
@@ -5418,7 +5418,7 @@ fn trans_check_expr(@block_ctxt cx, @ast.expr e) -> result {
ret res(next_cx, C_nil());
}
-fn trans_fail(@block_ctxt cx, option.t[common.span] sp_opt, str fail_str)
+fn trans_fail(@block_ctxt cx, Option.t[common.span] sp_opt, str fail_str)
-> result {
auto V_fail_str = p2i(C_cstr(cx.fcx.lcx.ccx, fail_str));
@@ -5442,7 +5442,7 @@ fn trans_fail(@block_ctxt cx, option.t[common.span] sp_opt, str fail_str)
ret res(sub.bcx, C_nil());
}
-fn trans_put(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
+fn trans_put(@block_ctxt cx, &Option.t[@ast.expr] e) -> result {
auto llcallee = C_nil();
auto llenv = C_nil();
@@ -5490,7 +5490,7 @@ fn trans_break_cont(@block_ctxt cx, bool to_end) -> result {
bcx.build.Br(_break.llbb);
} else {
alt (_cont) {
- case (option.some[@block_ctxt](?_cont)) {
+ case (Option.some[@block_ctxt](?_cont)) {
bcx.build.Br(_cont.llbb);
}
case (_) {
@@ -5519,7 +5519,7 @@ fn trans_cont(@block_ctxt cx) -> result {
}
-fn trans_ret(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
+fn trans_ret(@block_ctxt cx, &Option.t[@ast.expr] e) -> result {
auto bcx = cx;
auto val = C_nil();
@@ -5765,7 +5765,7 @@ fn new_block_ctxt(@fn_ctxt cx, block_parent parent,
let vec[cleanup] cleanups = vec();
let BasicBlockRef llbb =
llvm.LLVMAppendBasicBlock(cx.llfn,
- _str.buf(cx.lcx.ccx.names.next(name)));
+ Str.buf(cx.lcx.ccx.names.next(name)));
ret @rec(llbb=llbb,
build=new_builder(llbb),
@@ -5786,7 +5786,7 @@ fn new_scope_block_ctxt(@block_ctxt bcx, str n) -> @block_ctxt {
ret new_block_ctxt(bcx.fcx, parent_some(bcx), SCOPE_BLOCK, n);
}
-fn new_loop_scope_block_ctxt(@block_ctxt bcx, option.t[@block_ctxt] _cont,
+fn new_loop_scope_block_ctxt(@block_ctxt bcx, Option.t[@block_ctxt] _cont,
@block_ctxt _break, str n) -> @block_ctxt {
ret new_block_ctxt(bcx.fcx, parent_some(bcx),
LOOP_SCOPE_BLOCK(_cont, _break), n);
@@ -5803,10 +5803,10 @@ fn trans_block_cleanups(@block_ctxt cx,
auto bcx = cx;
if (cleanup_cx.kind == NON_SCOPE_BLOCK) {
- assert (_vec.len[cleanup](cleanup_cx.cleanups) == 0u);
+ assert (Vec.len[cleanup](cleanup_cx.cleanups) == 0u);
}
- auto i = _vec.len[cleanup](cleanup_cx.cleanups);
+ auto i = Vec.len[cleanup](cleanup_cx.cleanups);
while (i > 0u) {
i -= 1u;
auto c = cleanup_cx.cleanups.(i);
@@ -5983,7 +5983,7 @@ fn new_fn_ctxt(@local_ctxt cx,
let hashmap[ast.def_id, ValueRef] llupvars = new_def_hash[ValueRef]();
let BasicBlockRef llallocas =
- llvm.LLVMAppendBasicBlock(llfndecl, _str.buf("allocas"));
+ llvm.LLVMAppendBasicBlock(llfndecl, Str.buf("allocas"));
ret @rec(llfn=llfndecl,
lltaskptr=lltaskptr,
@@ -5996,7 +5996,7 @@ fn new_fn_ctxt(@local_ctxt cx,
llobjfields=llobjfields,
lllocals=lllocals,
llupvars=llupvars,
- mutable lltydescs=_vec.empty[ValueRef](),
+ mutable lltydescs=Vec.empty[ValueRef](),
lcx=cx);
}
@@ -6009,7 +6009,7 @@ fn new_fn_ctxt(@local_ctxt cx,
fn create_llargs_for_fn_args(&@fn_ctxt cx,
ast.proto proto,
- option.t[tup(TypeRef, ty.t)] ty_self,
+ Option.t[tup(TypeRef, ty.t)] ty_self,
ty.t ret_ty,
&vec[ast.arg] args,
&vec[ast.ty_param] ty_params) {
@@ -6052,7 +6052,7 @@ fn create_llargs_for_fn_args(&@fn_ctxt cx,
// were passed and whatnot. Apparently mem2reg will mop up.
fn copy_any_self_to_alloca(@fn_ctxt fcx,
- option.t[tup(TypeRef, ty.t)] ty_self) {
+ Option.t[tup(TypeRef, ty.t)] ty_self) {
auto bcx = llallocas_block_ctxt(fcx);
@@ -6152,7 +6152,7 @@ fn populate_fn_ctxt_from_llself(@fn_ctxt fcx, self_vt llself) {
// its magic.
auto fields_tup_ty = ty.mk_imm_tup(fcx.lcx.ccx.tcx, field_tys);
- auto n_typarams = _vec.len[ast.ty_param](bcx.fcx.lcx.obj_typarams);
+ auto n_typarams = Vec.len[ast.ty_param](bcx.fcx.lcx.obj_typarams);
let TypeRef llobj_box_ty = T_obj_ptr(bcx.fcx.lcx.ccx.tn, n_typarams);
auto box_cell =
@@ -6209,7 +6209,7 @@ fn populate_fn_ctxt_from_llself(@fn_ctxt fcx, self_vt llself) {
}
fn trans_fn(@local_ctxt cx, &ast._fn f, ast.def_id fid,
- option.t[tup(TypeRef, ty.t)] ty_self,
+ Option.t[tup(TypeRef, ty.t)] ty_self,
&vec[ast.ty_param] ty_params, &ast.ann ann) {
auto llfndecl = cx.ccx.item_ids.get(fid);
@@ -6264,10 +6264,10 @@ fn trans_vtbl(@local_ctxt cx,
let vec[ValueRef] methods = vec(dtor);
fn meth_lteq(&@ast.method a, &@ast.method b) -> bool {
- ret _str.lteq(a.node.ident, b.node.ident);
+ ret Str.lteq(a.node.ident, b.node.ident);
}
- auto meths = std.sort.merge_sort[@ast.method](bind meth_lteq(_,_),
+ auto meths = std.Sort.merge_sort[@ast.method](bind meth_lteq(_,_),
ob.methods);
for (@ast.method m in meths) {
@@ -6278,7 +6278,7 @@ fn trans_vtbl(@local_ctxt cx,
llfnty = type_of_fn_full(cx.ccx, proto,
some[TypeRef](llself_ty),
inputs, output,
- _vec.len[ast.ty_param](ty_params));
+ Vec.len[ast.ty_param](ty_params));
}
}
@@ -6297,7 +6297,7 @@ fn trans_vtbl(@local_ctxt cx,
auto vtbl = C_struct(methods);
auto vtbl_name = mangle_name_by_seq(cx.ccx, cx.path, "vtbl");
auto gvar = llvm.LLVMAddGlobal(cx.ccx.llmod, val_ty(vtbl),
- _str.buf(vtbl_name));
+ Str.buf(vtbl_name));
llvm.LLVMSetInitializer(gvar, vtbl);
llvm.LLVMSetGlobalConstant(gvar, True);
llvm.LLVMSetLinkage(gvar, lib.llvm.LLVMInternalLinkage
@@ -6368,22 +6368,22 @@ fn trans_obj(@local_ctxt cx, &ast._obj ob, ast.def_id oid,
// FIXME we should probably also allocate a box for empty objs that have a
// dtor, since otherwise they are never dropped, and the dtor never runs
- if (_vec.len[ast.ty_param](ty_params) == 0u &&
- _vec.len[ty.arg](arg_tys) == 0u) {
+ if (Vec.len[ast.ty_param](ty_params) == 0u &&
+ Vec.len[ty.arg](arg_tys) == 0u) {
// Store null into pair, if no args or typarams.
bcx.build.Store(C_null(llbox_ty), pair_box);
} else {
// Malloc a box for the body and copy args in.
let vec[ty.t] obj_fields = vec();
for (ty.arg a in arg_tys) {
- _vec.push[ty.t](obj_fields, a.ty);
+ Vec.push[ty.t](obj_fields, a.ty);
}
// Synthesize an obj body type.
auto tydesc_ty = ty.mk_type(ccx.tcx);
let vec[ty.t] tps = vec();
for (ast.ty_param tp in ty_params) {
- _vec.push[ty.t](tps, tydesc_ty);
+ Vec.push[ty.t](tps, tydesc_ty);
}
let ty.t typarams_ty = ty.mk_imm_tup(ccx.tcx, tps);
@@ -6467,7 +6467,7 @@ fn trans_obj(@local_ctxt cx, &ast._obj ob, ast.def_id oid,
fn trans_tag_variant(@local_ctxt cx, ast.def_id tag_id,
&ast.variant variant, int index,
&vec[ast.ty_param] ty_params) {
- if (_vec.len[ast.variant_arg](variant.node.args) == 0u) {
+ if (Vec.len[ast.variant_arg](variant.node.args) == 0u) {
ret; // nullary constructors are just constants
}
@@ -6477,7 +6477,7 @@ fn trans_tag_variant(@local_ctxt cx, ast.def_id tag_id,
for (ast.variant_arg varg in variant.node.args) {
fn_args += vec(rec(mode=ast.alias,
ty=varg.ty,
- ident="arg" + _uint.to_str(i, 10u),
+ ident="arg" + UInt.to_str(i, 10u),
id=varg.id));
}
@@ -6617,7 +6617,7 @@ fn get_pair_fn_ty(TypeRef llpairty) -> TypeRef {
// Bit of a kludge: pick the fn typeref out of the pair.
let vec[TypeRef] pair_tys = vec(T_nil(), T_nil());
llvm.LLVMGetStructElementTypes(llpairty,
- _vec.buf[TypeRef](pair_tys));
+ Vec.buf[TypeRef](pair_tys));
ret llvm.LLVMGetElementType(pair_tys.(0));
}
@@ -6633,7 +6633,7 @@ fn decl_fn_and_pair(@crate_ctxt ccx,
alt (ty.struct(ccx.tcx, node_ann_type(ccx, ann))) {
case (ty.ty_fn(?proto, ?inputs, ?output)) {
llfty = type_of_fn(ccx, proto, inputs, output,
- _vec.len[ast.ty_param](ty_params));
+ Vec.len[ast.ty_param](ty_params));
llpairty = T_fn_pair(ccx.tn, llfty);
}
case (_) {
@@ -6655,7 +6655,7 @@ fn decl_fn_and_pair(@crate_ctxt ccx,
fn register_fn_pair(@crate_ctxt cx, str ps, TypeRef llpairty, ValueRef llfn,
ast.def_id id) {
let ValueRef gvar = llvm.LLVMAddGlobal(cx.llmod, llpairty,
- _str.buf(ps));
+ Str.buf(ps));
auto pair = C_struct(vec(llfn,
C_null(T_opaque_closure_ptr(cx.tn))));
@@ -6681,7 +6681,7 @@ fn native_fn_ty_param_count(@crate_ctxt cx, &ast.def_id id) -> uint {
fail;
}
case (ast.native_item_fn(_, _, _, ?tps, _, _)) {
- count = _vec.len[ast.ty_param](tps);
+ count = Vec.len[ast.ty_param](tps);
}
}
ret count;
@@ -6768,7 +6768,7 @@ fn decl_native_fn_and_pair(@crate_ctxt ccx,
if (pass_task) { call_args += vec(lltaskptr); }
auto arg_n = 3u;
- for each (uint i in _uint.range(0u, num_ty_param)) {
+ for each (uint i in UInt.range(0u, num_ty_param)) {
auto llarg = llvm.LLVMGetParam(fcx.llfn, arg_n);
fcx.lltydescs += vec(llarg);
assert (llarg as int != 0);
@@ -6900,13 +6900,13 @@ fn new_walk_ctxt() -> @walk_ctxt {
fn enter_item(@walk_ctxt cx, @ast.item item) {
alt (item.node) {
case (ast.item_fn(?name, _, _, _, _)) {
- _vec.push[str](cx.path, name);
+ Vec.push[str](cx.path, name);
}
case (ast.item_obj(?name, _, _, _, _)) {
- _vec.push[str](cx.path, name);
+ Vec.push[str](cx.path, name);
}
case (ast.item_mod(?name, _, _)) {
- _vec.push[str](cx.path, name);
+ Vec.push[str](cx.path, name);
}
case (_) { }
}
@@ -6915,13 +6915,13 @@ fn enter_item(@walk_ctxt cx, @ast.item item) {
fn leave_item(@walk_ctxt cx, @ast.item item) {
alt (item.node) {
case (ast.item_fn(_, _, _, _, _)) {
- _vec.pop[str](cx.path);
+ Vec.pop[str](cx.path);
}
case (ast.item_obj(_, _, _, _, _)) {
- _vec.pop[str](cx.path);
+ Vec.pop[str](cx.path);
}
case (ast.item_mod(_, _, _)) {
- _vec.pop[str](cx.path);
+ Vec.pop[str](cx.path);
}
case (_) { }
}
@@ -6948,7 +6948,7 @@ fn collect_item_1(@crate_ctxt ccx, @walk_ctxt wcx, @ast.item i) {
case (ast.item_const(?name, _, _, ?cid, ?ann)) {
auto typ = node_ann_type(ccx, ann);
auto g = llvm.LLVMAddGlobal(ccx.llmod, type_of(ccx, typ),
- _str.buf(ccx.names.next(name)));
+ Str.buf(ccx.names.next(name)));
llvm.LLVMSetLinkage(g, lib.llvm.LLVMInternalLinkage
as llvm.Linkage);
ccx.items.insert(cid, i);
@@ -7009,7 +7009,7 @@ fn collect_tag_ctor(@crate_ctxt ccx, @walk_ctxt wcx, @ast.item i) {
alt (i.node) {
case (ast.item_tag(_, ?variants, ?tps, _, _)) {
for (ast.variant variant in variants) {
- if (_vec.len[ast.variant_arg](variant.node.args) != 0u) {
+ if (Vec.len[ast.variant_arg](variant.node.args) != 0u) {
decl_fn_and_pair(ccx, wcx.path + vec(variant.node.name),
"tag", tps, variant.node.ann,
variant.node.id);
@@ -7037,7 +7037,7 @@ fn trans_constant(@crate_ctxt ccx, @walk_ctxt wcx, @ast.item it) {
alt (it.node) {
case (ast.item_tag(?ident, ?variants, _, ?tag_id, _)) {
auto i = 0u;
- auto n_variants = _vec.len[ast.variant](variants);
+ auto n_variants = Vec.len[ast.variant](variants);
while (i < n_variants) {
auto variant = variants.(i);
@@ -7047,7 +7047,7 @@ fn trans_constant(@crate_ctxt ccx, @walk_ctxt wcx, @ast.item it) {
#fmt("_rust_tag_discrim_%s_%u",
ident, i));
auto discrim_gvar = llvm.LLVMAddGlobal(ccx.llmod, T_int(),
- _str.buf(s));
+ Str.buf(s));
llvm.LLVMSetInitializer(discrim_gvar, discrim_val);
llvm.LLVMSetGlobalConstant(discrim_gvar, True);
@@ -7107,7 +7107,7 @@ fn trans_exit_task_glue(@glue_fns glues,
auto llfn = glues.exit_task_glue;
- auto entrybb = llvm.LLVMAppendBasicBlock(llfn, _str.buf("entry"));
+ auto entrybb = llvm.LLVMAppendBasicBlock(llfn, Str.buf("entry"));
auto build = new_builder(entrybb);
let ValueRef arg1 = llvm.LLVMGetParam(llfn, 0u);
@@ -7129,9 +7129,9 @@ fn trans_exit_task_glue(@glue_fns glues,
}
fn create_typedefs(@crate_ctxt cx) {
- llvm.LLVMAddTypeName(cx.llmod, _str.buf("crate"), T_crate(cx.tn));
- llvm.LLVMAddTypeName(cx.llmod, _str.buf("task"), T_task(cx.tn));
- llvm.LLVMAddTypeName(cx.llmod, _str.buf("tydesc"), T_tydesc(cx.tn));
+ llvm.LLVMAddTypeName(cx.llmod, Str.buf("crate"), T_crate(cx.tn));
+ llvm.LLVMAddTypeName(cx.llmod, Str.buf("task"), T_task(cx.tn));
+ llvm.LLVMAddTypeName(cx.llmod, Str.buf("tydesc"), T_tydesc(cx.tn));
}
fn create_crate_constant(ValueRef crate_ptr, @glue_fns glues) {
@@ -7173,7 +7173,7 @@ fn find_main_fn(@crate_ctxt cx) -> ValueRef {
let ValueRef v = C_nil();
let uint n = 0u;
for each (@tup(ast.def_id, str) i in cx.item_symbols.items()) {
- if (_str.ends_with(i._1, e)) {
+ if (Str.ends_with(i._1, e)) {
n += 1u;
v = cx.item_ids.get(i._0);
}
@@ -7197,7 +7197,7 @@ fn trans_main_fn(@local_ctxt cx, ValueRef llcrate, ValueRef crate_map) {
auto T_rust_start_args = vec(T_int(), T_int(), T_int(), T_int(), T_int());
auto main_name;
- if (_str.eq(std.os.target_os(), "win32")) {
+ if (Str.eq(std.OS.target_os(), "win32")) {
main_name = "WinMain@16";
} else {
main_name = "main";
@@ -7222,7 +7222,7 @@ fn trans_main_fn(@local_ctxt cx, ValueRef llcrate, ValueRef crate_map) {
//
let BasicBlockRef llbb =
- llvm.LLVMAppendBasicBlock(llmain, _str.buf(""));
+ llvm.LLVMAppendBasicBlock(llmain, Str.buf(""));
auto b = new_builder(llbb);
auto start_args = vec(p2i(llrust_main), p2i(llcrate), llargc, llargv,
@@ -7267,7 +7267,7 @@ fn decl_no_op_type_glue(ModuleRef llmod, type_names tn) -> ValueRef {
}
fn make_no_op_type_glue(ValueRef fun) {
- auto bb_name = _str.buf("_rust_no_op_type_glue_bb");
+ auto bb_name = Str.buf("_rust_no_op_type_glue_bb");
auto llbb = llvm.LLVMAppendBasicBlock(fun, bb_name);
new_builder(llbb).RetVoid();
}
@@ -7283,10 +7283,10 @@ fn make_memcpy_glue(ValueRef fun) {
// We're not using the LLVM memcpy intrinsic. It appears to call through
// to the platform memcpy in some cases, which is not terribly safe to run
// on a rust stack.
- auto initbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("init"));
- auto hdrbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("hdr"));
- auto loopbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("loop"));
- auto endbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("end"));
+ auto initbb = llvm.LLVMAppendBasicBlock(fun, Str.buf("init"));
+ auto hdrbb = llvm.LLVMAppendBasicBlock(fun, Str.buf("hdr"));
+ auto loopbb = llvm.LLVMAppendBasicBlock(fun, Str.buf("loop"));
+ auto endbb = llvm.LLVMAppendBasicBlock(fun, Str.buf("end"));
auto dst = llvm.LLVMGetParam(fun, 0u);
auto src = llvm.LLVMGetParam(fun, 1u);
@@ -7325,10 +7325,10 @@ fn decl_bzero_glue(ModuleRef llmod) -> ValueRef {
fn make_bzero_glue(ValueRef fun) -> ValueRef {
// We're not using the LLVM memset intrinsic. Same as with memcpy.
- auto initbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("init"));
- auto hdrbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("hdr"));
- auto loopbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("loop"));
- auto endbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("end"));
+ auto initbb = llvm.LLVMAppendBasicBlock(fun, Str.buf("init"));
+ auto hdrbb = llvm.LLVMAppendBasicBlock(fun, Str.buf("hdr"));
+ auto loopbb = llvm.LLVMAppendBasicBlock(fun, Str.buf("loop"));
+ auto endbb = llvm.LLVMAppendBasicBlock(fun, Str.buf("end"));
auto dst = llvm.LLVMGetParam(fun, 0u);
auto count = llvm.LLVMGetParam(fun, 1u);
@@ -7440,7 +7440,7 @@ fn trans_vec_append_glue(@local_ctxt cx) {
let ValueRef llskipnull = llvm.LLVMGetParam(llfn, 5u);
let BasicBlockRef llallocas =
- llvm.LLVMAppendBasicBlock(llfn, _str.buf("allocas"));
+ llvm.LLVMAppendBasicBlock(llfn, Str.buf("allocas"));
auto fcx = @rec(llfn=llfn,
lltaskptr=lltaskptr,
@@ -7453,7 +7453,7 @@ fn trans_vec_append_glue(@local_ctxt cx) {
llobjfields=new_def_hash[ValueRef](),
lllocals=new_def_hash[ValueRef](),
llupvars=new_def_hash[ValueRef](),
- mutable lltydescs=_vec.empty[ValueRef](),
+ mutable lltydescs=Vec.empty[ValueRef](),
lcx=cx);
auto bcx = new_top_block_ctxt(fcx);
@@ -7476,14 +7476,14 @@ fn trans_vec_append_glue(@local_ctxt cx) {
bcx = llnew_vec_res.bcx;
auto llnew_vec = vi2p(bcx, llnew_vec_res.val,
T_opaque_vec_ptr());
- llvm.LLVMSetValueName(llnew_vec, _str.buf("llnew_vec"));
+ llvm.LLVMSetValueName(llnew_vec, Str.buf("llnew_vec"));
auto copy_dst_cx = new_sub_block_ctxt(bcx, "copy new <- dst");
auto copy_src_cx = new_sub_block_ctxt(bcx, "copy new <- src");
auto pp0 = alloca(bcx, T_ptr(T_i8()));
bcx.build.Store(vec_p1_adjusted(bcx, llnew_vec, llskipnull), pp0);
- llvm.LLVMSetValueName(pp0, _str.buf("pp0"));
+ llvm.LLVMSetValueName(pp0, Str.buf("pp0"));
bcx.build.CondBr(bcx.build.TruncOrBitCast
(bcx.build.Load(llcopy_dst_ptr),
@@ -7499,13 +7499,13 @@ fn trans_vec_append_glue(@local_ctxt cx) {
ValueRef n_bytes) -> result {
auto src_lim = cx.build.GEP(src, vec(n_bytes));
- llvm.LLVMSetValueName(src_lim, _str.buf("src_lim"));
+ llvm.LLVMSetValueName(src_lim, Str.buf("src_lim"));
auto elt_llsz =
cx.build.Load(cx.build.GEP(elt_tydesc,
vec(C_int(0),
C_int(abi.tydesc_field_size))));
- llvm.LLVMSetValueName(elt_llsz, _str.buf("elt_llsz"));
+ llvm.LLVMSetValueName(elt_llsz, Str.buf("elt_llsz"));
fn take_one(ValueRef elt_tydesc,
@block_ctxt cx,
@@ -7526,7 +7526,7 @@ fn trans_vec_append_glue(@local_ctxt cx) {
// Copy any dst elements in, omitting null if doing str.
auto n_bytes = vec_fill_adjusted(copy_dst_cx, lldst_vec, llskipnull);
- llvm.LLVMSetValueName(n_bytes, _str.buf("n_bytes"));
+ llvm.LLVMSetValueName(n_bytes, Str.buf("n_bytes"));
copy_dst_cx = copy_elts(copy_dst_cx,
llelt_tydesc,
@@ -7576,13 +7576,13 @@ fn make_glues(ModuleRef llmod, type_names tn) -> @glue_fns {
T_void())),
native_glues_rust =
- _vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+ Vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
abi.ngt_rust, _), abi.n_native_glues + 1 as uint),
native_glues_pure_rust =
- _vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+ Vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
abi.ngt_pure_rust, _), abi.n_native_glues + 1 as uint),
native_glues_cdecl =
- _vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+ Vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
abi.ngt_cdecl, _), abi.n_native_glues + 1 as uint),
no_op_type_glue = decl_no_op_type_glue(llmod, tn),
memcpy_glue = decl_memcpy_glue(llmod),
@@ -7595,19 +7595,19 @@ fn make_common_glue(session.session sess, str output) {
// to autogen it, but things like the memcpy implementation are not
// and it might be better to just check in a .ll file.
auto llmod =
- llvm.LLVMModuleCreateWithNameInContext(_str.buf("rust_out"),
+ llvm.LLVMModuleCreateWithNameInContext(Str.buf("rust_out"),
llvm.LLVMGetGlobalContext());
- llvm.LLVMSetDataLayout(llmod, _str.buf(x86.get_data_layout()));
- llvm.LLVMSetTarget(llmod, _str.buf(x86.get_target_triple()));
+ llvm.LLVMSetDataLayout(llmod, Str.buf(x86.get_data_layout()));
+ llvm.LLVMSetTarget(llmod, Str.buf(x86.get_target_triple()));
auto td = mk_target_data(x86.get_data_layout());
auto tn = mk_type_names();
let ValueRef crate_ptr =
- llvm.LLVMAddGlobal(llmod, T_crate(tn), _str.buf("rust_crate"));
+ llvm.LLVMAddGlobal(llmod, T_crate(tn), Str.buf("rust_crate"));
auto intrinsics = declare_intrinsics(llmod);
- llvm.LLVMSetModuleInlineAsm(llmod, _str.buf(x86.get_module_asm()));
+ llvm.LLVMSetModuleInlineAsm(llmod, Str.buf(x86.get_module_asm()));
auto glues = make_glues(llmod, tn);
create_crate_constant(crate_ptr, glues);
@@ -7624,22 +7624,22 @@ fn create_module_map(@crate_ctxt ccx) -> ValueRef {
auto elttype = T_struct(vec(T_int(), T_int()));
auto maptype = T_array(elttype, ccx.module_data.size() + 1u);
auto map = llvm.LLVMAddGlobal(ccx.llmod, maptype,
- _str.buf("_rust_mod_map"));
+ Str.buf("_rust_mod_map"));
llvm.LLVMSetLinkage(map, lib.llvm.LLVMInternalLinkage as llvm.Linkage);
let vec[ValueRef] elts = vec();
for each (@tup(str, ValueRef) item in ccx.module_data.items()) {
auto elt = C_struct(vec(p2i(C_cstr(ccx, item._0)), p2i(item._1)));
- _vec.push[ValueRef](elts, elt);
+ Vec.push[ValueRef](elts, elt);
}
auto term = C_struct(vec(C_int(0), C_int(0)));
- _vec.push[ValueRef](elts, term);
+ Vec.push[ValueRef](elts, term);
llvm.LLVMSetInitializer(map, C_array(elttype, elts));
ret map;
}
fn crate_name(@crate_ctxt ccx, str deflt) -> str {
for (@ast.meta_item item in ccx.sess.get_metadata()) {
- if (_str.eq(item.node.name, "name")) {
+ if (Str.eq(item.node.name, "name")) {
ret item.node.value;
}
}
@@ -7653,15 +7653,15 @@ fn create_crate_map(@crate_ctxt ccx) -> ValueRef {
while (ccx.sess.has_external_crate(i)) {
auto name = ccx.sess.get_external_crate(i).name;
auto cr = llvm.LLVMAddGlobal(ccx.llmod, T_int(),
- _str.buf("_rust_crate_map_" + name));
- _vec.push[ValueRef](subcrates, p2i(cr));
+ Str.buf("_rust_crate_map_" + name));
+ Vec.push[ValueRef](subcrates, p2i(cr));
i += 1;
}
- _vec.push[ValueRef](subcrates, C_int(0));
+ Vec.push[ValueRef](subcrates, C_int(0));
auto sym_name = "_rust_crate_map_" + crate_name(ccx, "__none__");
- auto arrtype = T_array(T_int(), _vec.len[ValueRef](subcrates));
+ auto arrtype = T_array(T_int(), Vec.len[ValueRef](subcrates));
auto maptype = T_struct(vec(T_int(), arrtype));
- auto map = llvm.LLVMAddGlobal(ccx.llmod, maptype, _str.buf(sym_name));
+ auto map = llvm.LLVMAddGlobal(ccx.llmod, maptype, Str.buf(sym_name));
llvm.LLVMSetLinkage(map, lib.llvm.LLVMExternalLinkage as llvm.Linkage);
llvm.LLVMSetInitializer(map, C_struct(vec(p2i(create_module_map(ccx)),
C_array(T_int(), subcrates))));
@@ -7672,26 +7672,26 @@ fn trans_crate(session.session sess, @ast.crate crate, ty.ctxt tcx,
ty.type_cache type_cache, str output)
-> ModuleRef {
auto llmod =
- llvm.LLVMModuleCreateWithNameInContext(_str.buf("rust_out"),
+ llvm.LLVMModuleCreateWithNameInContext(Str.buf("rust_out"),
llvm.LLVMGetGlobalContext());
- llvm.LLVMSetDataLayout(llmod, _str.buf(x86.get_data_layout()));
- llvm.LLVMSetTarget(llmod, _str.buf(x86.get_target_triple()));
+ llvm.LLVMSetDataLayout(llmod, Str.buf(x86.get_data_layout()));
+ llvm.LLVMSetTarget(llmod, Str.buf(x86.get_target_triple()));
auto td = mk_target_data(x86.get_data_layout());
auto tn = mk_type_names();
let ValueRef crate_ptr =
- llvm.LLVMAddGlobal(llmod, T_crate(tn), _str.buf("rust_crate"));
+ llvm.LLVMAddGlobal(llmod, T_crate(tn), Str.buf("rust_crate"));
auto intrinsics = declare_intrinsics(llmod);
auto glues = make_glues(llmod, tn);
auto hasher = ty.hash_ty;
auto eqer = ty.eq_ty;
- auto tag_sizes = map.mk_hashmap[ty.t,uint](hasher, eqer);
- auto tydescs = map.mk_hashmap[ty.t,@tydesc_info](hasher, eqer);
- auto lltypes = map.mk_hashmap[ty.t,TypeRef](hasher, eqer);
- auto sha1s = map.mk_hashmap[ty.t,str](hasher, eqer);
- auto abbrevs = map.mk_hashmap[ty.t,metadata.ty_abbrev](hasher, eqer);
+ auto tag_sizes = Map.mk_hashmap[ty.t,uint](hasher, eqer);
+ auto tydescs = Map.mk_hashmap[ty.t,@tydesc_info](hasher, eqer);
+ auto lltypes = Map.mk_hashmap[ty.t,TypeRef](hasher, eqer);
+ auto sha1s = Map.mk_hashmap[ty.t,str](hasher, eqer);
+ auto abbrevs = Map.mk_hashmap[ty.t,metadata.ty_abbrev](hasher, eqer);
auto ccx = @rec(sess = sess,
llmod = llmod,
@@ -7716,7 +7716,7 @@ fn trans_crate(session.session sess, @ast.crate crate, ty.ctxt tcx,
lltypes = lltypes,
glues = glues,
names = namegen(0),
- sha = std.sha1.mk_sha1(),
+ sha = std.SHA1.mk_sha1(),
type_sha1s = sha1s,
type_abbrevs = abbrevs,
tcx = tcx);
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 5baa6b7a..44fc5486 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -1,13 +1,13 @@
-import std._str;
-import std._uint;
-import std._vec;
+import std.Str;
+import std.UInt;
+import std.Vec;
import std.Box;
import std.UFind;
-import std.map;
-import std.map.hashmap;
-import std.option;
-import std.option.none;
-import std.option.some;
+import std.Map;
+import std.Map.hashmap;
+import std.Option;
+import std.Option.none;
+import std.Option.some;
import driver.session;
import front.ast;
@@ -65,7 +65,7 @@ fn method_ty_to_fn_ty(ctxt cx, method m) -> t {
// TODO: It'd be really nice to be able to hide this definition from the
// outside world, to enforce the above invariants.
type raw_t = rec(sty struct,
- option.t[str] cname,
+ Option.t[str] cname,
uint magic,
uint hash,
bool has_params,
@@ -108,7 +108,7 @@ tag sty {
// Data structures used in type unification
type unify_handler = obj {
- fn resolve_local(ast.def_id id) -> option.t[t];
+ fn resolve_local(ast.def_id id) -> Option.t[t];
fn record_local(ast.def_id id, t ty); // TODO: -> Unify.result
fn record_param(uint index, t binding) -> Unify.result;
};
@@ -168,8 +168,8 @@ fn mk_type_store() -> @type_store {
auto hasher = hash_ty;
auto eqer = eq_ty_full;
- ret @rec(empty_vec_ty = _vec.empty[ty.t](),
- empty_vec_mutable_ty = _vec.empty_mut[ty.t](),
+ ret @rec(empty_vec_ty = Vec.empty[ty.t](),
+ empty_vec_mutable_ty = Vec.empty_mut[ty.t](),
t_nil = mk_ty_full(ty_nil, none[str]),
t_bool = mk_ty_full(ty_bool, none[str]),
t_int = mk_ty_full(ty_int, none[str]),
@@ -196,11 +196,11 @@ fn mk_type_store() -> @type_store {
t_native = mk_ty_full(ty_native, none[str]),
t_type = mk_ty_full(ty_type, none[str]),
- mutable t_params = _vec.empty[ty.t](),
- mutable t_bound_params = _vec.empty[ty.t](),
- mutable t_vars = _vec.empty[ty.t](),
+ mutable t_params = Vec.empty[ty.t](),
+ mutable t_bound_params = Vec.empty[ty.t](),
+ mutable t_vars = Vec.empty[ty.t](),
- others=map.mk_hashmap[t,t](hasher, eqer));
+ others=Map.mk_hashmap[t,t](hasher, eqer));
}
fn mk_rcache() -> creader_cache {
@@ -215,7 +215,7 @@ fn mk_rcache() -> creader_cache {
}
auto h = hash_cache_entry;
auto e = eq_cache_entries;
- ret map.mk_hashmap[tup(int,uint,uint),t](h, e);
+ ret Map.mk_hashmap[tup(int,uint,uint),t](h, e);
}
fn mk_ctxt(session.session s) -> ctxt {
@@ -225,7 +225,7 @@ fn mk_ctxt(session.session s) -> ctxt {
}
// Type constructors
-fn mk_ty_full(&sty st, option.t[str] cname) -> t {
+fn mk_ty_full(&sty st, Option.t[str] cname) -> t {
auto h = hash_type_info(st, cname);
auto magic = mk_magic(st);
@@ -350,7 +350,7 @@ fn mk_ty_full(&sty st, option.t[str] cname) -> t {
has_locals = has_locals);
}
-fn gen_ty_full(ctxt cx, &sty st, option.t[str] cname) -> t {
+fn gen_ty_full(ctxt cx, &sty st, Option.t[str] cname) -> t {
auto new_type = mk_ty_full(st, cname);
// Do not intern anything with locals or vars; it'll be nearly
@@ -457,7 +457,7 @@ fn mk_local(ctxt cx, ast.def_id did) -> t {
}
fn mk_param(ctxt cx, uint n) -> t {
- let uint i = _vec.len[t](cx.ts.t_params);
+ let uint i = Vec.len[t](cx.ts.t_params);
while (i <= n) {
cx.ts.t_params += vec(mk_ty_full(ty_param(i), none[str]));
i += 1u;
@@ -466,7 +466,7 @@ fn mk_param(ctxt cx, uint n) -> t {
}
fn mk_bound_param(ctxt cx, uint n) -> t {
- let uint i = _vec.len[t](cx.ts.t_bound_params);
+ let uint i = Vec.len[t](cx.ts.t_bound_params);
while (i <= n) {
cx.ts.t_bound_params += vec(mk_ty_full(ty_bound_param(i), none[str]));
i += 1u;
@@ -482,17 +482,17 @@ fn mk_native(ctxt cx) -> t { ret cx.ts.t_native; }
fn struct(ctxt cx, t typ) -> sty { ret typ.struct; }
// Returns the canonical name of the given type.
-fn cname(ctxt cx, t typ) -> option.t[str] { ret typ.cname; }
+fn cname(ctxt cx, t typ) -> Option.t[str] { ret typ.cname; }
// Stringification
fn path_to_str(&ast.path pth) -> str {
- auto result = _str.connect(pth.node.idents, ".");
- if (_vec.len[@ast.ty](pth.node.types) > 0u) {
+ auto result = Str.connect(pth.node.idents, ".");
+ if (Vec.len[@ast.ty](pth.node.types) > 0u) {
auto f = pretty.pprust.ty_to_str;
result += "[";
- result += _str.connect(_vec.map[@ast.ty,str](f, pth.node.types), ",");
+ result += Str.connect(Vec.map[@ast.ty,str](f, pth.node.types), ",");
result += "]";
}
ret result;
@@ -513,7 +513,7 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
fn fn_to_str(ctxt cx,
ast.proto proto,
- option.t[ast.ident] ident,
+ Option.t[ast.ident] ident,
vec[arg] inputs, t output) -> str {
auto f = bind fn_input_to_str(cx, _);
@@ -536,7 +536,7 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
}
s += "(";
- s += _str.connect(_vec.map[arg,str](f, inputs), ", ");
+ s += Str.connect(Vec.map[arg,str](f, inputs), ", ");
s += ")";
if (struct(cx, output) != ty_nil) {
@@ -592,24 +592,24 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
case (ty_tup(?elems)) {
auto f = bind mt_to_str(cx, _);
- auto strs = _vec.map[mt,str](f, elems);
- s += "tup(" + _str.connect(strs, ",") + ")";
+ auto strs = Vec.map[mt,str](f, elems);
+ s += "tup(" + Str.connect(strs, ",") + ")";
}
case (ty_rec(?elems)) {
auto f = bind field_to_str(cx, _);
- auto strs = _vec.map[field,str](f, elems);
- s += "rec(" + _str.connect(strs, ",") + ")";
+ auto strs = Vec.map[field,str](f, elems);
+ s += "rec(" + Str.connect(strs, ",") + ")";
}
case (ty_tag(?id, ?tps)) {
// The user should never see this if the cname is set properly!
s += "<tag#" + util.common.istr(id._0) + ":" +
util.common.istr(id._1) + ">";
- if (_vec.len[t](tps) > 0u) {
+ if (Vec.len[t](tps) > 0u) {
auto f = bind ty_to_str(cx, _);
- auto strs = _vec.map[t,str](f, tps);
- s += "[" + _str.connect(strs, ",") + "]";
+ auto strs = Vec.map[t,str](f, tps);
+ s += "[" + Str.connect(strs, ",") + "]";
}
}
@@ -623,8 +623,8 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
case (ty_obj(?meths)) {
auto f = bind method_to_str(cx, _);
- auto m = _vec.map[method,str](f, meths);
- s += "obj {\n\t" + _str.connect(m, "\n\t") + "\n}";
+ auto m = Vec.map[method,str](f, meths);
+ s += "obj {\n\t" + Str.connect(m, "\n\t") + "\n}";
}
case (ty_var(?v)) {
@@ -637,11 +637,11 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
}
case (ty_param(?id)) {
- s += "'" + _str.unsafe_from_bytes(vec(('a' as u8) + (id as u8)));
+ s += "'" + Str.unsafe_from_bytes(vec(('a' as u8) + (id as u8)));
}
case (ty_bound_param(?id)) {
- s += "''" + _str.unsafe_from_bytes(vec(('a' as u8) + (id as u8)));
+ s += "''" + Str.unsafe_from_bytes(vec(('a' as u8) + (id as u8)));
}
}
@@ -652,7 +652,7 @@ fn ty_to_short_str(ctxt cx, t typ) -> str {
auto f = def_to_str;
auto ecx = @rec(ds=f, tcx=cx, abbrevs=metadata.ac_no_abbrevs);
auto s = metadata.Encode.ty_str(ecx, typ);
- if (_str.byte_len(s) >= 64u) { s = _str.substr(s, 0u, 64u); }
+ if (Str.byte_len(s) >= 64u) { s = Str.substr(s, 0u, 64u); }
ret s;
}
@@ -956,14 +956,14 @@ fn type_has_dynamic_size(ctxt cx, t ty) -> bool {
alt (struct(cx, ty)) {
case (ty_tup(?mts)) {
auto i = 0u;
- while (i < _vec.len[mt](mts)) {
+ while (i < Vec.len[mt](mts)) {
if (type_has_dynamic_size(cx, mts.(i).ty)) { ret true; }
i += 1u;
}
}
case (ty_rec(?fields)) {
auto i = 0u;
- while (i < _vec.len[field](fields)) {
+ while (i < Vec.len[field](fields)) {
if (type_has_dynamic_size(cx, fields.(i).mt.ty)) {
ret true;
}
@@ -972,7 +972,7 @@ fn type_has_dynamic_size(ctxt cx, t ty) -> bool {
}
case (ty_tag(_, ?subtys)) {
auto i = 0u;
- while (i < _vec.len[t](subtys)) {
+ while (i < Vec.len[t](subtys)) {
if (type_has_dynamic_size(cx, subtys.(i))) { ret true; }
i += 1u;
}
@@ -1041,7 +1041,7 @@ fn type_is_signed(ctxt cx, t ty) -> bool {
fail;
}
-fn type_param(ctxt cx, t ty) -> option.t[uint] {
+fn type_param(ctxt cx, t ty) -> Option.t[uint] {
alt (struct(cx, ty)) {
case (ty_param(?id)) { ret some[uint](id); }
case (_) { /* fall through */ }
@@ -1174,7 +1174,7 @@ fn hash_type_structure(&sty st) -> uint {
case (ty_obj(?methods)) {
auto h = 27u;
for (method m in methods) {
- h += h << 5u + _str.hash(m.ident);
+ h += h << 5u + Str.hash(m.ident);
}
ret h;
}
@@ -1187,11 +1187,11 @@ fn hash_type_structure(&sty st) -> uint {
}
}
-fn hash_type_info(&sty st, option.t[str] cname_opt) -> uint {
+fn hash_type_info(&sty st, Option.t[str] cname_opt) -> uint {
auto h = hash_type_structure(st);
alt (cname_opt) {
case (none[str]) { /* no-op */ }
- case (some[str](?s)) { h += h << 5u + _str.hash(s); }
+ case (some[str](?s)) { h += h << 5u + Str.hash(s); }
}
ret h;
}
@@ -1297,8 +1297,8 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
vec[arg] args_b, t rty_b) -> bool {
if (!eq_ty(rty_a, rty_b)) { ret false; }
- auto len = _vec.len[arg](args_a);
- if (len != _vec.len[arg](args_b)) { ret false; }
+ auto len = Vec.len[arg](args_a);
+ if (len != Vec.len[arg](args_b)) { ret false; }
auto i = 0u;
while (i < len) {
@@ -1370,8 +1370,8 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
case (ty_tag(?id_b, ?tys_b)) {
if (!equal_def(id_a, id_b)) { ret false; }
- auto len = _vec.len[t](tys_a);
- if (len != _vec.len[t](tys_b)) { ret false; }
+ auto len = Vec.len[t](tys_a);
+ if (len != Vec.len[t](tys_b)) { ret false; }
auto i = 0u;
while (i < len) {
if (!eq_ty(tys_a.(i), tys_b.(i))) { ret false; }
@@ -1415,8 +1415,8 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
case (ty_tup(?mts_a)) {
alt (b) {
case (ty_tup(?mts_b)) {
- auto len = _vec.len[mt](mts_a);
- if (len != _vec.len[mt](mts_b)) { ret false; }
+ auto len = Vec.len[mt](mts_a);
+ if (len != Vec.len[mt](mts_b)) { ret false; }
auto i = 0u;
while (i < len) {
if (!equal_mt(mts_a.(i), mts_b.(i))) { ret false; }
@@ -1430,12 +1430,12 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
case (ty_rec(?flds_a)) {
alt (b) {
case (ty_rec(?flds_b)) {
- auto len = _vec.len[field](flds_a);
- if (len != _vec.len[field](flds_b)) { ret false; }
+ auto len = Vec.len[field](flds_a);
+ if (len != Vec.len[field](flds_b)) { ret false; }
auto i = 0u;
while (i < len) {
auto fld_a = flds_a.(i); auto fld_b = flds_b.(i);
- if (!_str.eq(fld_a.ident, fld_b.ident) ||
+ if (!Str.eq(fld_a.ident, fld_b.ident) ||
!equal_mt(fld_a.mt, fld_b.mt)) {
ret false;
}
@@ -1467,13 +1467,13 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
case (ty_obj(?methods_a)) {
alt (b) {
case (ty_obj(?methods_b)) {
- auto len = _vec.len[method](methods_a);
- if (len != _vec.len[method](methods_b)) { ret false; }
+ auto len = Vec.len[method](methods_a);
+ if (len != Vec.len[method](methods_b)) { ret false; }
auto i = 0u;
while (i < len) {
auto m_a = methods_a.(i); auto m_b = methods_b.(i);
if (!equal_proto(m_a.proto, m_b.proto) ||
- !_str.eq(m_a.ident, m_b.ident) ||
+ !Str.eq(m_a.ident, m_b.ident) ||
!equal_fn(m_a.inputs, m_a.output,
m_b.inputs, m_b.output)) {
ret false;
@@ -1546,7 +1546,7 @@ fn eq_ty_full(&t a, &t b) -> bool {
case (some[str](?s_a)) {
alt (b.cname) {
case (some[str](?s_b)) {
- if (!_str.eq(s_a, s_b)) { ret false; }
+ if (!Str.eq(s_a, s_b)) { ret false; }
}
case (_) { ret false; }
}
@@ -1651,7 +1651,7 @@ fn count_ty_params(ctxt cx, t ty) -> uint {
let @mutable vec[uint] param_indices = @mutable v;
auto f = bind counter(cx, param_indices, _);
walk_ty(cx, f, ty);
- ret _vec.len[uint](*param_indices);
+ ret Vec.len[uint](*param_indices);
}
fn type_contains_vars(ctxt cx, t typ) -> bool {
@@ -1721,7 +1721,7 @@ fn native_item_ty(@ast.native_item it) -> ty_param_count_and_ty {
auto result_ty;
alt (it.node) {
case (ast.native_item_fn(_, _, _, ?tps, _, ?ann)) {
- ty_param_count = _vec.len[ast.ty_param](tps);
+ ty_param_count = Vec.len[ast.ty_param](tps);
result_ty = ann_to_type(ann);
}
}
@@ -1737,22 +1737,22 @@ fn item_ty(@ast.item it) -> ty_param_count_and_ty {
result_ty = ann_to_type(ann);
}
case (ast.item_fn(_, _, ?tps, _, ?ann)) {
- ty_param_count = _vec.len[ast.ty_param](tps);
+ ty_param_count = Vec.len[ast.ty_param](tps);
result_ty = ann_to_type(ann);
}
case (ast.item_mod(_, _, _)) {
fail; // modules are typeless
}
case (ast.item_ty(_, _, ?tps, _, ?ann)) {
- ty_param_count = _vec.len[ast.ty_param](tps);
+ ty_param_count = Vec.len[ast.ty_param](tps);
result_ty = ann_to_type(ann);
}
case (ast.item_tag(_, _, ?tps, ?did, ?ann)) {
- ty_param_count = _vec.len[ast.ty_param](tps);
+ ty_param_count = Vec.len[ast.ty_param](tps);
result_ty = ann_to_type(ann);
}
case (ast.item_obj(_, _, ?tps, _, ?ann)) {
- ty_param_count = _vec.len[ast.ty_param](tps);
+ ty_param_count = Vec.len[ast.ty_param](tps);
result_ty = ann_to_type(ann);
}
}
@@ -1924,7 +1924,7 @@ fn expr_has_ty_params(@ast.expr expr) -> bool {
alt (expr_ann(expr)) {
case (ast.ann_none) { fail; }
case (ast.ann_type(_, ?tps_opt, _)) {
- ret !option.is_none[vec[t]](tps_opt);
+ ret !Option.is_none[vec[t]](tps_opt);
}
}
}
@@ -1987,7 +1987,7 @@ fn field_num(session.session sess, &span sp, &ast.ident id) -> uint {
accum += (c as uint) - ('0' as uint);
} else {
auto s = "";
- s += _str.unsafe_from_byte(c);
+ s += Str.unsafe_from_byte(c);
sess.span_err(sp,
"bad numeric field on tuple: "
+ " non-digit character: "
@@ -2003,7 +2003,7 @@ fn field_idx(session.session sess, &span sp,
&ast.ident id, vec[field] fields) -> uint {
let uint i = 0u;
for (field f in fields) {
- if (_str.eq(f.ident, id)) {
+ if (Str.eq(f.ident, id)) {
ret i;
}
i += 1u;
@@ -2016,7 +2016,7 @@ fn method_idx(session.session sess, &span sp,
&ast.ident id, vec[method] meths) -> uint {
let uint i = 0u;
for (method m in meths) {
- if (_str.eq(m.ident, id)) {
+ if (Str.eq(m.ident, id)) {
ret i;
}
i += 1u;
@@ -2027,10 +2027,10 @@ fn method_idx(session.session sess, &span sp,
fn sort_methods(vec[method] meths) -> vec[method] {
fn method_lteq(&method a, &method b) -> bool {
- ret _str.lteq(a.ident, b.ident);
+ ret Str.lteq(a.ident, b.ident);
}
- ret std.sort.merge_sort[method](bind method_lteq(_,_), meths);
+ ret std.Sort.merge_sort[method](bind method_lteq(_,_), meths);
}
fn is_lval(@ast.expr expr) -> bool {
@@ -2078,7 +2078,7 @@ mod Unify {
// Unifies two mutability flags.
fn unify_mut(ast.mutability expected, ast.mutability actual)
- -> option.t[ast.mutability] {
+ -> Option.t[ast.mutability] {
if (expected == actual) {
ret some[ast.mutability](expected);
}
@@ -2102,8 +2102,8 @@ mod Unify {
vec[arg] expected_inputs, t expected_output,
vec[arg] actual_inputs, t actual_output)
-> fn_common_res {
- auto expected_len = _vec.len[arg](expected_inputs);
- auto actual_len = _vec.len[arg](actual_inputs);
+ auto expected_len = Vec.len[arg](expected_inputs);
+ auto actual_len = Vec.len[arg](actual_inputs);
if (expected_len != actual_len) {
ret fn_common_res_err(ures_err(terr_arg_count,
expected, actual));
@@ -2213,8 +2213,8 @@ mod Unify {
vec[method] actual_meths) -> result {
let vec[method] result_meths = vec();
let uint i = 0u;
- let uint expected_len = _vec.len[method](expected_meths);
- let uint actual_len = _vec.len[method](actual_meths);
+ let uint expected_len = Vec.len[method](expected_meths);
+ let uint actual_len = Vec.len[method](actual_meths);
if (expected_len != actual_len) {
ret ures_err(terr_meth_count, expected, actual);
@@ -2223,7 +2223,7 @@ mod Unify {
while (i < expected_len) {
auto e_meth = expected_meths.(i);
auto a_meth = actual_meths.(i);
- if (! _str.eq(e_meth.ident, a_meth.ident)) {
+ if (! Str.eq(e_meth.ident, a_meth.ident)) {
ret ures_err(terr_obj_meths(e_meth.ident, a_meth.ident),
expected, actual);
}
@@ -2287,7 +2287,7 @@ mod Unify {
case (_) {
// Just bind the type variable to the expected type.
- auto vlen = _vec.len[vec[t]](cx.types);
+ auto vlen = Vec.len[vec[t]](cx.types);
if (actual_n < vlen) {
cx.types.(actual_n) += vec(expected);
} else {
@@ -2354,7 +2354,7 @@ mod Unify {
// ty.ty_tup case
let vec[t] result_tps = vec();
auto i = 0u;
- auto expected_len = _vec.len[t](expected_tps);
+ auto expected_len = Vec.len[t](expected_tps);
while (i < expected_len) {
auto expected_tp = expected_tps.(i);
auto actual_tp = actual_tps.(i);
@@ -2365,7 +2365,7 @@ mod Unify {
alt (result) {
case (ures_ok(?rty)) {
- _vec.push[t](result_tps, rty);
+ Vec.push[t](result_tps, rty);
}
case (_) {
ret result;
@@ -2494,8 +2494,8 @@ mod Unify {
case (ty.ty_tup(?expected_elems)) {
alt (struct(cx.tcx, actual)) {
case (ty.ty_tup(?actual_elems)) {
- auto expected_len = _vec.len[ty.mt](expected_elems);
- auto actual_len = _vec.len[ty.mt](actual_elems);
+ auto expected_len = Vec.len[ty.mt](expected_elems);
+ auto actual_len = Vec.len[ty.mt](actual_elems);
if (expected_len != actual_len) {
auto err = terr_tuple_size(expected_len,
actual_len);
@@ -2548,8 +2548,8 @@ mod Unify {
case (ty.ty_rec(?expected_fields)) {
alt (struct(cx.tcx, actual)) {
case (ty.ty_rec(?actual_fields)) {
- auto expected_len = _vec.len[field](expected_fields);
- auto actual_len = _vec.len[field](actual_fields);
+ auto expected_len = Vec.len[field](expected_fields);
+ auto actual_len = Vec.len[field](actual_fields);
if (expected_len != actual_len) {
auto err = terr_record_size(expected_len,
actual_len);
@@ -2574,7 +2574,7 @@ mod Unify {
case (some[ast.mutability](?m)) { mut = m; }
}
- if (!_str.eq(expected_field.ident,
+ if (!Str.eq(expected_field.ident,
actual_field.ident)) {
auto err =
terr_record_fields(expected_field.ident,
@@ -2588,7 +2588,7 @@ mod Unify {
alt (result) {
case (ures_ok(?rty)) {
auto mt = rec(ty=rty, mut=mut);
- _vec.push[field]
+ Vec.push[field]
(result_fields,
rec(mt=mt with expected_field));
}
@@ -2655,7 +2655,7 @@ mod Unify {
case (ty.ty_var(?expected_id)) {
// Add a binding.
auto expected_n = get_or_create_set(cx, expected_id);
- auto vlen = _vec.len[vec[t]](cx.types);
+ auto vlen = Vec.len[vec[t]](cx.types);
if (expected_n < vlen) {
cx.types.(expected_n) += vec(actual);
} else {
@@ -2719,7 +2719,7 @@ mod Unify {
fn unify_sets(@ctxt cx) -> vec[t] {
let vec[t] throwaway = vec();
let vec[mutable vec[t]] set_types = vec(mutable throwaway);
- _vec.pop[vec[t]](set_types); // FIXME: botch
+ Vec.pop[vec[t]](set_types); // FIXME: botch
for (UFind.node node in cx.sets.nodes) {
let vec[t] v = vec();
@@ -2727,7 +2727,7 @@ mod Unify {
}
auto i = 0u;
- while (i < _vec.len[vec[t]](set_types)) {
+ while (i < Vec.len[vec[t]](set_types)) {
auto root = UFind.find(cx.sets, i);
set_types.(root) += cx.types.(i);
i += 1u;
@@ -2735,7 +2735,7 @@ mod Unify {
let vec[t] result = vec();
for (vec[t] types in set_types) {
- if (_vec.len[t](types) > 1u) {
+ if (Vec.len[t](types) > 1u) {
log_err "unification of > 1 types in a type set is " +
"unimplemented";
fail;
@@ -2752,7 +2752,7 @@ mod Unify {
ty_ctxt tcx) -> result {
let vec[t] throwaway = vec();
let vec[mutable vec[t]] types = vec(mutable throwaway);
- _vec.pop[vec[t]](types); // FIXME: botch
+ Vec.pop[vec[t]](types); // FIXME: botch
auto cx = @rec(sets=UFind.make(),
var_ids=common.new_int_hash[uint](),
@@ -2765,7 +2765,7 @@ mod Unify {
case (ures_ok(?typ)) {
// Fast path: if there are no local variables, don't perform
// substitutions.
- if (_vec.len(cx.sets.nodes) == 0u) {
+ if (Vec.len(cx.sets.nodes) == 0u) {
ret ures_ok(typ);
}
@@ -2791,16 +2791,16 @@ fn type_err_to_str(&ty.type_err err) -> str {
ret "vectors differ in mutability";
}
case (terr_tuple_size(?e_sz, ?a_sz)) {
- ret "expected a tuple with " + _uint.to_str(e_sz, 10u) +
- " elements but found one with " + _uint.to_str(a_sz, 10u) +
+ ret "expected a tuple with " + UInt.to_str(e_sz, 10u) +
+ " elements but found one with " + UInt.to_str(a_sz, 10u) +
" elements";
}
case (terr_tuple_mutability) {
ret "tuple elements differ in mutability";
}
case (terr_record_size(?e_sz, ?a_sz)) {
- ret "expected a record with " + _uint.to_str(e_sz, 10u) +
- " fields but found one with " + _uint.to_str(a_sz, 10u) +
+ ret "expected a record with " + UInt.to_str(e_sz, 10u) +
+ " fields but found one with " + UInt.to_str(a_sz, 10u) +
" fields";
}
case (terr_record_mutability) {
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 65e443df..091616fc 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -32,15 +32,15 @@ import middle.ty.ty_nil;
import middle.ty.Unify.ures_ok;
import middle.ty.Unify.ures_err;
-import std._str;
-import std._uint;
-import std._vec;
-import std.map;
-import std.map.hashmap;
-import std.option;
-import std.option.none;
-import std.option.some;
-import std.option.from_maybe;
+import std.Str;
+import std.UInt;
+import std.Vec;
+import std.Map;
+import std.Map.hashmap;
+import std.Option;
+import std.Option.none;
+import std.Option.some;
+import std.Option.from_maybe;
import util.typestate_ann.ts_ann;
@@ -61,7 +61,7 @@ type crate_ctxt = rec(session.session sess,
ty.type_cache type_cache,
@ty_item_table item_items,
vec[ast.obj_field] obj_fields,
- option.t[ast.def_id] this_obj,
+ Option.t[ast.def_id] this_obj,
@fn_purity_table fn_purity_table,
mutable int next_var_id,
unify_cache unify_cache,
@@ -91,12 +91,12 @@ fn substitute_ty_params(&@crate_ctxt ccx,
}
}
- auto supplied_len = _vec.len[ty.t](supplied);
+ auto supplied_len = Vec.len[ty.t](supplied);
if (ty_param_count != supplied_len) {
ccx.sess.span_err(sp, "expected " +
- _uint.to_str(ty_param_count, 10u) +
+ UInt.to_str(ty_param_count, 10u) +
" type parameter(s) but found " +
- _uint.to_str(supplied_len, 10u) + " parameter(s)");
+ UInt.to_str(supplied_len, 10u) + " parameter(s)");
fail;
}
@@ -181,7 +181,7 @@ fn instantiate_path(@fn_ctxt fcx, &ast.path pth, &ty_param_count_and_ty tpt,
auto t = bind_params_in_type(fcx.ccx.tcx, tpt._1);
auto ty_substs_opt;
- auto ty_substs_len = _vec.len[@ast.ty](pth.node.types);
+ auto ty_substs_len = Vec.len[@ast.ty](pth.node.types);
if (ty_substs_len > 0u) {
let vec[ty.t] ty_substs = vec();
auto i = 0u;
@@ -281,7 +281,7 @@ fn ast_ty_to_ty(ty.ctxt tcx, ty_getter getter, &@ast.ty ast_ty) -> ty.t {
case (ast.ty_tup(?fields)) {
let vec[ty.mt] flds = vec();
for (ast.mt field in fields) {
- _vec.push[ty.mt](flds, ast_mt_to_mt(tcx, getter, field));
+ Vec.push[ty.mt](flds, ast_mt_to_mt(tcx, getter, field));
}
typ = ty.mk_tup(tcx, flds);
}
@@ -289,21 +289,21 @@ fn ast_ty_to_ty(ty.ctxt tcx, ty_getter getter, &@ast.ty ast_ty) -> ty.t {
let vec[field] flds = vec();
for (ast.ty_field f in fields) {
auto tm = ast_mt_to_mt(tcx, getter, f.mt);
- _vec.push[field](flds, rec(ident=f.ident, mt=tm));
+ Vec.push[field](flds, rec(ident=f.ident, mt=tm));
}
typ = ty.mk_rec(tcx, flds);
}
case (ast.ty_fn(?proto, ?inputs, ?output)) {
auto f = bind ast_arg_to_arg(tcx, getter, _);
- auto i = _vec.map[ast.ty_arg, arg](f, inputs);
+ auto i = Vec.map[ast.ty_arg, arg](f, inputs);
auto out_ty = ast_ty_to_ty(tcx, getter, output);
typ = ty.mk_fn(tcx, proto, i, out_ty);
}
case (ast.ty_path(?path, ?def)) {
assert (def != none[ast.def]);
- alt (option.get[ast.def](def)) {
+ alt (Option.get[ast.def](def)) {
case (ast.def_ty(?id)) {
typ = instantiate(tcx, getter, id, path.node.types);
}
@@ -325,9 +325,9 @@ fn ast_ty_to_ty(ty.ctxt tcx, ty_getter getter, &@ast.ty ast_ty) -> ty.t {
let vec[ty.method] tmeths = vec();
auto f = bind ast_arg_to_arg(tcx, getter, _);
for (ast.ty_method m in meths) {
- auto ins = _vec.map[ast.ty_arg, arg](f, m.inputs);
+ auto ins = Vec.map[ast.ty_arg, arg](f, m.inputs);
auto out = ast_ty_to_ty(tcx, getter, m.output);
- _vec.push[ty.method](tmeths,
+ Vec.push[ty.method](tmeths,
rec(proto=m.proto,
ident=m.ident,
inputs=ins,
@@ -383,10 +383,10 @@ mod Collect {
ast.proto proto,
vec[ast.ty_param] ty_params,
ast.def_id def_id) -> ty.ty_param_count_and_ty {
- auto input_tys = _vec.map[ast.arg,arg](ty_of_arg, decl.inputs);
+ auto input_tys = Vec.map[ast.arg,arg](ty_of_arg, decl.inputs);
auto output_ty = convert(decl.output);
auto t_fn = ty.mk_fn(cx.tcx, proto, input_tys, output_ty);
- auto ty_param_count = _vec.len[ast.ty_param](ty_params);
+ auto ty_param_count = Vec.len[ast.ty_param](ty_params);
auto tpt = tup(ty_param_count, t_fn);
cx.type_cache.insert(def_id, tpt);
ret tpt;
@@ -399,10 +399,10 @@ mod Collect {
ast.native_abi abi,
vec[ast.ty_param] ty_params,
ast.def_id def_id) -> ty.ty_param_count_and_ty {
- auto input_tys = _vec.map[ast.arg,arg](ty_of_arg, decl.inputs);
+ auto input_tys = Vec.map[ast.arg,arg](ty_of_arg, decl.inputs);
auto output_ty = convert(decl.output);
auto t_fn = ty.mk_native_fn(cx.tcx, abi, input_tys, output_ty);
- auto ty_param_count = _vec.len[ast.ty_param](ty_params);
+ auto ty_param_count = Vec.len[ast.ty_param](ty_params);
auto tpt = tup(ty_param_count, t_fn);
cx.type_cache.insert(def_id, tpt);
ret tpt;
@@ -438,7 +438,7 @@ mod Collect {
auto get = bind getter(cx, _);
auto convert = bind ast_ty_to_ty(cx.tcx, get, _);
auto f = bind ty_of_arg(cx, _);
- auto inputs = _vec.map[ast.arg,arg](f, m.node.meth.decl.inputs);
+ auto inputs = Vec.map[ast.arg,arg](f, m.node.meth.decl.inputs);
auto output = convert(m.node.meth.decl.output);
ret rec(proto=m.node.meth.proto, ident=m.node.ident,
inputs=inputs, output=output);
@@ -449,11 +449,11 @@ mod Collect {
&ast._obj obj_info,
vec[ast.ty_param] ty_params) -> ty.ty_param_count_and_ty {
auto f = bind ty_of_method(cx, _);
- auto methods = _vec.map[@ast.method,method](f, obj_info.methods);
+ auto methods = Vec.map[@ast.method,method](f, obj_info.methods);
auto t_obj = ty.mk_obj(cx.tcx, ty.sort_methods(methods));
t_obj = ty.rename(cx.tcx, t_obj, id);
- auto ty_param_count = _vec.len[ast.ty_param](ty_params);
+ auto ty_param_count = Vec.len[ast.ty_param](ty_params);
ret tup(ty_param_count, t_obj);
}
@@ -468,7 +468,7 @@ mod Collect {
for (ast.obj_field f in obj_info.fields) {
auto g = bind getter(cx, _);
auto t_field = ast_ty_to_ty(cx.tcx, g, f.ty);
- _vec.push[arg](t_inputs, rec(mode=ast.alias, ty=t_field));
+ Vec.push[arg](t_inputs, rec(mode=ast.alias, ty=t_field));
}
cx.type_cache.insert(obj_ty_id, t_obj);
@@ -515,7 +515,7 @@ mod Collect {
// Tell ast_ty_to_ty() that we want to perform a recursive
// call to resolve any named types.
auto typ = convert(t);
- auto ty_param_count = _vec.len[ast.ty_param](tps);
+ auto ty_param_count = Vec.len[ast.ty_param](tps);
auto tpt = tup(ty_param_count, typ);
cx.type_cache.insert(def_id, tpt);
ret tpt;
@@ -533,7 +533,7 @@ mod Collect {
auto t = ty.mk_tag(cx.tcx, def_id, subtys);
- auto ty_param_count = _vec.len[ast.ty_param](tps);
+ auto ty_param_count = Vec.len[ast.ty_param](tps);
auto tpt = tup(ty_param_count, t);
cx.type_cache.insert(def_id, tpt);
ret tpt;
@@ -585,13 +585,13 @@ mod Collect {
i += 1u;
}
- auto ty_param_count = _vec.len[ast.ty_param](ty_params);
+ auto ty_param_count = Vec.len[ast.ty_param](ty_params);
for (ast.variant variant in variants) {
// Nullary tag constructors get turned into constants; n-ary tag
// constructors get turned into functions.
auto result_ty;
- if (_vec.len[ast.variant_arg](variant.node.args) == 0u) {
+ if (Vec.len[ast.variant_arg](variant.node.args) == 0u) {
result_ty = ty.mk_tag(cx.tcx, tag_id, ty_param_tys);
} else {
// As above, tell ast_ty_to_ty() that trans_ty_item_to_ty()
@@ -691,7 +691,7 @@ mod Collect {
ret @fold.respan[ast.item_](sp, item);
}
- fn fold_native_item_fn(&@env e, &span sp, ast.ident i, option.t[str] ln,
+ fn fold_native_item_fn(&@env e, &span sp, ast.ident i, Option.t[str] ln,
&ast.fn_decl d, vec[ast.ty_param] ty_params,
ast.def_id id, ast.ann a) -> @ast.native_item {
// assert (e.cx.type_cache.contains_key(id));
@@ -746,7 +746,7 @@ mod Collect {
with meth.node
);
m = @rec(node=m_ with *meth);
- _vec.push[@ast.method](methods, m);
+ Vec.push[@ast.method](methods, m);
}
auto g = bind getter(e.cx, _);
for (ast.obj_field fld in ob.fields) {
@@ -754,7 +754,7 @@ mod Collect {
let ast.obj_field f = rec(ann=triv_ann(fty)
with fld
);
- _vec.push[ast.obj_field](fields, f);
+ Vec.push[ast.obj_field](fields, f);
}
auto dtor = none[@ast.method];
@@ -847,7 +847,7 @@ mod Unify {
// FIXME: horrid botch
let vec[mutable ty.t] param_substs =
vec(mutable ty.mk_nil(fcx.ccx.tcx));
- _vec.pop(param_substs);
+ Vec.pop(param_substs);
ret with_params(fcx, expected, actual, param_substs);
}
@@ -865,7 +865,7 @@ mod Unify {
}
obj unify_handler(@fn_ctxt fcx, vec[mutable ty.t] param_substs) {
- fn resolve_local(ast.def_id id) -> option.t[ty.t] {
+ fn resolve_local(ast.def_id id) -> Option.t[ty.t] {
alt (fcx.locals.find(id)) {
case (none[ty.t]) { ret none[ty.t]; }
case (some[ty.t](?existing_type)) {
@@ -905,7 +905,7 @@ mod Unify {
}
fn record_param(uint index, ty.t binding) -> ty.Unify.result {
// Unify with the appropriate type in the parameter
- // substitution list.
+ // substitution List.
auto old_subst = param_substs.(index);
auto result = with_params(fcx, old_subst, binding,
@@ -1004,7 +1004,7 @@ mod Demand {
let vec[mutable ty.t] ty_param_substs =
vec(mutable ty.mk_nil(fcx.ccx.tcx));
- _vec.pop(ty_param_substs); // FIXME: horrid botch
+ Vec.pop(ty_param_substs); // FIXME: horrid botch
for (ty.t ty_param_subst in ty_param_substs_0) {
ty_param_substs += vec(mutable ty_param_subst);
}
@@ -1047,7 +1047,7 @@ fn are_compatible(&@fn_ctxt fcx, ty.t expected, ty.t actual) -> bool {
// Returns the types of the arguments to a tag variant.
fn variant_arg_types(@crate_ctxt ccx, &span sp, ast.def_id vid,
vec[ty.t] tag_ty_params) -> vec[ty.t] {
- auto ty_param_count = _vec.len[ty.t](tag_ty_params);
+ auto ty_param_count = Vec.len[ty.t](tag_ty_params);
let vec[ty.t] result = vec();
@@ -1130,7 +1130,7 @@ mod Pushdown {
}
// Get the types of the arguments of the variant.
- auto vdef = option.get[ast.variant_def](vdef_opt);
+ auto vdef = Option.get[ast.variant_def](vdef_opt);
auto arg_tys = variant_arg_types(fcx.ccx, pat.span, vdef._1,
tag_tps);
@@ -1218,7 +1218,7 @@ mod Pushdown {
case (none[@ast.expr]) {
auto i = 0u;
for (ast.field field_0 in fields_0) {
- assert (_str.eq(field_0.ident,
+ assert (Str.eq(field_0.ident,
field_mts.(i).ident));
auto e_1 =
pushdown_expr(fcx,
@@ -1240,7 +1240,7 @@ mod Pushdown {
for (ast.field field_0 in fields_0) {
for (ty.field ft in field_mts) {
- if (_str.eq(field_0.ident,
+ if (Str.eq(field_0.ident,
ft.ident)) {
auto e_1 =
pushdown_expr(fcx, ft.mt.ty,
@@ -1508,9 +1508,9 @@ mod Pushdown {
// Local variable resolution: the phase that finds all the types in the AST
// and replaces opaque "ty_local" types with the resolved local types.
-fn writeback_local(&option.t[@fn_ctxt] env, &span sp, @ast.local local)
+fn writeback_local(&Option.t[@fn_ctxt] env, &span sp, @ast.local local)
-> @ast.decl {
- auto fcx = option.get[@fn_ctxt](env);
+ auto fcx = Option.get[@fn_ctxt](env);
auto local_ty;
alt (fcx.locals.find(local.id)) {
@@ -1530,7 +1530,7 @@ fn writeback_local(&option.t[@fn_ctxt] env, &span sp, @ast.local local)
ret @fold.respan[ast.decl_](sp, ast.decl_local(local_wb));
}
-fn resolve_local_types_in_annotation(&option.t[@fn_ctxt] env, ast.ann ann)
+fn resolve_local_types_in_annotation(&Option.t[@fn_ctxt] env, ast.ann ann)
-> ast.ann {
fn resolver(@fn_ctxt fcx, ty.t typ) -> ty.t {
alt (struct(fcx.ccx.tcx, typ)) {
@@ -1539,7 +1539,7 @@ fn resolve_local_types_in_annotation(&option.t[@fn_ctxt] env, ast.ann ann)
}
}
- auto fcx = option.get[@fn_ctxt](env);
+ auto fcx = Option.get[@fn_ctxt](env);
alt (ann) {
case (ast.ann_none) {
log "warning: no type for expression";
@@ -1559,16 +1559,16 @@ fn resolve_local_types_in_annotation(&option.t[@fn_ctxt] env, ast.ann ann)
fn resolve_local_types_in_block(&@fn_ctxt fcx, &ast.block block)
-> ast.block {
- fn update_env_for_item(&option.t[@fn_ctxt] env, @ast.item i)
- -> option.t[@fn_ctxt] {
+ fn update_env_for_item(&Option.t[@fn_ctxt] env, @ast.item i)
+ -> Option.t[@fn_ctxt] {
ret none[@fn_ctxt];
}
- fn keep_going(&option.t[@fn_ctxt] env) -> bool {
- ret !option.is_none[@fn_ctxt](env);
+ fn keep_going(&Option.t[@fn_ctxt] env) -> bool {
+ ret !Option.is_none[@fn_ctxt](env);
}
// FIXME: rustboot bug prevents us from using these functions directly
- auto fld = fold.new_identity_fold[option.t[@fn_ctxt]]();
+ auto fld = fold.new_identity_fold[Option.t[@fn_ctxt]]();
auto wbl = writeback_local;
auto rltia = bind resolve_local_types_in_annotation(_,_);
auto uefi = update_env_for_item;
@@ -1580,7 +1580,7 @@ fn resolve_local_types_in_block(&@fn_ctxt fcx, &ast.block block)
keep_going = kg
with *fld
);
- ret fold.fold_block[option.t[@fn_ctxt]](some[@fn_ctxt](fcx), fld, block);
+ ret fold.fold_block[Option.t[@fn_ctxt]](some[@fn_ctxt](fcx), fld, block);
}
// AST fragment checking
@@ -1616,10 +1616,10 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
new_pat = ast.pat_bind(id, def_id, ann);
}
case (ast.pat_tag(?p, ?subpats, ?vdef_opt, _)) {
- auto vdef = option.get[ast.variant_def](vdef_opt);
+ auto vdef = Option.get[ast.variant_def](vdef_opt);
auto t = ty.lookup_item_type(fcx.ccx.sess, fcx.ccx.tcx,
fcx.ccx.type_cache, vdef._1)._1;
- auto len = _vec.len[ast.ident](p.node.idents);
+ auto len = Vec.len[ast.ident](p.node.idents);
auto last_id = p.node.idents.(len - 1u);
auto tpt = ty.lookup_item_type(fcx.ccx.sess, fcx.ccx.tcx,
@@ -1629,14 +1629,14 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
alt (struct(fcx.ccx.tcx, t)) {
// N-ary variants have function types.
case (ty.ty_fn(_, ?args, ?tag_ty)) {
- auto arg_len = _vec.len[arg](args);
- auto subpats_len = _vec.len[@ast.pat](subpats);
+ auto arg_len = Vec.len[arg](args);
+ auto subpats_len = Vec.len[@ast.pat](subpats);
if (arg_len != subpats_len) {
// TODO: pluralize properly
auto err_msg = "tag type " + last_id + " has " +
- _uint.to_str(subpats_len, 10u) +
+ UInt.to_str(subpats_len, 10u) +
" field(s), but this pattern has " +
- _uint.to_str(arg_len, 10u) +
+ UInt.to_str(arg_len, 10u) +
" field(s)";
fcx.ccx.sess.span_err(pat.span, err_msg);
@@ -1653,13 +1653,13 @@ fn check_pat(&@fn_ctxt fcx, @ast.pat pat) -> @ast.pat {
// Nullary variants have tag types.
case (ty.ty_tag(?tid, _)) {
- auto subpats_len = _vec.len[@ast.pat](subpats);
+ auto subpats_len = Vec.len[@ast.pat](subpats);
if (subpats_len > 0u) {
// TODO: pluralize properly
auto err_msg = "tag type " + last_id +
" has no field(s)," +
" but this pattern has " +
- _uint.to_str(subpats_len, 10u) +
+ UInt.to_str(subpats_len, 10u) +
" field(s)";
fcx.ccx.sess.span_err(pat.span, err_msg);
@@ -1689,7 +1689,7 @@ fn require_impure(&session.session sess,
}
fn get_function_purity(@crate_ctxt ccx, &ast.def_id d_id) -> ast.purity {
- let option.t[ast.purity] o = ccx.fn_purity_table.find(d_id);
+ let Option.t[ast.purity] o = ccx.fn_purity_table.find(d_id);
ret from_maybe[ast.purity](ast.impure_fn, o);
}
@@ -1738,16 +1738,16 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
// A generic function to factor out common logic from call and bind
// expressions.
fn check_call_or_bind(&@fn_ctxt fcx, &@ast.expr f,
- &vec[option.t[@ast.expr]] args)
- -> tup(@ast.expr, vec[option.t[@ast.expr]]) {
+ &vec[Option.t[@ast.expr]] args)
+ -> tup(@ast.expr, vec[Option.t[@ast.expr]]) {
// Check the function.
auto f_0 = check_expr(fcx, f);
// Check the arguments and generate the argument signature.
- let vec[option.t[@ast.expr]] args_0 = vec();
+ let vec[Option.t[@ast.expr]] args_0 = vec();
let vec[arg] arg_tys_0 = vec();
- for (option.t[@ast.expr] a_opt in args) {
+ for (Option.t[@ast.expr] a_opt in args) {
alt (a_opt) {
case (some[@ast.expr](?a)) {
auto a_0 = check_expr(fcx, a);
@@ -1756,14 +1756,14 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
// FIXME: this breaks aliases. We need a ty_fn_arg.
auto arg_ty = rec(mode=ast.val,
ty=expr_ty(fcx.ccx.tcx, a_0));
- _vec.push[arg](arg_tys_0, arg_ty);
+ Vec.push[arg](arg_tys_0, arg_ty);
}
case (none[@ast.expr]) {
args_0 += vec(none[@ast.expr]);
// FIXME: breaks aliases too?
auto typ = next_ty_var(fcx.ccx);
- _vec.push[arg](arg_tys_0, rec(mode=ast.val, ty=typ));
+ Vec.push[arg](arg_tys_0, rec(mode=ast.val, ty=typ));
}
}
}
@@ -1812,7 +1812,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
fn check_call(&@fn_ctxt fcx, @ast.expr f, vec[@ast.expr] args)
-> tup(@ast.expr, vec[@ast.expr]) {
- let vec[option.t[@ast.expr]] args_opt_0 = vec();
+ let vec[Option.t[@ast.expr]] args_opt_0 = vec();
for (@ast.expr arg in args) {
args_opt_0 += vec(some[@ast.expr](arg));
}
@@ -1822,8 +1822,8 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
// Pull out the arguments.
let vec[@ast.expr] args_1 = vec();
- for (option.t[@ast.expr] arg in result._1) {
- args_1 += vec(option.get[@ast.expr](arg));
+ for (Option.t[@ast.expr] arg in result._1) {
+ args_1 += vec(Option.get[@ast.expr](arg));
}
ret tup(result._0, args_1);
@@ -1901,7 +1901,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (ast.expr_path(?pth, ?defopt, _)) {
auto t = ty.mk_nil(fcx.ccx.tcx);
assert (defopt != none[ast.def]);
- auto defn = option.get[ast.def](defopt);
+ auto defn = Option.get[ast.def](defopt);
auto tpt = ty_param_count_and_ty_for_def(fcx, expr.span, defn);
@@ -1913,7 +1913,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
// The definition doesn't take type parameters. If the programmer
// supplied some, that's an error.
- if (_vec.len[@ast.ty](pth.node.types) > 0u) {
+ if (Vec.len[@ast.ty](pth.node.types) > 0u) {
fcx.ccx.sess.span_err(expr.span, "this kind of value does " +
"not take type parameters");
fail;
@@ -2295,7 +2295,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
// For each blank argument, add the type of that argument
// to the resulting function type.
auto i = 0u;
- while (i < _vec.len[option.t[@ast.expr]](args)) {
+ while (i < Vec.len[Option.t[@ast.expr]](args)) {
alt (args.(i)) {
case (some[@ast.expr](_)) { /* no-op */ }
case (none[@ast.expr]) {
@@ -2434,7 +2434,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
let vec[@ast.expr] args_1 = vec();
let ty.t t;
- if (_vec.len[@ast.expr](args) == 0u) {
+ if (Vec.len[@ast.expr](args) == 0u) {
t = next_ty_var(fcx.ccx);
} else {
auto expr_1 = check_expr(fcx, args.(0));
@@ -2445,7 +2445,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
auto expr_1 = check_expr(fcx, e);
auto expr_t = expr_ty(fcx.ccx.tcx, expr_1);
Demand.simple(fcx, expr.span, t, expr_t);
- _vec.push[@ast.expr](args_1,expr_1);
+ Vec.push[@ast.expr](args_1,expr_1);
}
auto ann = triv_ann(ty.mk_vec(fcx.ccx.tcx,
@@ -2461,7 +2461,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
for (ast.elt e in elts) {
auto expr_1 = check_expr(fcx, e.expr);
auto expr_t = expr_ty(fcx.ccx.tcx, expr_1);
- _vec.push[ast.elt](elts_1, rec(expr=expr_1 with e));
+ Vec.push[ast.elt](elts_1, rec(expr=expr_1 with e));
elts_mt += vec(rec(ty=expr_t, mut=e.mut));
}
@@ -2486,10 +2486,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
for (ast.field f in fields) {
auto expr_1 = check_expr(fcx, f.expr);
auto expr_t = expr_ty(fcx.ccx.tcx, expr_1);
- _vec.push[ast.field](fields_1, rec(expr=expr_1 with f));
+ Vec.push[ast.field](fields_1, rec(expr=expr_1 with f));
auto expr_mt = rec(ty=expr_t, mut=f.mut);
- _vec.push[field](fields_t, rec(ident=f.ident, mt=expr_mt));
+ Vec.push[field](fields_t, rec(ident=f.ident, mt=expr_mt));
}
auto ann = ast.ann_none;
@@ -2521,7 +2521,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
for (ty.field f in fields_t) {
auto found = false;
for (ty.field bf in base_fields) {
- if (_str.eq(f.ident, bf.ident)) {
+ if (Str.eq(f.ident, bf.ident)) {
Demand.simple(fcx, expr.span, f.mt.ty,
bf.mt.ty);
found = true;
@@ -2549,7 +2549,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (ty.ty_tup(?args)) {
let uint ix = ty.field_num(fcx.ccx.sess,
expr.span, field);
- if (ix >= _vec.len[ty.mt](args)) {
+ if (ix >= Vec.len[ty.mt](args)) {
fcx.ccx.sess.span_err(expr.span,
"bad index on tuple");
}
@@ -2563,7 +2563,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (ty.ty_rec(?fields)) {
let uint ix = ty.field_idx(fcx.ccx.sess,
expr.span, field, fields);
- if (ix >= _vec.len[typeck.field](fields)) {
+ if (ix >= Vec.len[typeck.field](fields)) {
fcx.ccx.sess.span_err(expr.span,
"bad index on record");
}
@@ -2577,7 +2577,7 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
case (ty.ty_obj(?methods)) {
let uint ix = ty.method_idx(fcx.ccx.sess,
expr.span, field, methods);
- if (ix >= _vec.len[typeck.method](methods)) {
+ if (ix >= Vec.len[typeck.method](methods)) {
fcx.ccx.sess.span_err(expr.span,
"bad index on obj");
}
@@ -2775,7 +2775,7 @@ fn check_stmt(&@fn_ctxt fcx, &@ast.stmt stmt) -> @ast.stmt {
fn check_block(&@fn_ctxt fcx, &ast.block block) -> ast.block {
let vec[@ast.stmt] stmts = vec();
for (@ast.stmt s in block.node.stmts) {
- _vec.push[@ast.stmt](stmts, check_stmt(fcx, s));
+ Vec.push[@ast.stmt](stmts, check_stmt(fcx, s));
}
auto expr = none[@ast.expr];
@@ -2900,7 +2900,7 @@ fn hash_unify_cache_entry(&unify_cache_entry uce) -> uint {
h += h << 5u + ty.hash_ty(uce._1);
auto i = 0u;
- auto tys_len = _vec.len(uce._2);
+ auto tys_len = Vec.len(uce._2);
while (i < tys_len) {
h += h << 5u + ty.hash_ty(uce._2.(i));
i += 1u;
@@ -2913,8 +2913,8 @@ fn eq_unify_cache_entry(&unify_cache_entry a, &unify_cache_entry b) -> bool {
if (!ty.eq_ty(a._0, b._0) || !ty.eq_ty(a._1, b._1)) { ret false; }
auto i = 0u;
- auto tys_len = _vec.len(a._2);
- if (_vec.len(b._2) != tys_len) { ret false; }
+ auto tys_len = Vec.len(a._2);
+ if (Vec.len(b._2) != tys_len) { ret false; }
while (i < tys_len) {
if (!ty.eq_ty(a._2.(i), b._2.(i))) { ret false; }
@@ -2957,7 +2957,7 @@ fn check_crate(ty.ctxt tcx, @ast.crate crate)
auto hasher = hash_unify_cache_entry;
auto eqer = eq_unify_cache_entry;
auto unify_cache =
- map.mk_hashmap[unify_cache_entry,ty.Unify.result](hasher, eqer);
+ Map.mk_hashmap[unify_cache_entry,ty.Unify.result](hasher, eqer);
auto fpt =
mk_fn_purity_table(crate); // use a variation on Collect
diff --git a/src/comp/middle/typestate_check.rs b/src/comp/middle/typestate_check.rs
index e15c720a..e571fa21 100644
--- a/src/comp/middle/typestate_check.rs
+++ b/src/comp/middle/typestate_check.rs
@@ -155,37 +155,37 @@ import pretty.pprust.print_block;
import pretty.pprust.print_expr;
import pretty.pprust.print_decl;
import pretty.pp.mkstate;
-import std.io.stdout;
-import std.io.str_writer;
-import std.io.string_writer;
-import std._vec.map;
-import std._vec;
-import std._vec.len;
-import std._vec.pop;
-import std._vec.push;
-import std._vec.slice;
-import std._vec.unzip;
-import std._vec.plus_option;
-import std._vec.cat_options;
-import std.option;
-import std.option.t;
-import std.option.some;
-import std.option.none;
-import std.option.from_maybe;
-import std.option.maybe;
-import std.option.is_none;
-import std.option.get;
-import std.map.hashmap;
-import std.list;
-import std.list.list;
-import std.list.cons;
-import std.list.nil;
-import std.list.foldl;
-import std.list.find;
-import std._uint;
-import std.bitv;
-import std.util.fst;
-import std.util.snd;
+import std.IO.stdout;
+import std.IO.str_writer;
+import std.IO.string_writer;
+import std.Vec.map;
+import std.Vec;
+import std.Vec.len;
+import std.Vec.pop;
+import std.Vec.push;
+import std.Vec.slice;
+import std.Vec.unzip;
+import std.Vec.plus_option;
+import std.Vec.cat_options;
+import std.Option;
+import std.Option.t;
+import std.Option.some;
+import std.Option.none;
+import std.Option.from_maybe;
+import std.Option.maybe;
+import std.Option.is_none;
+import std.Option.get;
+import std.Map.hashmap;
+import std.List;
+import std.List.list;
+import std.List.cons;
+import std.List.nil;
+import std.List.foldl;
+import std.List.find;
+import std.UInt;
+import std.BitV;
+import std.Util.fst;
+import std.Util.snd;
import util.typestate_ann;
import util.typestate_ann.difference;
@@ -195,22 +195,22 @@ import util.typestate_ann.require_and_preserve;
/**** debugging junk ****/
-fn bitv_to_str(fn_info enclosing, bitv.t v) -> str {
+fn bitv_to_str(fn_info enclosing, BitV.t v) -> str {
auto s = "";
for each (@tup(def_id, tup(uint, ident)) p in enclosing.items()) {
- if (bitv.get(v, p._1._0)) {
+ if (BitV.get(v, p._1._0)) {
s += " " + p._1._1 + " ";
}
}
ret s;
}
-fn log_bitv(fn_info enclosing, bitv.t v) {
+fn log_bitv(fn_info enclosing, BitV.t v) {
log(bitv_to_str(enclosing, v));
}
-fn log_bitv_err(fn_info enclosing, bitv.t v) {
+fn log_bitv_err(fn_info enclosing, BitV.t v) {
log_err(bitv_to_str(enclosing, v));
}
@@ -235,8 +235,8 @@ fn log_cond_err(vec[uint] v) -> () {
}
fn log_pp(&pre_and_post pp) -> () {
- auto p1 = bitv.to_vec(pp.precondition);
- auto p2 = bitv.to_vec(pp.postcondition);
+ auto p1 = BitV.to_vec(pp.precondition);
+ auto p2 = BitV.to_vec(pp.postcondition);
log("pre:");
log_cond(p1);
log("post:");
@@ -244,8 +244,8 @@ fn log_pp(&pre_and_post pp) -> () {
}
fn log_pp_err(&pre_and_post pp) -> () {
- auto p1 = bitv.to_vec(pp.precondition);
- auto p2 = bitv.to_vec(pp.postcondition);
+ auto p1 = BitV.to_vec(pp.precondition);
+ auto p2 = BitV.to_vec(pp.postcondition);
log_err("pre:");
log_cond_err(p1);
log_err("post:");
@@ -253,8 +253,8 @@ fn log_pp_err(&pre_and_post pp) -> () {
}
fn log_states(&pre_and_post_state pp) -> () {
- auto p1 = bitv.to_vec(pp.prestate);
- auto p2 = bitv.to_vec(pp.poststate);
+ auto p1 = BitV.to_vec(pp.prestate);
+ auto p2 = BitV.to_vec(pp.poststate);
log("prestate:");
log_cond(p1);
log("poststate:");
@@ -262,8 +262,8 @@ fn log_states(&pre_and_post_state pp) -> () {
}
fn log_states_err(&pre_and_post_state pp) -> () {
- auto p1 = bitv.to_vec(pp.prestate);
- auto p2 = bitv.to_vec(pp.poststate);
+ auto p1 = BitV.to_vec(pp.prestate);
+ auto p2 = BitV.to_vec(pp.poststate);
log_err("prestate:");
log_cond_err(p1);
log_err("poststate:");
@@ -288,9 +288,9 @@ fn print_idents(vec[ident] idents) -> () {
variable in a given function) to bit number
(also remembers the ident for error-logging purposes) */
type var_info = tup(uint, ident);
-type fn_info = std.map.hashmap[def_id, var_info];
+type fn_info = std.Map.hashmap[def_id, var_info];
/* mapping from function name to fn_info map */
-type fn_info_map = std.map.hashmap[def_id, fn_info];
+type fn_info_map = std.Map.hashmap[def_id, fn_info];
fn bit_num(def_id v, fn_info m) -> uint {
assert (m.contains_key(v));
@@ -312,12 +312,12 @@ fn num_locals(fn_info m) -> uint {
fn collect_local(&@vec[tup(ident, def_id)] vars, &span sp, @ast.local loc)
-> @decl {
log("collect_local: pushing " + loc.ident);
- _vec.push[tup(ident, def_id)](*vars, tup(loc.ident, loc.id));
+ Vec.push[tup(ident, def_id)](*vars, tup(loc.ident, loc.id));
ret @respan(sp, decl_local(loc));
}
fn find_locals(_fn f) -> @vec[tup(ident,def_id)] {
- auto res = @_vec.alloc[tup(ident,def_id)](0u);
+ auto res = @Vec.alloc[tup(ident,def_id)](0u);
auto fld = fold.new_identity_fold[@vec[tup(ident, def_id)]]();
fld = @rec(fold_decl_local = bind collect_local(_,_,_) with *fld);
@@ -343,7 +343,7 @@ fn mk_fn_info(_fn f) -> fn_info {
just collect locally declared vars */
let @vec[tup(ident,def_id)] locals = find_locals(f);
- log(uistr(_vec.len[tup(ident, def_id)](*locals)) + " locals");
+ log(uistr(Vec.len[tup(ident, def_id)](*locals)) + " locals");
for (tup(ident,def_id) p in *locals) {
next = add_var(p._1, p._0, next, res);
}
@@ -364,7 +364,7 @@ fn mk_fn_info_item_fn(&fn_info_map fi, &span sp, ident i, &ast._fn f,
function IDs to fn_info maps */
fn mk_fn_info_item_obj(&fn_info_map fi, &span sp, ident i, &ast._obj o,
vec[ast.ty_param] ty_params, ast.obj_def_ids odid, ann a) -> @item {
- auto all_methods = _vec.clone[@method](o.methods);
+ auto all_methods = Vec.clone[@method](o.methods);
plus_option[@method](all_methods, o.dtor);
for (@method m in all_methods) {
fi.insert(m.node.id, mk_fn_info(m.node.meth));
@@ -403,7 +403,7 @@ fn ann_to_ts_ann(ann a, uint nv) -> ts_ann {
}
}
-fn ann_to_ts_ann_fail(ann a) -> option.t[@ts_ann] {
+fn ann_to_ts_ann_fail(ann a) -> Option.t[@ts_ann] {
alt (a) {
case (ann_none) {
log("ann_to_ts_ann_fail: didn't expect ann_none here");
@@ -432,7 +432,7 @@ fn ann_to_poststate(ann a) -> poststate {
ret (ann_to_ts_ann_fail_more(a)).states.poststate;
}
-fn stmt_to_ann(&stmt s) -> option.t[@ts_ann] {
+fn stmt_to_ann(&stmt s) -> Option.t[@ts_ann] {
alt (s.node) {
case (stmt_decl(_,?a)) {
ret ann_to_ts_ann_fail(a);
@@ -652,7 +652,7 @@ fn seq_preconds(fn_info enclosing, vec[pre_and_post] pps) -> precond {
/* works on either postconds or preconds
should probably rethink the whole type synonym situation */
fn union_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
- auto sz = _vec.len[postcond](rest);
+ auto sz = Vec.len[postcond](rest);
if (sz > 0u) {
auto other = rest.(0);
@@ -665,7 +665,7 @@ fn union_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
fn union_postconds(uint nv, &vec[postcond] pcs) -> postcond {
if (len[postcond](pcs) > 0u) {
- ret union_postconds_go(bitv.clone(pcs.(0)), pcs);
+ ret union_postconds_go(BitV.clone(pcs.(0)), pcs);
}
else {
ret empty_prestate(nv);
@@ -674,7 +674,7 @@ fn union_postconds(uint nv, &vec[postcond] pcs) -> postcond {
/* Gee, maybe we could use foldl or something */
fn intersect_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
- auto sz = _vec.len[postcond](rest);
+ auto sz = Vec.len[postcond](rest);
if (sz > 0u) {
auto other = rest.(0);
@@ -689,7 +689,7 @@ fn intersect_postconds_go(&postcond first, &vec[postcond] rest) -> postcond {
fn intersect_postconds(&vec[postcond] pcs) -> postcond {
assert (len[postcond](pcs) > 0u);
- ret intersect_postconds_go(bitv.clone(pcs.(0)), pcs);
+ ret intersect_postconds_go(BitV.clone(pcs.(0)), pcs);
}
/******* AST-traversing code ********/
@@ -720,8 +720,8 @@ fn find_pre_post_obj(&fn_info_map fm, _obj o) -> () {
find_pre_post_fn(fm, fm.get(m.node.id), m.node.meth);
}
auto f = bind do_a_method(fm,_);
- _vec.map[@method, ()](f, o.methods);
- option.map[@method, ()](f, o.dtor);
+ Vec.map[@method, ()](f, o.methods);
+ Option.map[@method, ()](f, o.dtor);
}
fn find_pre_post_state_obj(fn_info_map fm, _obj o) -> bool {
@@ -730,8 +730,8 @@ fn find_pre_post_state_obj(fn_info_map fm, _obj o) -> bool {
ret find_pre_post_state_fn(fm, fm.get(m.node.id), m.node.meth);
}
auto f = bind do_a_method(fm,_);
- auto flags = _vec.map[@method, bool](f, o.methods);
- auto changed = _vec.or(flags);
+ auto flags = Vec.map[@method, bool](f, o.methods);
+ auto changed = Vec.or(flags);
changed = changed || maybe[@method, bool](false, f, o.dtor);
ret changed;
}
@@ -777,19 +777,19 @@ fn find_pre_post_exprs(&fn_info_map fm, &fn_info enclosing,
}
auto f = bind do_one(fm, enclosing, _);
- _vec.map[@expr, ()](f, args);
+ Vec.map[@expr, ()](f, args);
fn get_pp(&@expr e) -> pre_and_post {
ret expr_pp(e);
}
auto g = get_pp;
- auto pps = _vec.map[@expr, pre_and_post](g, args);
+ auto pps = Vec.map[@expr, pre_and_post](g, args);
auto h = get_post;
set_pre_and_post(a,
rec(precondition=seq_preconds(enclosing, pps),
postcondition=union_postconds
- (nv, (_vec.map[pre_and_post, postcond](h, pps)))));
+ (nv, (Vec.map[pre_and_post, postcond](h, pps)))));
}
fn find_pre_post_loop(&fn_info_map fm, &fn_info enclosing, &@decl d,
@@ -822,13 +822,13 @@ fn find_pre_post_expr(&fn_info_map fm, &fn_info enclosing, @expr e) -> () {
alt (e.node) {
case (expr_call(?operator, ?operands, ?a)) {
- auto args = _vec.clone[@expr](operands);
- _vec.push[@expr](args, operator);
+ auto args = Vec.clone[@expr](operands);
+ Vec.push[@expr](args, operator);
find_pre_post_exprs(fm, enclosing, args, a);
}
case (expr_spawn(_, _, ?operator, ?operands, ?a)) {
- auto args = _vec.clone[@expr](operands);
- _vec.push[@expr](args, operator);
+ auto args = Vec.clone[@expr](operands);
+ Vec.push[@expr](args, operator);
find_pre_post_exprs(fm, enclosing, args, a);
}
case (expr_vec(?args, _, ?a)) {
@@ -888,7 +888,7 @@ fn find_pre_post_expr(&fn_info_map fm, &fn_info enclosing, @expr e) -> () {
}
case (expr_rec(?fields,?maybe_base,?a)) {
auto es = field_exprs(fields);
- _vec.plus_option[@expr](es, maybe_base);
+ Vec.plus_option[@expr](es, maybe_base);
find_pre_post_exprs(fm, enclosing, es, a);
}
case (expr_assign(?lhs, ?rhs, ?a)) {
@@ -1051,7 +1051,7 @@ fn find_pre_post_expr(&fn_info_map fm, &fn_info enclosing, @expr e) -> () {
ret block_pp(an_alt.block);
}
auto f = bind do_an_alt(fm, enclosing, _);
- auto alt_pps = _vec.map[arm, pre_and_post](f, alts);
+ auto alt_pps = Vec.map[arm, pre_and_post](f, alts);
fn combine_pp(pre_and_post antec,
fn_info enclosing, &pre_and_post pp,
&pre_and_post next) -> pre_and_post {
@@ -1065,7 +1065,7 @@ fn find_pre_post_expr(&fn_info_map fm, &fn_info enclosing, @expr e) -> () {
postcondition=false_postcond(num_local_vars));
auto g = bind combine_pp(antec_pp, enclosing, _, _);
- auto alts_overall_pp = _vec.foldl[pre_and_post, pre_and_post]
+ auto alts_overall_pp = Vec.foldl[pre_and_post, pre_and_post]
(g, e_pp, alt_pps);
set_pre_and_post(a, alts_overall_pp);
@@ -1091,8 +1091,8 @@ fn find_pre_post_expr(&fn_info_map fm, &fn_info enclosing, @expr e) -> () {
set_pre_and_post(a, expr_pp(p));
}
case(expr_bind(?operator, ?maybe_args, ?a)) {
- auto args = _vec.cat_options[@expr](maybe_args);
- _vec.push[@expr](args, operator); /* ??? order of eval? */
+ auto args = Vec.cat_options[@expr](maybe_args);
+ Vec.push[@expr](args, operator); /* ??? order of eval? */
find_pre_post_exprs(fm, enclosing, args, a);
}
case (expr_break(?a)) {
@@ -1210,12 +1210,12 @@ fn find_pre_post_block(&fn_info_map fm, &fn_info enclosing, block b)
}
auto do_one = bind do_one_(fm, enclosing, _);
- _vec.map[@stmt, ()](do_one, b.node.stmts);
+ Vec.map[@stmt, ()](do_one, b.node.stmts);
fn do_inner_(fn_info_map fm, fn_info i, &@expr e) -> () {
find_pre_post_expr(fm, i, e);
}
auto do_inner = bind do_inner_(fm, enclosing, _);
- option.map[@expr, ()](do_inner, b.node.expr);
+ Option.map[@expr, ()](do_inner, b.node.expr);
let vec[pre_and_post] pps = vec();
@@ -1223,20 +1223,20 @@ fn find_pre_post_block(&fn_info_map fm, &fn_info enclosing, block b)
ret stmt_pp(*s);
}
auto f = get_pp_stmt;
- pps += _vec.map[@stmt, pre_and_post](f, b.node.stmts);
+ pps += Vec.map[@stmt, pre_and_post](f, b.node.stmts);
fn get_pp_expr(&@expr e) -> pre_and_post {
ret expr_pp(e);
}
auto g = get_pp_expr;
plus_option[pre_and_post](pps,
- option.map[@expr, pre_and_post](g, b.node.expr));
+ Option.map[@expr, pre_and_post](g, b.node.expr));
auto block_precond = seq_preconds(enclosing, pps);
auto h = get_post;
- auto postconds = _vec.map[pre_and_post, postcond](h, pps);
+ auto postconds = Vec.map[pre_and_post, postcond](h, pps);
/* A block may be empty, so this next line ensures that the postconds
vector is non-empty. */
- _vec.push[postcond](postconds, block_precond);
+ Vec.push[postcond](postconds, block_precond);
auto block_postcond = empty_poststate(nv);
/* conservative approximation */
if (! has_nonlocal_exits(b)) {
@@ -1696,7 +1696,7 @@ fn find_pre_post_state_expr(&fn_info_map fm, &fn_info enclosing,
changed = find_pre_post_state_expr(fm, enclosing, pres, e) || changed;
auto e_post = expr_poststate(e);
auto a_post;
- if (_vec.len[arm](alts) > 0u) {
+ if (Vec.len[arm](alts) > 0u) {
a_post = false_postcond(num_local_vars);
for (arm an_alt in alts) {
changed = find_pre_post_state_block(fm, enclosing, e_post,
@@ -1775,9 +1775,9 @@ fn find_pre_post_state_stmt(&fn_info_map fm, &fn_info enclosing,
log("*At beginning: stmt = ");
log_stmt(*s);
log("*prestate = ");
- log(bitv.to_str(stmt_ann.states.prestate));
+ log(BitV.to_str(stmt_ann.states.prestate));
log("*poststate =");
- log(bitv.to_str(stmt_ann.states.poststate));
+ log(BitV.to_str(stmt_ann.states.poststate));
log("*changed =");
log(changed);
@@ -1798,7 +1798,7 @@ fn find_pre_post_state_stmt(&fn_info_map fm, &fn_info enclosing,
log("Summary: stmt = ");
log_stmt(*s);
log("prestate = ");
- log(bitv.to_str(stmt_ann.states.prestate));
+ log(BitV.to_str(stmt_ann.states.prestate));
log_bitv(enclosing, stmt_ann.states.prestate);
log("poststate =");
log_bitv(enclosing, stmt_ann.states.poststate);
@@ -1835,10 +1835,10 @@ fn find_pre_post_state_stmt(&fn_info_map fm, &fn_info enclosing,
log("Summary: stmt = ");
log_stmt(*s);
log("prestate = ");
- log(bitv.to_str(stmt_ann.states.prestate));
+ log(BitV.to_str(stmt_ann.states.prestate));
log_bitv(enclosing, stmt_ann.states.prestate);
log("poststate =");
- log(bitv.to_str(stmt_ann.states.poststate));
+ log(BitV.to_str(stmt_ann.states.poststate));
log_bitv(enclosing, stmt_ann.states.poststate);
log("changed =");
log(changed);
@@ -1986,12 +1986,12 @@ fn check_states_against_conditions(fn_info enclosing, &ast._fn f) -> () {
}
auto do_one = bind do_one_(enclosing, _);
- _vec.map[@stmt, ()](do_one, f.body.node.stmts);
+ Vec.map[@stmt, ()](do_one, f.body.node.stmts);
fn do_inner_(fn_info i, &@expr e) -> () {
check_states_expr(i, e);
}
auto do_inner = bind do_inner_(enclosing, _);
- option.map[@expr, ()](do_inner, f.body.node.expr);
+ Option.map[@expr, ()](do_inner, f.body.node.expr);
}
@@ -2027,13 +2027,13 @@ fn check_method_states(&fn_info_map f_info_map, @method m) -> () {
}
fn check_obj_state(&fn_info_map f_info_map, vec[obj_field] fields,
- vec[@method] methods, option.t[@method] dtor) -> ast._obj {
+ vec[@method] methods, Option.t[@method] dtor) -> ast._obj {
fn one(fn_info_map fm, &@method m) -> () {
ret check_method_states(fm, m);
}
auto f = bind one(f_info_map,_);
- _vec.map[@method, ()](f, methods);
- option.map[@method, ()](f, dtor);
+ Vec.map[@method, ()](f, methods);
+ Option.map[@method, ()](f, dtor);
ret rec(fields=fields, methods=methods, dtor=dtor);
}
@@ -2122,7 +2122,7 @@ fn annotate_exprs(&fn_info_map fm, &vec[@expr] es) -> vec[@expr] {
ret annotate_expr(fm, e);
}
auto f = bind one(fm,_);
- ret _vec.map[@expr, @expr](f, es);
+ ret Vec.map[@expr, @expr](f, es);
}
fn annotate_elts(&fn_info_map fm, &vec[elt] es) -> vec[elt] {
fn one(fn_info_map fm, &elt e) -> elt {
@@ -2130,7 +2130,7 @@ fn annotate_elts(&fn_info_map fm, &vec[elt] es) -> vec[elt] {
expr=annotate_expr(fm, e.expr));
}
auto f = bind one(fm,_);
- ret _vec.map[elt, elt](f, es);
+ ret Vec.map[elt, elt](f, es);
}
fn annotate_fields(&fn_info_map fm, &vec[field] fs) -> vec[field] {
fn one(fn_info_map fm, &field f) -> field {
@@ -2139,23 +2139,23 @@ fn annotate_fields(&fn_info_map fm, &vec[field] fs) -> vec[field] {
expr=annotate_expr(fm, f.expr));
}
auto f = bind one(fm,_);
- ret _vec.map[field, field](f, fs);
+ ret Vec.map[field, field](f, fs);
}
-fn annotate_option_exp(&fn_info_map fm, &option.t[@expr] o)
- -> option.t[@expr] {
+fn annotate_option_exp(&fn_info_map fm, &Option.t[@expr] o)
+ -> Option.t[@expr] {
fn one(fn_info_map fm, &@expr e) -> @expr {
ret annotate_expr(fm, e);
}
auto f = bind one(fm,_);
- ret option.map[@expr, @expr](f, o);
+ ret Option.map[@expr, @expr](f, o);
}
-fn annotate_option_exprs(&fn_info_map fm, &vec[option.t[@expr]] es)
- -> vec[option.t[@expr]] {
- fn one(fn_info_map fm, &option.t[@expr] o) -> option.t[@expr] {
+fn annotate_option_exprs(&fn_info_map fm, &vec[Option.t[@expr]] es)
+ -> vec[Option.t[@expr]] {
+ fn one(fn_info_map fm, &Option.t[@expr] o) -> Option.t[@expr] {
ret annotate_option_exp(fm, o);
}
auto f = bind one(fm,_);
- ret _vec.map[option.t[@expr], option.t[@expr]](f, es);
+ ret Vec.map[Option.t[@expr], Option.t[@expr]](f, es);
}
fn annotate_decl(&fn_info_map fm, &@decl d) -> @decl {
auto d1 = d.node;
@@ -2163,7 +2163,7 @@ fn annotate_decl(&fn_info_map fm, &@decl d) -> @decl {
case (decl_local(?l)) {
alt(l.init) {
case (some[initializer](?init)) {
- let option.t[initializer] an_i =
+ let Option.t[initializer] an_i =
some[initializer]
(rec(expr=annotate_expr(fm, init.expr)
with init));
@@ -2186,7 +2186,7 @@ fn annotate_alts(&fn_info_map fm, &vec[arm] alts) -> vec[arm] {
index=a.index);
}
auto f = bind one(fm,_);
- ret _vec.map[arm, arm](f, alts);
+ ret Vec.map[arm, arm](f, alts);
}
fn annotate_expr(&fn_info_map fm, &@expr e) -> @expr {
@@ -2338,7 +2338,7 @@ fn annotate_block(&fn_info_map fm, &block b) -> block {
for (@stmt s in b.node.stmts) {
auto new_s = annotate_stmt(fm, s);
- _vec.push[@stmt](new_stmts, new_s);
+ Vec.push[@stmt](new_stmts, new_s);
ast.index_stmt(new_index, new_s);
}
fn ann_e(fn_info_map fm, &@expr e) -> @expr {
@@ -2346,7 +2346,7 @@ fn annotate_block(&fn_info_map fm, &block b) -> block {
}
auto f = bind ann_e(fm,_);
- auto new_e = option.map[@expr, @expr](f, b.node.expr);
+ auto new_e = Option.map[@expr, @expr](f, b.node.expr);
ret respan(b.span,
rec(stmts=new_stmts, expr=new_e, index=new_index with b.node));
@@ -2362,7 +2362,7 @@ fn annotate_mod(&fn_info_map fm, &ast._mod m) -> ast._mod {
for (@item i in m.items) {
auto new_i = annotate_item(fm, i);
- _vec.push[@item](new_items, new_i);
+ Vec.push[@item](new_items, new_i);
ast.index_item(new_index, new_i);
}
ret rec(items=new_items, index=new_index with m);
@@ -2383,8 +2383,8 @@ fn annotate_obj(&fn_info_map fm, &ast._obj o) -> ast._obj {
ret annotate_method(fm, m);
}
auto f = bind one(fm,_);
- auto new_methods = _vec.map[@method, @method](f, o.methods);
- auto new_dtor = option.map[@method, @method](f, o.dtor);
+ auto new_methods = Vec.map[@method, @method](f, o.methods);
+ auto new_dtor = Option.map[@method, @method](f, o.dtor);
ret rec(methods=new_methods, dtor=new_dtor with o);
}
@@ -2476,7 +2476,7 @@ fn annotate_module(&fn_info_map fm, &ast._mod module) -> ast._mod {
for (@item i in module.items) {
auto new_item = annotate_item(fm, i);
- _vec.push[@item](new_items, new_item);
+ Vec.push[@item](new_items, new_item);
ast.index_item(new_index, new_item);
}
diff --git a/src/comp/middle/walk.rs b/src/comp/middle/walk.rs
index 8a5d40dc..2df69261 100644
--- a/src/comp/middle/walk.rs
+++ b/src/comp/middle/walk.rs
@@ -1,8 +1,8 @@
import front.ast;
-import std.option;
-import std.option.some;
-import std.option.none;
+import std.Option;
+import std.Option.some;
+import std.Option.none;
type ast_visitor =
rec(fn () -> bool keep_going,
@@ -257,7 +257,7 @@ fn walk_decl(&ast_visitor v, @ast.decl d) {
v.visit_decl_post(d);
}
-fn walk_expr_opt(&ast_visitor v, option.t[@ast.expr] eo) {
+fn walk_expr_opt(&ast_visitor v, Option.t[@ast.expr] eo) {
alt (eo) {
case (none[@ast.expr]) {}
case (some[@ast.expr](?e)) {
@@ -297,7 +297,7 @@ fn walk_expr(&ast_visitor v, @ast.expr e) {
case (ast.expr_self_method(_, _)) { }
case (ast.expr_bind(?callee, ?args, _)) {
walk_expr(v, callee);
- for (option.t[@ast.expr] eo in args) {
+ for (Option.t[@ast.expr] eo in args) {
walk_expr_opt(v, eo);
}
}