Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9769b612
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,发现更多精彩内容 >>
提交
9769b612
编写于
11月 24, 2010
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc: Parse type-parametric typedefs
上级
98e8c2ef
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
14 deletion
+18
-14
src/comp/front/ast.rs
src/comp/front/ast.rs
+1
-1
src/comp/front/parser.rs
src/comp/front/parser.rs
+4
-2
src/comp/middle/fold.rs
src/comp/middle/fold.rs
+8
-6
src/comp/middle/resolve.rs
src/comp/middle/resolve.rs
+1
-1
src/comp/middle/typeck.rs
src/comp/middle/typeck.rs
+4
-4
未找到文件。
src/comp/front/ast.rs
浏览文件 @
9769b612
...
...
@@ -170,7 +170,7 @@
tag
item_
{
item_fn
(
ident
,
_
fn
,
vec
[
ty_param
],
def_id
,
ann
);
item_mod
(
ident
,
_
mod
,
def_id
);
item_ty
(
ident
,
@
ty
,
def_id
,
ann
);
item_ty
(
ident
,
@
ty
,
vec
[
ty_param
],
def_id
,
ann
);
item_tag
(
ident
,
vec
[
variant
],
vec
[
ty_param
],
def_id
);
}
...
...
src/comp/front/parser.rs
浏览文件 @
9769b612
...
...
@@ -1026,7 +1026,7 @@ fn spanned[T](&span lo, &span hi, &T node) -> ast.spanned[T] {
case
(
ast
.item_mod
(
?
i
,
_
,
_
))
{
index
.insert
(
i
,
u
-
1u
);
}
case
(
ast
.item_ty
(
?
i
,
_
,
_
,
_
))
{
case
(
ast
.item_ty
(
?
i
,
_
,
_
,
_
,
_
))
{
index
.insert
(
i
,
u
-
1u
);
}
}
...
...
@@ -1112,11 +1112,13 @@ fn spanned[T](&span lo, &span hi, &T node) -> ast.spanned[T] {
auto
lo
=
p
.get_span
();
expect
(
p
,
token
.TYPE
);
auto
id
=
parse_ident
(
p
);
auto
tps
=
parse_ty_params
(
p
);
expect
(
p
,
token
.EQ
);
auto
ty
=
parse_ty
(
p
);
auto
hi
=
p
.get_span
();
expect
(
p
,
token
.SEMI
);
auto
item
=
ast
.item_ty
(
id
,
ty
,
p
.next_def_id
(),
ast
.ann_none
);
auto
item
=
ast
.item_ty
(
id
,
ty
,
tps
,
p
.next_def_id
(),
ast
.ann_none
);
ret
tup
(
id
,
@
spanned
(
lo
,
hi
,
item
));
}
...
...
src/comp/middle/fold.rs
浏览文件 @
9769b612
...
...
@@ -166,7 +166,8 @@
&
ast
._mod
m
,
def_id
id
)
->
@
item
)
fold_item_mod
,
(
fn
(
&
ENV
e
,
&
span
sp
,
ident
ident
,
@
ty
t
,
def_id
id
,
ann
a
)
->
@
item
)
fold_item_ty
,
@
ty
t
,
vec
[
ast
.ty_param
]
ty_params
,
def_id
id
,
ann
a
)
->
@
item
)
fold_item_ty
,
(
fn
(
&
ENV
e
,
&
span
sp
,
ident
ident
,
vec
[
ast
.variant
]
variants
,
...
...
@@ -550,9 +551,9 @@ fn fold_item[ENV](&ENV env, ast_fold[ENV] fld, @item i) -> @item {
ret
fld
.fold_item_mod
(
env_
,
i
.span
,
ident
,
mm_
,
id
);
}
case
(
ast
.item_ty
(
?
ident
,
?
ty
,
?
id
,
?
ann
))
{
case
(
ast
.item_ty
(
?
ident
,
?
ty
,
?
params
,
?
id
,
?
ann
))
{
let
@
ast
.ty
ty_
=
fold_ty
[
ENV
](
env_
,
fld
,
ty
);
ret
fld
.fold_item_ty
(
env_
,
i
.span
,
ident
,
ty_
,
id
,
ann
);
ret
fld
.fold_item_ty
(
env_
,
i
.span
,
ident
,
ty_
,
params
,
id
,
ann
);
}
case
(
ast
.item_tag
(
?
ident
,
?
variants
,
?
ty_params
,
?
id
))
{
...
...
@@ -813,8 +814,9 @@ fn identity_fold_item_mod[ENV](&ENV e, &span sp, ident i,
}
fn
identity_fold_item_ty
[
ENV
](
&
ENV
e
,
&
span
sp
,
ident
i
,
@
ty
t
,
def_id
id
,
ann
a
)
->
@
item
{
ret
@
respan
(
sp
,
ast
.item_ty
(
i
,
t
,
id
,
a
));
@
ty
t
,
vec
[
ast
.ty_param
]
ty_params
,
def_id
id
,
ann
a
)
->
@
item
{
ret
@
respan
(
sp
,
ast
.item_ty
(
i
,
t
,
ty_params
,
id
,
a
));
}
fn
identity_fold_item_tag
[
ENV
](
&
ENV
e
,
&
span
sp
,
ident
i
,
...
...
@@ -941,7 +943,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
fold_item_fn
=
bind
identity_fold_item_fn
[
ENV
](
_
,
_
,
_
,
_
,
_
,
_
,
_
),
fold_item_mod
=
bind
identity_fold_item_mod
[
ENV
](
_
,
_
,
_
,
_
,
_
),
fold_item_ty
=
bind
identity_fold_item_ty
[
ENV
](
_
,
_
,
_
,
_
,
_
,
_
),
fold_item_ty
=
bind
identity_fold_item_ty
[
ENV
](
_
,
_
,
_
,
_
,
_
,
_
,
_
),
fold_item_tag
=
bind
identity_fold_item_tag
[
ENV
](
_
,
_
,
_
,
_
,
_
,
_
),
fold_block
=
bind
identity_fold_block
[
ENV
](
_
,
_
,
_
),
...
...
src/comp/middle/resolve.rs
浏览文件 @
9769b612
...
...
@@ -35,7 +35,7 @@ fn found_def_item(@ast.item i) -> option.t[def] {
case
(
ast
.item_mod
(
_
,
_
,
?
id
))
{
ret
some
[
def
](
ast
.def_mod
(
id
));
}
case
(
ast
.item_ty
(
_
,
_
,
?
id
,
_
))
{
case
(
ast
.item_ty
(
_
,
_
,
_
,
?
id
,
_
))
{
ret
some
[
def
](
ast
.def_ty
(
id
));
}
}
...
...
src/comp/middle/typeck.rs
浏览文件 @
9769b612
...
...
@@ -326,7 +326,7 @@ fn trans_ty_item_to_ty(@hashmap[ast.def_id,@ast.item] id_to_ty_item,
ret
t_fn
;
}
case
(
ast
.item_ty
(
?
ident
,
?
referent_ty
,
?
def_id
,
_
))
{
case
(
ast
.item_ty
(
?
ident
,
?
referent_ty
,
_
,
?
def_id
,
_
))
{
if
(
item_to_ty
.contains_key
(
def_id
))
{
// Avoid repeating work.
check
(
item_to_ty
.contains_key
(
def_id
));
...
...
@@ -351,7 +351,7 @@ fn trans_ty_item_to_ty(@hashmap[ast.def_id,@ast.item] id_to_ty_item,
auto
id_to_ty_item
=
@
common
.new_def_hash
[
@
ast
.item
]();
for
(
@
ast
.item
item
in
module
.items
)
{
alt
(
item
.node
)
{
case
(
ast
.item_ty
(
_
,
_
,
?
def_id
,
_
))
{
case
(
ast
.item_ty
(
_
,
_
,
_
,
?
def_id
,
_
))
{
id_to_ty_item
.insert
(
def_id
,
item
);
}
case
(
_
)
{
/* empty */
}
...
...
@@ -371,10 +371,10 @@ fn trans_ty_item_to_ty(@hashmap[ast.def_id,@ast.item] id_to_ty_item,
result
=
ast
.item_fn
(
ident
,
fn_info
,
tps
,
def_id
,
ast
.ann_type
(
t
));
}
case
(
ast
.item_ty
(
?
ident
,
?
referent_ty
,
?
def_id
,
_
))
{
case
(
ast
.item_ty
(
?
ident
,
?
referent_ty
,
?
tps
,
?
def_id
,
_
))
{
auto
t
=
trans_ty_item_to_ty
(
id_to_ty_item
,
item_to_ty
,
it
);
auto
ann
=
ast
.ann_type
(
t
);
result
=
ast
.item_ty
(
ident
,
referent_ty
,
def_id
,
ann
);
result
=
ast
.item_ty
(
ident
,
referent_ty
,
tps
,
def_id
,
ann
);
}
case
(
ast
.item_mod
(
_
,
_
,
_
))
{
result
=
it
.node
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录