Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fb7ba477
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,发现更多精彩内容 >>
提交
fb7ba477
编写于
5月 12, 2017
作者:
N
Nick Cameron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass crate attributes in visit.rs
上级
67a0d27c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
12 addition
and
12 deletion
+12
-12
src/librustc/lint/context.rs
src/librustc/lint/context.rs
+1
-1
src/librustc_passes/hir_stats.rs
src/librustc_passes/hir_stats.rs
+1
-1
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/dump_visitor.rs
+3
-5
src/libsyntax/util/node_count.rs
src/libsyntax/util/node_count.rs
+1
-1
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+5
-3
src/libsyntax_ext/proc_macro_registrar.rs
src/libsyntax_ext/proc_macro_registrar.rs
+1
-1
未找到文件。
src/librustc/lint/context.rs
浏览文件 @
fb7ba477
...
...
@@ -1055,7 +1055,7 @@ fn visit_ident(&mut self, sp: Span, id: ast::Ident) {
run_lints!
(
self
,
check_ident
,
early_passes
,
sp
,
id
);
}
fn
visit_mod
(
&
mut
self
,
m
:
&
'a
ast
::
Mod
,
s
:
Span
,
n
:
ast
::
NodeId
)
{
fn
visit_mod
(
&
mut
self
,
m
:
&
'a
ast
::
Mod
,
s
:
Span
,
_
a
:
&
[
ast
::
Attribute
],
n
:
ast
::
NodeId
)
{
run_lints!
(
self
,
check_mod
,
early_passes
,
m
,
s
,
n
);
ast_visit
::
walk_mod
(
self
,
m
);
run_lints!
(
self
,
check_mod_post
,
early_passes
,
m
,
s
,
n
);
...
...
src/librustc_passes/hir_stats.rs
浏览文件 @
fb7ba477
...
...
@@ -252,7 +252,7 @@ fn visit_macro_def(&mut self, macro_def: &'v hir::MacroDef) {
impl
<
'v
>
ast_visit
::
Visitor
<
'v
>
for
StatCollector
<
'v
>
{
fn
visit_mod
(
&
mut
self
,
m
:
&
'v
ast
::
Mod
,
_
s
:
Span
,
_
n
:
NodeId
)
{
fn
visit_mod
(
&
mut
self
,
m
:
&
'v
ast
::
Mod
,
_
s
:
Span
,
_
a
:
&
[
ast
::
Attribute
],
_
n
:
NodeId
)
{
self
.record
(
"Mod"
,
Id
::
None
,
m
);
ast_visit
::
walk_mod
(
self
,
m
)
}
...
...
src/librustc_save_analysis/dump_visitor.rs
浏览文件 @
fb7ba477
...
...
@@ -1211,7 +1211,7 @@ fn process_impl_item(&mut self, impl_item: &'l ast::ImplItem, impl_id: DefId) {
}
impl
<
'l
,
'tcx
:
'l
,
'll
,
D
:
Dump
+
'll
>
Visitor
<
'l
>
for
DumpVisitor
<
'l
,
'tcx
,
'll
,
D
>
{
fn
visit_mod
(
&
mut
self
,
m
:
&
'l
ast
::
Mod
,
span
:
Span
,
id
:
NodeId
)
{
fn
visit_mod
(
&
mut
self
,
m
:
&
'l
ast
::
Mod
,
span
:
Span
,
attrs
:
&
[
ast
::
Attribute
],
id
:
NodeId
)
{
// Since we handle explicit modules ourselves in visit_item, this should
// only get called for the root module of a crate.
assert_eq!
(
id
,
ast
::
CRATE_NODE_ID
);
...
...
@@ -1229,11 +1229,9 @@ fn visit_mod(&mut self, m: &'l ast::Mod, span: Span, id: NodeId) {
filename
:
filename
,
items
:
m
.items
.iter
()
.map
(|
i
|
i
.id
)
.collect
(),
visibility
:
Visibility
::
Public
,
// TODO Visitor doesn't pass us the attibutes.
docs
:
String
::
new
(),
docs
:
docs_for_attrs
(
attrs
),
sig
:
None
,
// TODO Visitor doesn't pass us the attibutes.
attributes
:
vec!
[],
attributes
:
attrs
.to_owned
(),
}
.lower
(
self
.tcx
));
self
.nest_scope
(
id
,
|
v
|
visit
::
walk_mod
(
v
,
m
));
}
...
...
src/libsyntax/util/node_count.rs
浏览文件 @
fb7ba477
...
...
@@ -31,7 +31,7 @@ fn visit_ident(&mut self, span: Span, ident: Ident) {
self
.count
+=
1
;
walk_ident
(
self
,
span
,
ident
);
}
fn
visit_mod
(
&
mut
self
,
m
:
&
Mod
,
_
s
:
Span
,
_
n
:
NodeId
)
{
fn
visit_mod
(
&
mut
self
,
m
:
&
Mod
,
_
s
:
Span
,
_
a
:
&
[
Attribute
],
_
n
:
NodeId
)
{
self
.count
+=
1
;
walk_mod
(
self
,
m
)
}
...
...
src/libsyntax/visit.rs
浏览文件 @
fb7ba477
...
...
@@ -56,7 +56,9 @@ fn visit_name(&mut self, _span: Span, _name: Name) {
fn
visit_ident
(
&
mut
self
,
span
:
Span
,
ident
:
Ident
)
{
walk_ident
(
self
,
span
,
ident
);
}
fn
visit_mod
(
&
mut
self
,
m
:
&
'ast
Mod
,
_
s
:
Span
,
_
n
:
NodeId
)
{
walk_mod
(
self
,
m
)
}
fn
visit_mod
(
&
mut
self
,
m
:
&
'ast
Mod
,
_
s
:
Span
,
_
attrs
:
&
[
Attribute
],
_
n
:
NodeId
)
{
walk_mod
(
self
,
m
);
}
fn
visit_foreign_item
(
&
mut
self
,
i
:
&
'ast
ForeignItem
)
{
walk_foreign_item
(
self
,
i
)
}
fn
visit_global_asm
(
&
mut
self
,
ga
:
&
'ast
GlobalAsm
)
{
walk_global_asm
(
self
,
ga
)
}
fn
visit_item
(
&
mut
self
,
i
:
&
'ast
Item
)
{
walk_item
(
self
,
i
)
}
...
...
@@ -172,7 +174,7 @@ pub fn walk_ident<'a, V: Visitor<'a>>(visitor: &mut V, span: Span, ident: Ident)
}
pub
fn
walk_crate
<
'a
,
V
:
Visitor
<
'a
>>
(
visitor
:
&
mut
V
,
krate
:
&
'a
Crate
)
{
visitor
.visit_mod
(
&
krate
.module
,
krate
.span
,
CRATE_NODE_ID
);
visitor
.visit_mod
(
&
krate
.module
,
krate
.span
,
&
krate
.attrs
,
CRATE_NODE_ID
);
walk_list!
(
visitor
,
visit_attribute
,
&
krate
.attrs
);
}
...
...
@@ -249,7 +251,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
item
.id
)
}
ItemKind
::
Mod
(
ref
module
)
=>
{
visitor
.visit_mod
(
module
,
item
.span
,
item
.id
)
visitor
.visit_mod
(
module
,
item
.span
,
&
item
.attrs
,
item
.id
)
}
ItemKind
::
ForeignMod
(
ref
foreign_module
)
=>
{
walk_list!
(
visitor
,
visit_foreign_item
,
&
foreign_module
.items
);
...
...
src/libsyntax_ext/proc_macro_registrar.rs
浏览文件 @
fb7ba477
...
...
@@ -329,7 +329,7 @@ fn visit_item(&mut self, item: &'a ast::Item) {
visit
::
walk_item
(
self
,
item
);
}
fn
visit_mod
(
&
mut
self
,
m
:
&
'a
ast
::
Mod
,
_
s
:
Span
,
id
:
NodeId
)
{
fn
visit_mod
(
&
mut
self
,
m
:
&
'a
ast
::
Mod
,
_
s
:
Span
,
_
a
:
&
[
ast
::
Attribute
],
id
:
NodeId
)
{
let
mut
prev_in_root
=
self
.in_root
;
if
id
!=
ast
::
CRATE_NODE_ID
{
prev_in_root
=
mem
::
replace
(
&
mut
self
.in_root
,
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录