Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2edc4195
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,发现更多精彩内容 >>
提交
2edc4195
编写于
7月 09, 2012
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc: Allow import resolutions to be inferred from external crates in resolve3
上级
0ee1a717
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
4 deletion
+50
-4
src/rustc/middle/resolve3.rs
src/rustc/middle/resolve3.rs
+50
-4
未找到文件。
src/rustc/middle/resolve3.rs
浏览文件 @
2edc4195
...
...
@@ -24,7 +24,8 @@
import
syntax
::
ast
::{
ty_u8
,
ty_uint
,
variant
,
view_item
,
view_item_export
};
import
syntax
::
ast
::{
view_item_import
,
view_item_use
,
view_path_glob
};
import
syntax
::
ast
::{
view_path_list
,
view_path_simple
};
import
syntax
::
ast_util
::{
def_id_of_def
,
local_def
,
new_def_hash
,
walk_pat
};
import
syntax
::
ast_util
::{
def_id_of_def
,
dummy_sp
,
local_def
,
new_def_hash
};
import
syntax
::
ast_util
::{
walk_pat
};
import
syntax
::
attr
::{
attr_metas
,
contains_name
};
import
syntax
::
codemap
::
span
;
import
syntax
::
visit
::{
default_visitor
,
fk_method
,
mk_vt
,
visit_block
};
...
...
@@ -1163,6 +1164,8 @@ fn build_reduced_graph_for_block(block: blk,
* crate.
*/
fn
build_reduced_graph_for_external_crate
(
root
:
@
Module
)
{
let
modules
=
new_def_hash
();
// Create all the items reachable by paths.
for
each_path
(
self
.session.cstore
,
get
(
root
.def_id
)
.crate
)
|
path_entry
|
{
...
...
@@ -1220,15 +1223,58 @@ fn build_reduced_graph_for_external_crate(root: @Module) {
let
parent_link
=
self
.get_parent_link
(
new_parent
,
atom
);
(
*
child_name_bindings
)
.
define_module
(
parent_link
,
some
(
def_id
));
alt
modules
.find
(
def_id
)
{
none
{
(
*
child_name_bindings
)
.
define_module
(
parent_link
,
some
(
def_id
));
modules
.insert
(
def_id
,
(
*
child_name_bindings
)
.
get_module
());
}
some
(
existing_module
)
{
// Create an import resolution to
// avoid creating cycles in the
// module graph.
let
resolution
=
@
ImportResolution
(
dummy_sp
());
resolution
.
outstanding_references
=
0
;
alt
existing_module
.parent_link
{
NoParentLink
|
BlockParentLink
(
*
)
{
fail
"can't happen"
;
}
ModuleParentLink
(
parent_module
,
atom
)
{
let
name_bindings
=
parent_module
.
children
.get
(
atom
);
resolution
.module_target
=
some
(
Target
(
parent_module
,
name_bindings
));
}
}
new_parent
.import_resolutions
.
insert
(
atom
,
resolution
);
}
}
}
ModuleDef
(
module
)
{
#
debug
(
"(building reduced graph for
\
external crate) already created
\
module"
);
module
.def_id
=
some
(
def_id
);
modules
.insert
(
def_id
,
module
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录