Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6db9a8c5
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,发现更多精彩内容 >>
提交
6db9a8c5
编写于
12月 19, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: De-`@mut` `resolve::Module::def_id`
上级
d503fff2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
14 deletion
+20
-14
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+20
-14
未找到文件。
src/librustc/middle/resolve.rs
浏览文件 @
6db9a8c5
...
...
@@ -416,7 +416,7 @@ enum ModuleKind {
/// One node in the tree of modules.
struct
Module
{
parent_link
:
ParentLink
,
def_id
:
Option
<
DefId
>
,
def_id
:
Cell
<
Option
<
DefId
>
>
,
kind
:
Cell
<
ModuleKind
>
,
is_public
:
bool
,
...
...
@@ -467,7 +467,7 @@ fn new(parent_link: ParentLink,
->
Module
{
Module
{
parent_link
:
parent_link
,
def_id
:
def_id
,
def_id
:
Cell
::
new
(
def_id
)
,
kind
:
Cell
::
new
(
kind
),
is_public
:
is_public
,
children
:
@
mut
HashMap
::
new
(),
...
...
@@ -668,7 +668,7 @@ fn def_for_namespace(&self, namespace: Namespace) -> Option<Def> {
None
=>
{
match
type_def
.module_def
{
Some
(
module
)
=>
{
match
module
.def_id
{
match
module
.def_id
.get
()
{
Some
(
did
)
=>
Some
(
DefMod
(
did
)),
None
=>
None
,
}
...
...
@@ -1591,7 +1591,7 @@ fn handle_external_def(&mut self,
let
is_public
=
vis
==
ast
::
public
;
let
is_exported
=
is_public
&&
match
new_parent
{
ModuleReducedGraphParent
(
module
)
=>
{
match
module
.def_id
{
match
module
.def_id
.get
()
{
None
=>
true
,
Some
(
did
)
=>
self
.external_exports
.contains
(
&
did
)
}
...
...
@@ -1607,7 +1607,7 @@ fn handle_external_def(&mut self,
Some
(
TypeNsDef
{
module_def
:
Some
(
module_def
),
..
})
=>
{
debug!
(
"(building reduced graph for external crate)
\
already created module"
);
module_def
.def_id
=
Some
(
def_id
);
module_def
.def_id
.set
(
Some
(
def_id
)
);
}
Some
(
_
)
|
None
=>
{
debug!
(
"(building reduced graph for
\
...
...
@@ -1869,7 +1869,7 @@ fn populate_external_module(&mut self, module: @mut Module) {
debug!
(
"(populating external module) attempting to populate {}"
,
self
.module_to_str
(
module
));
let
def_id
=
match
module
.def_id
{
let
def_id
=
match
module
.def_id
.get
()
{
None
=>
{
debug!
(
"(populating external module) ... no def ID!"
);
return
...
...
@@ -1904,7 +1904,10 @@ fn populate_module_if_necessary(&mut self, module: @mut Module) {
fn
build_reduced_graph_for_external_crate
(
&
mut
self
,
root
:
@
mut
Module
)
{
csearch
::
each_top_level_item_of_crate
(
self
.session.cstore
,
root
.def_id
.unwrap
()
.crate
,
root
.def_id
.get
()
.unwrap
()
.crate
,
|
def_like
,
ident
,
visibility
|
{
self
.build_reduced_graph_for_external_crate_def
(
root
,
def_like
,
...
...
@@ -2568,7 +2571,7 @@ fn resolve_glob_import(&mut self,
}
// Record the destination of this import
match
containing_module
.def_id
{
match
containing_module
.def_id
.get
()
{
Some
(
did
)
=>
{
self
.def_map
.insert
(
id
,
DefMod
(
did
));
self
.last_private
.insert
(
id
,
lp
);
...
...
@@ -2667,7 +2670,8 @@ fn resolve_module_path_from_root(&mut self,
// resolving this import chain.
if
!
used_proxy
&&
!
search_module
.is_public
{
match
search_module
.def_id
{
match
search_module
.def_id
.get
()
{
Some
(
did
)
=>
{
closest_private
=
DependsOn
(
did
);
...
...
@@ -2787,7 +2791,9 @@ fn resolve_module_path(&mut self,
Success
(
PrefixFound
(
containing_module
,
index
))
=>
{
search_module
=
containing_module
;
start_index
=
index
;
last_private
=
DependsOn
(
containing_module
.def_id
.unwrap
());
last_private
=
DependsOn
(
containing_module
.def_id
.get
()
.unwrap
());
}
}
...
...
@@ -3196,7 +3202,7 @@ fn record_exports_for_module_subtree(&mut self,
// If this isn't a local crate, then bail out. We don't need to record
// exports for nonlocal crates.
match
module_
.def_id
{
match
module_
.def_id
.get
()
{
Some
(
def_id
)
if
def_id
.crate
==
LOCAL_CRATE
=>
{
// OK. Continue.
debug!
(
"(recording exports for module subtree) recording
\
...
...
@@ -3241,7 +3247,7 @@ fn record_exports_for_module(&mut self, module_: @mut Module) {
let
mut
exports2
=
~
[];
self
.add_exports_for_module
(
&
mut
exports2
,
module_
);
match
module_
.def_id
{
match
module_
.def_id
.get
()
{
Some
(
def_id
)
=>
{
self
.export_map2
.insert
(
def_id
.node
,
exports2
);
debug!
(
"(computing exports) writing exports for {} (some)"
,
...
...
@@ -4644,7 +4650,7 @@ fn resolve_definition_of_name_in_module(&mut self,
match
containing_module
.external_module_children
.find
(
&
name
.name
)
{
None
=>
{}
Some
(
module
)
=>
{
match
module
.def_id
{
match
module
.def_id
.get
()
{
None
=>
{}
// Continue.
Some
(
def_id
)
=>
{
let
lp
=
if
module
.is_public
{
AllPublic
}
else
{
...
...
@@ -4707,7 +4713,7 @@ fn resolve_module_relative_path(&mut self,
TraitModuleKind
|
ImplModuleKind
=>
{
match
self
.method_map
.find
(
&
ident
.name
)
{
Some
(
s
)
=>
{
match
containing_module
.def_id
{
match
containing_module
.def_id
.get
()
{
Some
(
def_id
)
if
s
.contains
(
&
def_id
)
=>
{
debug!
(
"containing module was a trait or impl
\
and name was a method -> not resolved"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录