Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
8e24091f
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,发现更多精彩内容 >>
提交
8e24091f
编写于
8月 06, 2015
作者:
V
Victor Berger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Factor inc/dec count methods.
上级
75167593
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
9 deletion
+30
-9
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+3
-3
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+24
-0
src/librustc_resolve/resolve_imports.rs
src/librustc_resolve/resolve_imports.rs
+3
-6
未找到文件。
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
8e24091f
...
...
@@ -928,7 +928,7 @@ fn build_import_directive(&mut self,
self
.unresolved_imports
+=
1
;
if
is_public
{
module_
.
pub_count
.set
(
module_
.pub_count
.get
()
+
1
);
module_
.
inc_pub_count
(
);
}
// Bump the reference count on the name. Or, if this is a glob, set
...
...
@@ -963,9 +963,9 @@ fn build_import_directive(&mut self,
// Set the glob flag. This tells us that we don't know the
// module's exports ahead of time.
module_
.
glob_count
.set
(
module_
.glob_count
.get
()
+
1
);
module_
.
inc_glob_count
(
);
if
is_public
{
module_
.
pub_glob_count
.set
(
module_
.pub_glob_count
.get
()
+
1
);
module_
.
inc_pub_glob_count
(
);
}
}
}
...
...
src/librustc_resolve/lib.rs
浏览文件 @
8e24091f
...
...
@@ -749,6 +749,30 @@ fn all_imports_resolved(&self) -> bool {
}
}
impl
Module
{
pub
fn
inc_glob_count
(
&
self
)
{
self
.glob_count
.set
(
self
.glob_count
.get
()
+
1
);
}
pub
fn
dec_glob_count
(
&
self
)
{
assert
!
(
self
.glob_count
.get
()
>
0
);
self
.glob_count
.set
(
self
.glob_count
.get
()
-
1
);
}
pub
fn
inc_pub_count
(
&
self
)
{
self
.pub_count
.set
(
self
.pub_count
.get
()
+
1
);
}
pub
fn
dec_pub_count
(
&
self
)
{
assert
!
(
self
.pub_count
.get
()
>
0
);
self
.pub_count
.set
(
self
.pub_count
.get
()
-
1
);
}
pub
fn
inc_pub_glob_count
(
&
self
)
{
self
.pub_glob_count
.set
(
self
.pub_glob_count
.get
()
+
1
);
}
pub
fn
dec_pub_glob_count
(
&
self
)
{
assert
!
(
self
.pub_glob_count
.get
()
>
0
);
self
.pub_glob_count
.set
(
self
.pub_glob_count
.get
()
-
1
);
}
}
impl
fmt
::
Debug
for
Module
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"{:?}, kind: {:?}, {}"
,
...
...
src/librustc_resolve/resolve_imports.rs
浏览文件 @
8e24091f
...
...
@@ -407,11 +407,9 @@ fn resolve_import_for_module(&mut self,
if
resolution_result
.success
()
{
match
import_directive
.subclass
{
GlobImport
=>
{
assert
!
(
module_
.glob_count
.get
()
>=
1
);
module_
.glob_count
.set
(
module_
.glob_count
.get
()
-
1
);
module_
.dec_glob_count
();
if
import_directive
.is_public
{
assert
!
(
module_
.pub_glob_count
.get
()
>=
1
);
module_
.pub_glob_count
.set
(
module_
.pub_glob_count
.get
()
-
1
);
module_
.dec_pub_glob_count
();
}
}
SingleImport
(
..
)
=>
{
...
...
@@ -419,8 +417,7 @@ fn resolve_import_for_module(&mut self,
}
}
if
import_directive
.is_public
{
assert
!
(
module_
.pub_count
.get
()
>=
1
);
module_
.pub_count
.set
(
module_
.pub_count
.get
()
-
1
);
module_
.dec_pub_count
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录