Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
0bed9aea
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,发现更多精彩内容 >>
提交
0bed9aea
编写于
3月 02, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make populate_module_if_necessary a method of resolver
上级
77f0f4a6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
20 deletion
+16
-20
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+13
-15
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+2
-2
src/librustc_resolve/resolve_imports.rs
src/librustc_resolve/resolve_imports.rs
+1
-3
未找到文件。
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
0bed9aea
...
...
@@ -532,16 +532,6 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'b>, xcd
}
}
/// Ensures that the reduced graph rooted at the given external module
/// is built, building it if it is not.
fn
populate_module_if_necessary
(
&
mut
self
,
module
:
Module
<
'b
>
)
{
if
module
.populated
.get
()
{
return
}
for
child
in
self
.session.cstore
.item_children
(
module
.def_id
()
.unwrap
())
{
self
.build_reduced_graph_for_external_crate_def
(
module
,
child
);
}
module
.populated
.set
(
true
)
}
/// Builds the reduced graph rooted at the 'use' directive for an external
/// crate.
fn
build_reduced_graph_for_external_crate
(
&
mut
self
,
root
:
Module
<
'b
>
)
{
...
...
@@ -585,6 +575,19 @@ fn build_import_directive(&mut self,
}
}
impl
<
'a
,
'tcx
>
Resolver
<
'a
,
'tcx
>
{
/// Ensures that the reduced graph rooted at the given external module
/// is built, building it if it is not.
pub
fn
populate_module_if_necessary
(
&
mut
self
,
module
:
Module
<
'a
>
)
{
if
module
.populated
.get
()
{
return
}
let
mut
builder
=
GraphBuilder
{
resolver
:
self
};
for
child
in
self
.session.cstore
.item_children
(
module
.def_id
()
.unwrap
())
{
builder
.build_reduced_graph_for_external_crate_def
(
module
,
child
);
}
module
.populated
.set
(
true
)
}
}
struct
BuildReducedGraphVisitor
<
'a
,
'b
:
'a
,
'tcx
:
'b
>
{
builder
:
GraphBuilder
<
'a
,
'b
,
'tcx
>
,
parent
:
Module
<
'b
>
,
...
...
@@ -617,8 +620,3 @@ fn visit_block(&mut self, block: &Block) {
pub
fn
build_reduced_graph
(
resolver
:
&
mut
Resolver
,
krate
:
&
hir
::
Crate
)
{
GraphBuilder
{
resolver
:
resolver
}
.build_reduced_graph
(
krate
);
}
pub
fn
populate_module_if_necessary
<
'a
,
'tcx
>
(
resolver
:
&
mut
Resolver
<
'a
,
'tcx
>
,
module
:
Module
<
'a
>
)
{
GraphBuilder
{
resolver
:
resolver
}
.populate_module_if_necessary
(
module
);
}
src/librustc_resolve/lib.rs
浏览文件 @
0bed9aea
...
...
@@ -1542,7 +1542,7 @@ fn resolve_name_in_module(&mut self,
->
ResolveResult
<&
'a
NameBinding
<
'a
>>
{
debug!
(
"(resolving name in module) resolving `{}` in `{}`"
,
name
,
module_to_string
(
module
));
build_reduced_graph
::
populate_module_if_necessary
(
self
,
module
);
self
.populate_module_if_necessary
(
module
);
match
use_lexical_scope
{
true
=>
module
.resolve_name_in_lexical_scope
(
name
,
namespace
)
.map
(
Success
)
.unwrap_or
(
Failed
(
None
)),
...
...
@@ -3363,7 +3363,7 @@ fn lookup_candidates<FilterFn>(&mut self,
while
let
Some
((
in_module
,
path_segments
,
in_module_is_extern
))
=
worklist
.pop
()
{
build_reduced_graph
::
populate_module_if_necessary
(
self
,
&
in_module
);
self
.populate_module_if_necessary
(
in_module
);
in_module
.for_each_child
(|
name
,
ns
,
name_binding
|
{
...
...
src/librustc_resolve/resolve_imports.rs
浏览文件 @
0bed9aea
...
...
@@ -21,8 +21,6 @@
use
{
names_to_string
,
module_to_string
};
use
{
resolve_error
,
ResolutionError
};
use
build_reduced_graph
;
use
rustc
::
lint
;
use
rustc
::
middle
::
def
::
*
;
...
...
@@ -610,7 +608,7 @@ fn resolve_glob_import(&mut self,
let
msg
=
"Cannot glob-import a module into itself."
.into
();
return
Failed
(
Some
((
directive
.span
,
msg
)));
}
build_reduced_graph
::
populate_module_if_necessary
(
self
.resolver
,
target_module
);
self
.resolver
.populate_module_if_necessary
(
target_module
);
if
directive
.is_prelude
{
*
module_
.prelude
.borrow_mut
()
=
Some
(
target_module
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录