Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
eedb9510
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,发现更多精彩内容 >>
提交
eedb9510
编写于
9月 28, 2015
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fill in some missing parts in the default AST visitor
+ Add helper macro for walking lists (including Options)
上级
9e11845d
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
275 addition
and
357 deletion
+275
-357
src/librustc/lint/context.rs
src/librustc/lint/context.rs
+2
-6
src/librustc/lint/mod.rs
src/librustc/lint/mod.rs
+1
-5
src/librustc_trans/save/dump_csv.rs
src/librustc_trans/save/dump_csv.rs
+5
-5
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+7
-0
src/libsyntax/ast_util.rs
src/libsyntax/ast_util.rs
+2
-2
src/libsyntax/owned_slice.rs
src/libsyntax/owned_slice.rs
+9
-0
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+249
-339
未找到文件。
src/librustc/lint/context.rs
浏览文件 @
eedb9510
...
...
@@ -898,12 +898,8 @@ fn visit_impl_item(&mut self, impl_item: &ast::ImplItem) {
});
}
fn
visit_opt_lifetime_ref
(
&
mut
self
,
sp
:
Span
,
lt
:
&
Option
<
ast
::
Lifetime
>
)
{
run_lints!
(
self
,
check_opt_lifetime_ref
,
early_passes
,
sp
,
lt
);
}
fn
visit_lifetime_ref
(
&
mut
self
,
lt
:
&
ast
::
Lifetime
)
{
run_lints!
(
self
,
check_lifetime_ref
,
early_passes
,
lt
);
fn
visit_lifetime
(
&
mut
self
,
lt
:
&
ast
::
Lifetime
)
{
run_lints!
(
self
,
check_lifetime
,
early_passes
,
lt
);
}
fn
visit_lifetime_def
(
&
mut
self
,
lt
:
&
ast
::
LifetimeDef
)
{
...
...
src/librustc/lint/mod.rs
浏览文件 @
eedb9510
...
...
@@ -199,11 +199,7 @@ fn check_struct_def_post(&mut self, _: &EarlyContext,
fn
check_struct_field
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
&
ast
::
StructField
)
{
}
fn
check_variant
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
&
ast
::
Variant
,
_
:
&
ast
::
Generics
)
{
}
fn
check_variant_post
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
&
ast
::
Variant
,
_
:
&
ast
::
Generics
)
{
}
fn
check_opt_lifetime_ref
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
Span
,
_
:
&
Option
<
ast
::
Lifetime
>
)
{
}
fn
check_lifetime_ref
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
&
ast
::
Lifetime
)
{
}
fn
check_lifetime
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
&
ast
::
Lifetime
)
{
}
fn
check_lifetime_def
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
&
ast
::
LifetimeDef
)
{
}
fn
check_explicit_self
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
&
ast
::
ExplicitSelf
)
{
}
fn
check_path
(
&
mut
self
,
_
:
&
EarlyContext
,
_
:
&
ast
::
Path
,
_
:
ast
::
NodeId
)
{
}
...
...
src/librustc_trans/save/dump_csv.rs
浏览文件 @
eedb9510
...
...
@@ -771,7 +771,7 @@ fn process_struct_lit(&mut self,
}
}
visit
::
walk_expr_opt
(
self
,
base
)
walk_list!
(
self
,
visit_expr
,
base
);
}
fn
process_method_call
(
&
mut
self
,
ex
:
&
ast
::
Expr
,
args
:
&
Vec
<
P
<
ast
::
Expr
>>
)
{
...
...
@@ -785,7 +785,7 @@ fn process_method_call(&mut self, ex: &ast::Expr, args: &Vec<P<ast::Expr>>) {
}
// walk receiver and args
visit
::
walk_exprs
(
self
,
&
args
);
walk_list!
(
self
,
visit_expr
,
args
);
}
fn
process_pat
(
&
mut
self
,
p
:
&
ast
::
Pat
)
{
...
...
@@ -1200,7 +1200,7 @@ fn visit_arm(&mut self, arm: &ast::Arm) {
for
&
(
id
,
ref
path
,
ref_kind
)
in
&
paths_to_process
{
self
.process_path
(
id
,
path
,
ref_kind
);
}
visit
::
walk_expr_opt
(
self
,
&
arm
.guard
);
walk_list!
(
self
,
visit_expr
,
&
arm
.guard
);
self
.visit_expr
(
&
arm
.body
);
}
...
...
@@ -1246,7 +1246,7 @@ fn visit_local(&mut self, l: &ast::Local) {
}
// Just walk the initialiser and type (don't want to walk the pattern again).
visit
::
walk_ty_opt
(
self
,
&
l
.ty
);
visit
::
walk_expr_opt
(
self
,
&
l
.init
);
walk_list!
(
self
,
visit_ty
,
&
l
.ty
);
walk_list!
(
self
,
visit_expr
,
&
l
.init
);
}
}
src/libsyntax/ast.rs
浏览文件 @
eedb9510
...
...
@@ -1613,6 +1613,13 @@ pub fn id(&self) -> NodeId {
}
}
pub
fn
name
(
&
self
)
->
Option
<
Ident
>
{
match
*
self
{
PathListIdent
{
name
,
..
}
=>
Some
(
name
),
PathListMod
{
..
}
=>
None
,
}
}
pub
fn
rename
(
&
self
)
->
Option
<
Ident
>
{
match
*
self
{
PathListIdent
{
rename
,
..
}
|
PathListMod
{
rename
,
..
}
=>
rename
...
...
src/libsyntax/ast_util.rs
浏览文件 @
eedb9510
...
...
@@ -476,12 +476,12 @@ fn visit_impl_item(&mut self, ii: &ast::ImplItem) {
visit
::
walk_impl_item
(
self
,
ii
);
}
fn
visit_lifetime
_ref
(
&
mut
self
,
lifetime
:
&
Lifetime
)
{
fn
visit_lifetime
(
&
mut
self
,
lifetime
:
&
Lifetime
)
{
self
.operation
.visit_id
(
lifetime
.id
);
}
fn
visit_lifetime_def
(
&
mut
self
,
def
:
&
LifetimeDef
)
{
self
.visit_lifetime
_ref
(
&
def
.lifetime
);
self
.visit_lifetime
(
&
def
.lifetime
);
}
fn
visit_trait_ref
(
&
mut
self
,
trait_ref
:
&
TraitRef
)
{
...
...
src/libsyntax/owned_slice.rs
浏览文件 @
eedb9510
...
...
@@ -12,6 +12,7 @@
use
std
::
fmt
;
use
std
::
iter
::{
IntoIterator
,
FromIterator
};
use
std
::
ops
::
Deref
;
use
std
::
slice
;
use
std
::
vec
;
use
serialize
::{
Encodable
,
Decodable
,
Encoder
,
Decoder
};
...
...
@@ -82,6 +83,14 @@ fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> OwnedSlice<T> {
}
}
impl
<
'a
,
T
>
IntoIterator
for
&
'a
OwnedSlice
<
T
>
{
type
Item
=
&
'a
T
;
type
IntoIter
=
slice
::
Iter
<
'a
,
T
>
;
fn
into_iter
(
self
)
->
Self
::
IntoIter
{
self
.data
.into_iter
()
}
}
impl
<
T
:
Encodable
>
Encodable
for
OwnedSlice
<
T
>
{
fn
encode
<
S
:
Encoder
>
(
&
self
,
s
:
&
mut
S
)
->
Result
<
(),
S
::
Error
>
{
Encodable
::
encode
(
&**
self
,
s
)
...
...
src/libsyntax/visit.rs
浏览文件 @
eedb9510
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录