Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9f955384
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,发现更多精彩内容 >>
提交
9f955384
编写于
5月 26, 2011
作者:
G
Graydon Hoare
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove redisue of unused fields from 'ann'.
上级
2561b012
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
6 addition
and
52 deletion
+6
-52
src/comp/front/ast.rs
src/comp/front/ast.rs
+1
-4
src/comp/front/parser.rs
src/comp/front/parser.rs
+1
-4
src/comp/middle/ty.rs
src/comp/middle/ty.rs
+0
-22
src/comp/middle/typeck.rs
src/comp/middle/typeck.rs
+4
-22
未找到文件。
src/comp/front/ast.rs
浏览文件 @
9f955384
...
...
@@ -20,10 +20,7 @@
type
ty_param
=
ident
;
// Annotations added during successive passes.
type
ann
=
rec
(
uint
id
,
middle
::
ty
::
t
ty
,
option
::
t
[
vec
[
middle
::
ty
::
t
]]
tps
);
type
ann
=
rec
(
uint
id
);
tag
def
{
def_fn
(
def_id
);
...
...
src/comp/front/parser.rs
浏览文件 @
9f955384
...
...
@@ -146,10 +146,7 @@ fn get_bad_expr_words() -> std::map::hashmap[str, ()] {
fn
get_chpos
()
->
uint
{
ret
rdr
.get_chpos
();}
fn
get_ann
()
->
ast
::
ann
{
// TODO: Remove ty and tps, which should be unused
// by now.
auto
rv
=
rec
(
id
=
next_ann_var
,
ty
=
0u
,
tps
=
none
[
vec
[
middle
::
ty
::
t
]]);
auto
rv
=
rec
(
id
=
next_ann_var
);
next_ann_var
+=
1u
;
ret
rv
;
}
...
...
src/comp/middle/ty.rs
浏览文件 @
9f955384
...
...
@@ -1572,28 +1572,6 @@ fn ann_to_monotype(&ctxt cx, ast::ann a) -> t {
}
// Turns a type and optional type parameters into an annotation, using
// defaults for other fields.
fn
mk_ann_type
(
uint
node_id
,
t
typ
,
option
::
t
[
vec
[
t
]]
tps
)
->
ast
::
ann
{
ret
rec
(
id
=
node_id
,
ty
=
typ
,
tps
=
tps
);
}
// Turns a type into an annotation, using defaults for other fields.
fn
triv_ann
(
uint
node_id
,
t
typ
)
->
ast
::
ann
{
ret
mk_ann_type
(
node_id
,
typ
,
none
[
vec
[
t
]]);
}
// Creates a nil type annotation.
fn
plain_ann
(
uint
node_id
,
ctxt
tcx
)
->
ast
::
ann
{
ret
triv_ann
(
node_id
,
mk_nil
(
tcx
));
}
// Creates a _|_ type annotation.
fn
bot_ann
(
uint
node_id
,
ctxt
tcx
)
->
ast
::
ann
{
ret
triv_ann
(
node_id
,
mk_bot
(
tcx
));
}
// Returns the number of distinct type parameters in the given type.
fn
count_ty_params
(
&
ctxt
cx
,
t
ty
)
->
uint
{
fn
counter
(
&
ctxt
cx
,
@
mutable
vec
[
uint
]
param_indices
,
t
ty
)
{
...
...
src/comp/middle/typeck.rs
浏览文件 @
9f955384
...
...
@@ -16,17 +16,13 @@
import
middle
::
ty
::
expr_ty
;
import
middle
::
ty
::
field
;
import
middle
::
ty
::
method
;
import
middle
::
ty
::
mk_ann_type
;
import
middle
::
ty
::
mo_val
;
import
middle
::
ty
::
mo_alias
;
import
middle
::
ty
::
mo_either
;
import
middle
::
ty
::
node_type_table
;
import
middle
::
ty
::
pat_ty
;
import
middle
::
ty
::
path_to_str
;
import
middle
::
ty
::
plain_ann
;
import
middle
::
ty
::
bot_ann
;
import
middle
::
ty
::
struct
;
import
middle
::
ty
::
triv_ann
;
import
middle
::
ty
::
ty_param_substs_opt_and_ty
;
import
middle
::
ty
::
ty_to_str
;
import
middle
::
ty
::
type_is_integral
;
...
...
@@ -645,9 +641,7 @@ fn ty_of_native_item(&@ctxt cx, &@ast::native_item it,
fn
get_tag_variant_types
(
&@
ctxt
cx
,
&
ast
::
def_id
tag_id
,
&
vec
[
ast
::
variant
]
variants
,
&
vec
[
ast
::
ty_param
]
ty_params
)
->
vec
[
ast
::
variant
]
{
let
vec
[
ast
::
variant
]
result
=
[];
&
vec
[
ast
::
ty_param
]
ty_params
)
{
// Create a set of parameter types shared among all the variants.
let
vec
[
ty
::
t
]
ty_param_tys
=
[];
...
...
@@ -682,17 +676,10 @@ fn get_tag_variant_types(&@ctxt cx, &ast::def_id tag_id,
auto
tpt
=
tup
(
ty_param_count
,
result_ty
);
cx
.tcx.tcache
.insert
(
variant
.node.id
,
tpt
);
auto
variant_t
=
rec
(
ann
=
triv_ann
(
variant
.node.ann.id
,
result_ty
)
with
variant
.node
);
write
::
ty_only
(
cx
.tcx
,
variant
.node.ann.id
,
result_ty
);
result
+=
[
common
::
respan
(
variant
.span
,
variant_t
)];
}
ret
result
;
}
fn
get_obj_method_types
(
&@
ctxt
cx
,
&
ast
::
_
obj
object
)
->
vec
[
ty
::
method
]
{
ret
vec
::
map
[
@
ast
::
method
,
method
](
bind
ty_of_method
(
cx
,
_
),
object
.methods
);
...
...
@@ -1184,13 +1171,10 @@ fn pushdown_pat(&@stmt_ctxt scx, &ty::t expected, &@ast::pat pat) {
let
ty_param_substs_and_ty
res_t
=
demand
::
full
(
scx
,
pat
.span
,
expected
,
tt
,
tps
,
NO_AUTODEREF
);
auto
a_1
=
mk_ann_type
(
ann
.id
,
res_t
._1
,
some
[
vec
[
ty
::
t
]](
res_t
._0
));
// TODO: push down type from "expected".
write
::
ty_fixup
(
scx
,
ann
.id
,
ty
::
ann_to_ty_param_substs_opt_and_ty
(
scx
.fcx.ccx.tcx.node_types
,
a
_1
));
(
scx
.fcx.ccx.tcx.node_types
,
a
nn
));
}
}
}
...
...
@@ -1691,8 +1675,7 @@ fn check_pat(&@stmt_ctxt scx, &@ast::pat pat) {
}
case
(
ast
::
pat_bind
(
?
id
,
?
def_id
,
?
a
))
{
auto
typ
=
next_ty_var
(
scx
);
auto
ann
=
triv_ann
(
a
.id
,
typ
);
write
::
ty_only_fixup
(
scx
,
ann
.id
,
typ
);
write
::
ty_only_fixup
(
scx
,
a
.id
,
typ
);
}
case
(
ast
::
pat_tag
(
?
p
,
?
subpats
,
?
old_ann
))
{
auto
vdef
=
ast
::
variant_def_ids
...
...
@@ -1882,7 +1865,6 @@ fn check_assignment(&@stmt_ctxt scx, &@ast::expr lhs, &@ast::expr rhs,
pushdown
::
pushdown_expr
(
scx
,
lhs_t1
,
rhs
);
auto
rhs_t1
=
expr_ty
(
scx
.fcx.ccx.tcx
,
rhs
);
auto
ann
=
triv_ann
(
a
.id
,
rhs_t1
);
write
::
ty_only_fixup
(
scx
,
a
.id
,
rhs_t1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录