Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
348d07f0
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
348d07f0
编写于
9月 20, 2012
作者:
G
Graydon Hoare
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove export_map from resolve, just use export_map2.
上级
69aaa410
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
21 addition
and
79 deletion
+21
-79
src/rustc/driver/driver.rs
src/rustc/driver/driver.rs
+1
-2
src/rustc/metadata/encoder.rs
src/rustc/metadata/encoder.rs
+0
-3
src/rustc/middle/resolve.rs
src/rustc/middle/resolve.rs
+1
-20
src/rustc/middle/trans/base.rs
src/rustc/middle/trans/base.rs
+1
-21
src/rustc/middle/trans/common.rs
src/rustc/middle/trans/common.rs
+0
-1
src/rustc/middle/trans/reachable.rs
src/rustc/middle/trans/reachable.rs
+18
-32
未找到文件。
src/rustc/driver/driver.rs
浏览文件 @
348d07f0
...
...
@@ -201,7 +201,6 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
middle
::
lang_items
::
collect_language_items
(
crate
,
sess
));
let
{
def_map
:
def_map
,
exp_map
:
exp_map
,
exp_map2
:
exp_map2
,
trait_map
:
trait_map
}
=
time
(
time_passes
,
~
"resolution"
,
||
...
...
@@ -266,7 +265,7 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
let
(
llmod
,
link_meta
)
=
time
(
time_passes
,
~
"translation"
,
||
trans
::
base
::
trans_crate
(
sess
,
crate
,
ty_cx
,
&
outputs
.obj_filename
,
exp_map
,
exp_map
2
,
maps
));
exp_map2
,
maps
));
time
(
time_passes
,
~
"LLVM passes"
,
||
link
::
write
::
run_passes
(
sess
,
llmod
,
...
...
src/rustc/metadata/encoder.rs
浏览文件 @
348d07f0
...
...
@@ -47,7 +47,6 @@
diag
:
span_handler
,
tcx
:
ty
::
ctxt
,
reachable
:
HashMap
<
ast
::
node_id
,
()
>
,
reexports
:
~
[(
~
str
,
def_id
)],
reexports2
:
middle
::
resolve
::
ExportMap2
,
item_symbols
:
HashMap
<
ast
::
node_id
,
~
str
>
,
discrim_symbols
:
HashMap
<
ast
::
node_id
,
~
str
>
,
...
...
@@ -73,7 +72,6 @@ enum encode_ctxt = {
tcx
:
ty
::
ctxt
,
stats
:
stats
,
reachable
:
HashMap
<
ast
::
node_id
,
()
>
,
reexports
:
~
[(
~
str
,
def_id
)],
reexports2
:
middle
::
resolve
::
ExportMap2
,
item_symbols
:
HashMap
<
ast
::
node_id
,
~
str
>
,
discrim_symbols
:
HashMap
<
ast
::
node_id
,
~
str
>
,
...
...
@@ -1108,7 +1106,6 @@ fn encode_metadata(parms: encode_parms, crate: @crate) -> ~[u8] {
tcx
:
parms
.tcx
,
stats
:
move
stats
,
reachable
:
parms
.reachable
,
reexports
:
parms
.reexports
,
reexports2
:
parms
.reexports2
,
item_symbols
:
parms
.item_symbols
,
discrim_symbols
:
parms
.discrim_symbols
,
...
...
src/rustc/middle/resolve.rs
浏览文件 @
348d07f0
...
...
@@ -91,10 +91,6 @@ struct binding_info {
// Trait method resolution
type
TraitMap
=
@
HashMap
<
node_id
,
@
DVec
<
def_id
>>
;
// Export mapping
type
Export
=
{
reexp
:
bool
,
id
:
def_id
};
type
ExportMap
=
HashMap
<
node_id
,
~
[
Export
]
>
;
// This is the replacement export map. It maps a module to all of the exports
// within.
type
ExportMap2
=
HashMap
<
node_id
,
~
[
Export2
]
>
;
...
...
@@ -775,7 +771,6 @@ fn Resolver(session: session, lang_items: LanguageItems,
namespaces
:
~
[
ModuleNS
,
TypeNS
,
ValueNS
],
def_map
:
HashMap
(),
export_map
:
HashMap
(),
export_map2
:
HashMap
(),
trait_map
:
@
HashMap
(),
...
...
@@ -833,7 +828,6 @@ struct Resolver {
namespaces
:
~
[
Namespace
],
def_map
:
DefMap
,
export_map
:
ExportMap
,
export_map2
:
ExportMap2
,
trait_map
:
TraitMap
,
}
...
...
@@ -2880,8 +2874,7 @@ fn record_exports_for_module_subtree(module_: @Module) {
fn
record_exports_for_module
(
module_
:
@
Module
)
{
let
mut
exports2
=
~
[];
for
module_
.exported_names.each
|
name
,
node_id
|
{
let
mut
exports
=
~
[];
for
module_
.exported_names.each
|
name
,
_
exp_node_id
|
{
for
self
.namespaces.each
|
namespace
|
{
match
self
.resolve_definition_of_name_in_module
(
module_
,
name
,
...
...
@@ -2895,10 +2888,6 @@ fn record_exports_for_module(module_: @Module) {
for %?"
,
self
.session
.str_of
(
name
),
module_
.def_id
);
vec
::
push
(
exports
,
{
reexp
:
false
,
id
:
def_id_of_def
(
target_def
)
});
vec
::
push
(
exports2
,
Export2
{
reexport
:
false
,
name
:
self
.session
.str_of
(
name
),
...
...
@@ -2910,10 +2899,6 @@ fn record_exports_for_module(module_: @Module) {
%?"
,
self
.session
.str_of
(
name
),
module_
.def_id
);
vec
::
push
(
exports
,
{
reexp
:
true
,
id
:
def_id_of_def
(
target_def
)
});
vec
::
push
(
exports2
,
Export2
{
reexport
:
true
,
name
:
self
.session
.str_of
(
name
),
...
...
@@ -2922,8 +2907,6 @@ fn record_exports_for_module(module_: @Module) {
}
}
}
self
.export_map
.insert
(
node_id
,
exports
);
}
match
copy
module_
.def_id
{
...
...
@@ -4914,7 +4897,6 @@ fn dump_module(module_: @Module) {
/// Entry point to crate resolution.
fn
resolve_crate
(
session
:
session
,
lang_items
:
LanguageItems
,
crate
:
@
crate
)
->
{
def_map
:
DefMap
,
exp_map
:
ExportMap
,
exp_map2
:
ExportMap2
,
trait_map
:
TraitMap
}
{
...
...
@@ -4922,7 +4904,6 @@ fn resolve_crate(session: session, lang_items: LanguageItems, crate: @crate)
resolver
.resolve
(
resolver
);
return
{
def_map
:
resolver
.def_map
,
exp_map
:
resolver
.export_map
,
exp_map2
:
resolver
.export_map2
,
trait_map
:
resolver
.trait_map
};
...
...
src/rustc/middle/trans/base.rs
浏览文件 @
348d07f0
...
...
@@ -2504,7 +2504,6 @@ fn crate_ctxt_to_encode_parms(cx: @crate_ctxt)
diag
:
cx
.sess
.diagnostic
(),
tcx
:
cx
.tcx
,
reachable
:
cx
.reachable
,
reexports
:
reexports
(
cx
),
reexports2
:
cx
.exp_map2
,
item_symbols
:
cx
.item_symbols
,
discrim_symbols
:
cx
.discrim_symbols
,
...
...
@@ -2512,23 +2511,6 @@ fn crate_ctxt_to_encode_parms(cx: @crate_ctxt)
cstore
:
cx
.sess.cstore
,
encode_inlined_item
:
encode_inlined_item
};
fn
reexports
(
cx
:
@
crate_ctxt
)
->
~
[(
~
str
,
ast
::
def_id
)]
{
let
mut
reexports
=
~
[];
for
cx
.exp_map.each
|
exp_id
,
defs
|
{
for
defs
.each
|
def
|
{
if
!
def
.reexp
{
loop
;
}
let
path
=
match
cx
.tcx.items
.get
(
exp_id
)
{
ast_map
::
node_export
(
_
,
path
)
=>
{
ast_map
::
path_to_str
(
*
path
,
cx
.sess.parse_sess.interner
)
}
_
=>
fail
~
"reexports"
};
vec
::
push
(
reexports
,
(
path
,
def
.id
));
}
}
return
reexports
;
}
}
fn
write_metadata
(
cx
:
@
crate_ctxt
,
crate
:
@
ast
::
crate
)
{
...
...
@@ -2564,7 +2546,6 @@ fn trans_crate(sess: session::session,
crate
:
@
ast
::
crate
,
tcx
:
ty
::
ctxt
,
output
:
&
Path
,
emap
:
resolve
::
ExportMap
,
emap2
:
resolve
::
ExportMap2
,
maps
:
astencode
::
maps
)
->
(
ModuleRef
,
link_meta
)
{
...
...
@@ -2572,7 +2553,7 @@ fn trans_crate(sess: session::session,
let
symbol_hasher
=
@
hash
::
default_state
();
let
link_meta
=
link
::
build_link_meta
(
sess
,
*
crate
,
output
,
symbol_hasher
);
let
reachable
=
reachable
::
find_reachable
(
crate
.node.module
,
emap
,
tcx
,
let
reachable
=
reachable
::
find_reachable
(
crate
.node.module
,
emap
2
,
tcx
,
maps
.method_map
);
// Append ".rc" to crate name as LLVM module identifier.
...
...
@@ -2626,7 +2607,6 @@ fn trans_crate(sess: session::session,
externs
:
HashMap
::
<~
str
,
ValueRef
>
(),
intrinsics
:
intrinsics
,
item_vals
:
HashMap
::
<
int
,
ValueRef
>
(),
exp_map
:
emap
,
exp_map2
:
emap2
,
reachable
:
reachable
,
item_symbols
:
HashMap
::
<
int
,
~
str
>
(),
...
...
src/rustc/middle/trans/common.rs
浏览文件 @
348d07f0
...
...
@@ -117,7 +117,6 @@ fn BuilderRef_res(B: BuilderRef) -> BuilderRef_res {
externs
:
HashMap
<~
str
,
ValueRef
>
,
intrinsics
:
HashMap
<~
str
,
ValueRef
>
,
item_vals
:
HashMap
<
ast
::
node_id
,
ValueRef
>
,
exp_map
:
resolve
::
ExportMap
,
exp_map2
:
resolve
::
ExportMap2
,
reachable
:
reachable
::
map
,
item_symbols
:
HashMap
<
ast
::
node_id
,
~
str
>
,
...
...
src/rustc/middle/trans/reachable.rs
浏览文件 @
348d07f0
...
...
@@ -17,47 +17,33 @@
type
map
=
std
::
map
::
HashMap
<
node_id
,
()
>
;
type
ctx
=
{
exp_map
:
resolve
::
ExportMap
,
type
ctx
=
{
exp_map
2
:
resolve
::
ExportMap2
,
tcx
:
ty
::
ctxt
,
method_map
:
typeck
::
method_map
,
rmap
:
map
};
fn
find_reachable
(
crate_mod
:
_
mod
,
exp_map
:
resolve
::
ExportMap
,
fn
find_reachable
(
crate_mod
:
_
mod
,
exp_map
2
:
resolve
::
ExportMap2
,
tcx
:
ty
::
ctxt
,
method_map
:
typeck
::
method_map
)
->
map
{
let
rmap
=
std
::
map
::
HashMap
();
let
cx
=
{
exp_map
:
exp_map
,
tcx
:
tcx
,
method_map
:
method_map
,
rmap
:
rmap
};
traverse_public_mod
(
cx
,
crate_mod
);
let
cx
=
{
exp_map2
:
exp_map2
,
tcx
:
tcx
,
method_map
:
method_map
,
rmap
:
rmap
};
traverse_public_mod
(
cx
,
ast
::
crate_node_id
,
crate_mod
);
traverse_all_resources_and_impls
(
cx
,
crate_mod
);
rmap
}
fn
traverse_exports
(
cx
:
ctx
,
vis
:
~
[
@
view_item
]
)
->
bool
{
fn
traverse_exports
(
cx
:
ctx
,
mod_id
:
node_id
)
->
bool
{
let
mut
found_export
=
false
;
for
vec
::
each
(
vis
)
|
vi
|
{
match
vi
.node
{
view_item_export
(
vps
)
=>
{
match
cx
.exp_map2
.find
(
mod_id
)
{
Some
(
exp2s
)
=>
{
for
exp2s
.each
|
e2
|
{
found_export
=
true
;
for
vec
::
each
(
vps
)
|
vp
|
{
match
vp
.node
{
view_path_simple
(
_
,
_
,
_
,
id
)
|
view_path_glob
(
_
,
id
)
|
view_path_list
(
_
,
_
,
id
)
=>
{
traverse_export
(
cx
,
id
);
}
}
}
}
_
=>
()
}
}
found_export
}
fn
traverse_export
(
cx
:
ctx
,
exp_id
:
node_id
)
{
do
option
::
iter
(
cx
.exp_map
.find
(
exp_id
))
|
defs
|
{
for
vec
::
each
(
defs
)
|
def
|
{
traverse_def_id
(
cx
,
def
.id
);
}
traverse_def_id
(
cx
,
e2
.def_id
)
};
}
None
=>
()
}
return
found_export
;
}
fn
traverse_def_id
(
cx
:
ctx
,
did
:
def_id
)
{
...
...
@@ -81,8 +67,8 @@ fn traverse_def_id(cx: ctx, did: def_id) {
}
}
fn
traverse_public_mod
(
cx
:
ctx
,
m
:
_
mod
)
{
if
!
traverse_exports
(
cx
,
m
.view_items
)
{
fn
traverse_public_mod
(
cx
:
ctx
,
m
od_id
:
node_id
,
m
:
_
mod
)
{
if
!
traverse_exports
(
cx
,
m
od_id
)
{
// No exports, so every local item is exported
for
vec
::
each
(
m
.items
)
|
item
|
{
traverse_public_item
(
cx
,
*
item
);
...
...
@@ -94,9 +80,9 @@ fn traverse_public_item(cx: ctx, item: @item) {
if
cx
.rmap
.contains_key
(
item
.id
)
{
return
;
}
cx
.rmap
.insert
(
item
.id
,
());
match
item
.node
{
item_mod
(
m
)
=>
traverse_public_mod
(
cx
,
m
),
item_mod
(
m
)
=>
traverse_public_mod
(
cx
,
item
.id
,
m
),
item_foreign_mod
(
nm
)
=>
{
if
!
traverse_exports
(
cx
,
nm
.view_items
)
{
if
!
traverse_exports
(
cx
,
item
.id
)
{
for
vec
::
each
(
nm
.items
)
|
item
|
{
cx
.rmap
.insert
(
item
.id
,
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录