Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5d1257a7
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,发现更多精彩内容 >>
提交
5d1257a7
编写于
12月 19, 2014
作者:
E
Eduard Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc: middle: move TraitItemKind from resolve to def.
上级
d9504d4a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
28 deletion
+25
-28
src/librustc/metadata/csearch.rs
src/librustc/metadata/csearch.rs
+1
-2
src/librustc/metadata/decoder.rs
src/librustc/metadata/decoder.rs
+3
-4
src/librustc/middle/def.rs
src/librustc/middle/def.rs
+21
-1
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+0
-21
未找到文件。
src/librustc/metadata/csearch.rs
浏览文件 @
5d1257a7
...
...
@@ -19,7 +19,6 @@
use
metadata
::
decoder
;
use
middle
::
def
;
use
middle
::
lang_items
;
use
middle
::
resolve
;
use
middle
::
ty
;
use
rbml
;
...
...
@@ -148,7 +147,7 @@ pub fn get_impl_or_trait_item<'tcx>(tcx: &ty::ctxt<'tcx>, def: ast::DefId)
}
pub
fn
get_trait_item_name_and_kind
(
cstore
:
&
cstore
::
CStore
,
def
:
ast
::
DefId
)
->
(
ast
::
Name
,
resolve
::
TraitItemKind
)
{
->
(
ast
::
Name
,
def
::
TraitItemKind
)
{
let
cdata
=
cstore
.get_crate_data
(
def
.krate
);
decoder
::
get_trait_item_name_and_kind
(
cstore
.intr
.clone
(),
&*
cdata
,
...
...
src/librustc/metadata/decoder.rs
浏览文件 @
5d1257a7
...
...
@@ -27,7 +27,6 @@
parse_predicate_data
};
use
middle
::
def
;
use
middle
::
lang_items
;
use
middle
::
resolve
::{
TraitItemKind
,
TypeTraitItemKind
};
use
middle
::
subst
;
use
middle
::
ty
::{
ImplContainer
,
TraitContainer
};
use
middle
::
ty
::{
mod
,
Ty
};
...
...
@@ -785,15 +784,15 @@ pub fn get_impl_items(cdata: Cmd, impl_id: ast::NodeId)
pub
fn
get_trait_item_name_and_kind
(
intr
:
Rc
<
IdentInterner
>
,
cdata
:
Cmd
,
id
:
ast
::
NodeId
)
->
(
ast
::
Name
,
TraitItemKind
)
{
->
(
ast
::
Name
,
def
::
TraitItemKind
)
{
let
doc
=
lookup_item
(
id
,
cdata
.data
());
let
name
=
item_name
(
&*
intr
,
doc
);
match
item_sort
(
doc
)
{
'r'
|
'p'
=>
{
let
explicit_self
=
get_explicit_self
(
doc
);
(
name
,
TraitItemKind
::
from_explicit_self_category
(
explicit_self
))
(
name
,
def
::
TraitItemKind
::
from_explicit_self_category
(
explicit_self
))
}
't'
=>
(
name
,
TypeTraitItemKind
),
't'
=>
(
name
,
def
::
TypeTraitItemKind
),
c
=>
{
panic!
(
"get_trait_item_name_and_kind(): unknown trait item kind
\
in metadata: `{}`"
,
c
)
...
...
src/librustc/middle/def.rs
浏览文件 @
5d1257a7
...
...
@@ -10,8 +10,10 @@
pub
use
self
::
Def
::
*
;
pub
use
self
::
MethodProvenance
::
*
;
pub
use
self
::
TraitItemKind
::
*
;
use
middle
::
subst
::
ParamSpace
;
use
middle
::
ty
::{
ExplicitSelfCategory
,
StaticExplicitSelfCategory
};
use
util
::
nodemap
::
NodeMap
;
use
syntax
::
ast
;
use
syntax
::
ast_util
::
local_def
;
...
...
@@ -103,6 +105,25 @@ pub fn def_id(&self) -> ast::DefId {
}
}
#[deriving(Clone,
Copy,
Eq,
PartialEq)]
pub
enum
TraitItemKind
{
NonstaticMethodTraitItemKind
,
StaticMethodTraitItemKind
,
TypeTraitItemKind
,
}
impl
TraitItemKind
{
pub
fn
from_explicit_self_category
(
explicit_self_category
:
ExplicitSelfCategory
)
->
TraitItemKind
{
if
explicit_self_category
==
StaticExplicitSelfCategory
{
StaticMethodTraitItemKind
}
else
{
NonstaticMethodTraitItemKind
}
}
}
impl
Def
{
pub
fn
def_id
(
&
self
)
->
ast
::
DefId
{
match
*
self
{
...
...
@@ -137,4 +158,3 @@ pub fn variant_def_ids(&self) -> Option<(ast::DefId, ast::DefId)> {
}
}
}
src/librustc/middle/resolve.rs
浏览文件 @
5d1257a7
...
...
@@ -10,7 +10,6 @@
pub
use
self
::
PrivateDep
::
*
;
pub
use
self
::
ImportUse
::
*
;
pub
use
self
::
TraitItemKind
::
*
;
pub
use
self
::
LastPrivate
::
*
;
use
self
::
PatternBindingMode
::
*
;
use
self
::
Namespace
::
*
;
...
...
@@ -42,7 +41,6 @@
use
middle
::
lang_items
::
LanguageItems
;
use
middle
::
pat_util
::
pat_bindings
;
use
middle
::
subst
::{
ParamSpace
,
FnSpace
,
TypeSpace
};
use
middle
::
ty
::{
ExplicitSelfCategory
,
StaticExplicitSelfCategory
};
use
middle
::
ty
::{
CaptureModeMap
,
Freevar
,
FreevarMap
,
TraitMap
};
use
util
::
nodemap
::{
NodeMap
,
NodeSet
,
DefIdSet
,
FnvHashMap
};
...
...
@@ -323,25 +321,6 @@ enum ModulePrefixResult {
PrefixFound
(
Rc
<
Module
>
,
uint
)
}
#[deriving(Clone,
Copy,
Eq,
PartialEq)]
pub
enum
TraitItemKind
{
NonstaticMethodTraitItemKind
,
StaticMethodTraitItemKind
,
TypeTraitItemKind
,
}
impl
TraitItemKind
{
pub
fn
from_explicit_self_category
(
explicit_self_category
:
ExplicitSelfCategory
)
->
TraitItemKind
{
if
explicit_self_category
==
StaticExplicitSelfCategory
{
StaticMethodTraitItemKind
}
else
{
NonstaticMethodTraitItemKind
}
}
}
#[deriving(Copy,
PartialEq)]
enum
NameSearchType
{
/// We're doing a name search in order to resolve a `use` directive.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录