Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fc67d8fa
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,发现更多精彩内容 >>
提交
fc67d8fa
编写于
8月 31, 2018
作者:
N
Nick Cameron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Give each PathSegment a NodeId
上级
8ec22e7e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
7 deletion
+19
-7
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+8
-2
src/libsyntax/ext/build.rs
src/libsyntax/ext/build.rs
+6
-2
src/libsyntax/fold.rs
src/libsyntax/fold.rs
+3
-1
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+2
-2
未找到文件。
src/libsyntax/ast.rs
浏览文件 @
fc67d8fa
...
@@ -129,6 +129,8 @@ pub struct PathSegment {
...
@@ -129,6 +129,8 @@ pub struct PathSegment {
/// The identifier portion of this path segment.
/// The identifier portion of this path segment.
pub
ident
:
Ident
,
pub
ident
:
Ident
,
pub
id
:
NodeId
,
/// Type/lifetime parameters attached to this path. They come in
/// Type/lifetime parameters attached to this path. They come in
/// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`.
/// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`.
/// `None` means that no parameter list is supplied (`Path`),
/// `None` means that no parameter list is supplied (`Path`),
...
@@ -140,10 +142,14 @@ pub struct PathSegment {
...
@@ -140,10 +142,14 @@ pub struct PathSegment {
impl
PathSegment
{
impl
PathSegment
{
pub
fn
from_ident
(
ident
:
Ident
)
->
Self
{
pub
fn
from_ident
(
ident
:
Ident
)
->
Self
{
PathSegment
{
ident
,
args
:
None
}
PathSegment
{
ident
,
id
:
DUMMY_NODE_ID
,
args
:
None
}
}
}
pub
fn
crate_root
(
span
:
Span
)
->
Self
{
pub
fn
crate_root
(
span
:
Span
)
->
Self
{
PathSegment
::
from_ident
(
Ident
::
new
(
keywords
::
CrateRoot
.name
(),
span
))
PathSegment
{
ident
:
Ident
::
new
(
keywords
::
CrateRoot
.name
(),
span
),
id
:
CRATE_NODE_ID
,
args
:
None
,
}
}
}
}
}
...
...
src/libsyntax/ext/build.rs
浏览文件 @
fc67d8fa
...
@@ -329,7 +329,11 @@ fn path_all(&self,
...
@@ -329,7 +329,11 @@ fn path_all(&self,
}
else
{
}
else
{
None
None
};
};
segments
.push
(
ast
::
PathSegment
{
ident
:
last_ident
.with_span_pos
(
span
),
args
});
segments
.push
(
ast
::
PathSegment
{
ident
:
last_ident
.with_span_pos
(
span
),
id
:
ast
::
DUMMY_NODE_ID
,
args
,
});
let
mut
path
=
ast
::
Path
{
span
,
segments
};
let
mut
path
=
ast
::
Path
{
span
,
segments
};
if
global
{
if
global
{
if
let
Some
(
seg
)
=
path
.make_root
()
{
if
let
Some
(
seg
)
=
path
.make_root
()
{
...
@@ -366,7 +370,7 @@ fn qpath_all(&self,
...
@@ -366,7 +370,7 @@ fn qpath_all(&self,
}
else
{
}
else
{
None
None
};
};
path
.segments
.push
(
ast
::
PathSegment
{
ident
,
args
});
path
.segments
.push
(
ast
::
PathSegment
{
ident
,
id
:
ast
::
DUMMY_NODE_ID
,
args
});
(
ast
::
QSelf
{
(
ast
::
QSelf
{
ty
:
self_type
,
ty
:
self_type
,
...
...
src/libsyntax/fold.rs
浏览文件 @
fc67d8fa
...
@@ -468,8 +468,9 @@ pub fn noop_fold_usize<T: Folder>(i: usize, _: &mut T) -> usize {
...
@@ -468,8 +468,9 @@ pub fn noop_fold_usize<T: Folder>(i: usize, _: &mut T) -> usize {
pub
fn
noop_fold_path
<
T
:
Folder
>
(
Path
{
segments
,
span
}:
Path
,
fld
:
&
mut
T
)
->
Path
{
pub
fn
noop_fold_path
<
T
:
Folder
>
(
Path
{
segments
,
span
}:
Path
,
fld
:
&
mut
T
)
->
Path
{
Path
{
Path
{
segments
:
segments
.move_map
(|
PathSegment
{
ident
,
args
}|
PathSegment
{
segments
:
segments
.move_map
(|
PathSegment
{
ident
,
id
,
args
}|
PathSegment
{
ident
:
fld
.fold_ident
(
ident
),
ident
:
fld
.fold_ident
(
ident
),
id
:
fld
.new_id
(
id
),
args
:
args
.map
(|
args
|
args
.map
(|
args
|
fld
.fold_generic_args
(
args
))),
args
:
args
.map
(|
args
|
args
.map
(|
args
|
fld
.fold_generic_args
(
args
))),
}),
}),
span
:
fld
.new_span
(
span
)
span
:
fld
.new_span
(
span
)
...
@@ -1234,6 +1235,7 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span, attrs}: Expr, folder: &mu
...
@@ -1234,6 +1235,7 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span, attrs}: Expr, folder: &mu
ExprKind
::
MethodCall
(
ExprKind
::
MethodCall
(
PathSegment
{
PathSegment
{
ident
:
folder
.fold_ident
(
seg
.ident
),
ident
:
folder
.fold_ident
(
seg
.ident
),
id
:
folder
.new_id
(
seg
.id
),
args
:
seg
.args
.map
(|
args
|
{
args
:
seg
.args
.map
(|
args
|
{
args
.map
(|
args
|
folder
.fold_generic_args
(
args
))
args
.map
(|
args
|
folder
.fold_generic_args
(
args
))
}),
}),
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
fc67d8fa
...
@@ -2134,10 +2134,10 @@ fn parse_path_segment(&mut self, style: PathStyle, enable_warning: bool)
...
@@ -2134,10 +2134,10 @@ fn parse_path_segment(&mut self, style: PathStyle, enable_warning: bool)
ParenthesisedArgs
{
inputs
,
output
,
span
}
.into
()
ParenthesisedArgs
{
inputs
,
output
,
span
}
.into
()
};
};
PathSegment
{
ident
,
args
}
PathSegment
{
ident
,
args
,
id
:
ast
::
DUMMY_NODE_ID
}
}
else
{
}
else
{
// Generic arguments are not found.
// Generic arguments are not found.
PathSegment
::
from_ident
(
ident
)
PathSegment
::
from_ident
(
ident
,
)
})
})
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录