Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
48467c4f
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,发现更多精彩内容 >>
提交
48467c4f
编写于
8月 02, 2011
作者:
L
Lindsey Kuper
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Comment tweaks and re-flows.
上级
f3714825
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
30 deletion
+24
-30
src/comp/middle/trans.rs
src/comp/middle/trans.rs
+24
-30
未找到文件。
src/comp/middle/trans.rs
浏览文件 @
48467c4f
...
...
@@ -1680,7 +1680,7 @@ fn inner(last_cx: @block_ctxt, load_inner: bool, flag: ValueRef,
}
// Used only for creating scalar compar
si
on glue.
// Used only for creating scalar compar
is
on glue.
tag
scalar_type
{
nil_type
;
signed_int
;
unsigned_int
;
floating_point
;
}
...
...
@@ -5662,19 +5662,14 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: &span, anon_obj: &ast::anon_obj,
let
vtbl
;
alt
anon_obj
.inner_obj
{
none
.
{
// If there's no inner_obj -- that is, if we're just adding new
// fields rather than extending an existing object -- then we just
// pass the outer object to create_vtbl(). Our vtable won't need
// to have any forwarding slots.
// We need a dummy inner_obj_ty for setting up the object body
// later.
inner_obj_ty
=
ty
::
mk_type
(
ccx
.tcx
);
//
This seems a little strange, because it'll come into
//
create_vtbl() with no "additional methods". What's happening
//
is that, since *all* of the methods are "additional", we can
//
get away with acting like none of them are
.
//
If there's no inner_obj -- that is, if we're just adding new
//
fields rather than extending an existing object -- then we just
//
pass the outer object to create_vtbl(). Our vtable won't need
//
to have any forwarding slots
.
vtbl
=
create_vtbl
(
bcx
.fcx.lcx
,
sp
,
outer_obj_ty
,
wrapper_obj
,
~
[],
none
,
additional_field_tys
);
...
...
@@ -6770,19 +6765,19 @@ fn create_vtbl(cx: @local_ctxt, sp: &span, outer_obj_ty: ty::t,
some
(
inner_obj_ty
)
{
// Handle forwarding slots.
// If this vtable is being created for an extended object, then
//
the vtable needs to contain 'forwarding slots' for methods that
//
were on the original object and are not being overloaded by the
//
extended one. So, to find the set of methods that we need
// for
warding slots for, we need to take the set difference of
//
inner_obj_methods (methods on the original object) and
// ob
.methods (methods on the ob
ject being added).
// If this vtable is being created for an extended object, then
the
//
vtable needs to contain 'forwarding slots' for methods that were on
//
the original object and are not being overloaded by the extended
//
one. So, to find the set of methods that we need forwarding slots
// for
, we need to take the set difference of inner_obj_methods
//
(methods on the original object) and ob.methods (methods on the
// object being added).
// If we're here, then inner_obj_ty and llinner_obj_ty are the type
//
of the inner object, and "ob" is the wrapper object. We need
//
to take apart inner_obj_ty (it had better have an object type
//
with methods!) and put those original methods onto the list of
//
methods
we need forwarding methods for.
// If we're here, then inner_obj_ty and llinner_obj_ty are the type
of
//
the inner object, and "ob" is the wrapper object. We need to take
//
apart inner_obj_ty (it had better have an object type with
//
methods!) and put those original methods onto the list of methods
// we need forwarding methods for.
// Gather up methods on the original object in 'meths'.
alt
ty
::
struct
(
cx
.ccx.tcx
,
inner_obj_ty
)
{
...
...
@@ -6806,12 +6801,11 @@ fn filtering_fn(cx: @local_ctxt, m: &vtbl_mthd,
alt
m
{
fwding_mthd
(
fm
)
{
// Since fm is a fwding_mthd, and we're checking to
// see if it's in addtl_meths (which only contains
// normal_mthds), we can't just check if fm is a
// member of addtl_meths. Instead, we have to go
// through addtl_meths and see if there's some method
// in it that has the same name as fm.
// Since fm is a fwding_mthd, and we're checking to see if
// it's in addtl_meths (which only contains normal_mthds), we
// can't just check if fm is a member of addtl_meths.
// Instead, we have to go through addtl_meths and see if
// there's some method in it that has the same name as fm.
for
am
:
@
ast
::
method
in
addtl_meths
{
if
str
::
eq
(
am
.node.ident
,
fm
.ident
)
{
ret
none
;
}
}
...
...
@@ -6828,8 +6822,8 @@ fn filtering_fn(cx: @local_ctxt, m: &vtbl_mthd,
meths
=
std
::
ivec
::
filter_map
[
vtbl_mthd
,
vtbl_mthd
](
f
,
meths
);
// And now add the additional ones (both replacements and entirely
//
new
ones). These'll just be normal methods.
// And now add the additional ones (both replacements and entirely
new
// ones). These'll just be normal methods.
for
m
:
@
ast
::
method
in
ob
.methods
{
meths
+=
~
[
normal_mthd
(
m
)];
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录