Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
28af5336
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,发现更多精彩内容 >>
提交
28af5336
编写于
8月 10, 2019
作者:
M
Mazdak Farrokhzad
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lowering: move scope & capture_clause stuff -> expr.rs
上级
5ab73450
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
66 deletion
+66
-66
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+0
-65
src/librustc/hir/lowering/expr.rs
src/librustc/hir/lowering/expr.rs
+66
-1
未找到文件。
src/librustc/hir/lowering.rs
浏览文件 @
28af5336
...
...
@@ -971,64 +971,6 @@ fn add_in_band_defs<F, T>(
(
lowered_generics
,
res
)
}
fn
with_catch_scope
<
T
,
F
>
(
&
mut
self
,
catch_id
:
NodeId
,
f
:
F
)
->
T
where
F
:
FnOnce
(
&
mut
LoweringContext
<
'_
>
)
->
T
,
{
let
len
=
self
.catch_scopes
.len
();
self
.catch_scopes
.push
(
catch_id
);
let
result
=
f
(
self
);
assert_eq!
(
len
+
1
,
self
.catch_scopes
.len
(),
"catch scopes should be added and removed in stack order"
);
self
.catch_scopes
.pop
()
.unwrap
();
result
}
fn
with_loop_scope
<
T
,
F
>
(
&
mut
self
,
loop_id
:
NodeId
,
f
:
F
)
->
T
where
F
:
FnOnce
(
&
mut
LoweringContext
<
'_
>
)
->
T
,
{
// We're no longer in the base loop's condition; we're in another loop.
let
was_in_loop_condition
=
self
.is_in_loop_condition
;
self
.is_in_loop_condition
=
false
;
let
len
=
self
.loop_scopes
.len
();
self
.loop_scopes
.push
(
loop_id
);
let
result
=
f
(
self
);
assert_eq!
(
len
+
1
,
self
.loop_scopes
.len
(),
"loop scopes should be added and removed in stack order"
);
self
.loop_scopes
.pop
()
.unwrap
();
self
.is_in_loop_condition
=
was_in_loop_condition
;
result
}
fn
with_loop_condition_scope
<
T
,
F
>
(
&
mut
self
,
f
:
F
)
->
T
where
F
:
FnOnce
(
&
mut
LoweringContext
<
'_
>
)
->
T
,
{
let
was_in_loop_condition
=
self
.is_in_loop_condition
;
self
.is_in_loop_condition
=
true
;
let
result
=
f
(
self
);
self
.is_in_loop_condition
=
was_in_loop_condition
;
result
}
fn
with_dyn_type_scope
<
T
,
F
>
(
&
mut
self
,
in_scope
:
bool
,
f
:
F
)
->
T
where
F
:
FnOnce
(
&
mut
LoweringContext
<
'_
>
)
->
T
,
...
...
@@ -3005,13 +2947,6 @@ fn lower_anon_const(&mut self, c: &AnonConst) -> hir::AnonConst {
}]
}
fn
lower_capture_clause
(
&
mut
self
,
c
:
CaptureBy
)
->
hir
::
CaptureClause
{
match
c
{
CaptureBy
::
Value
=>
hir
::
CaptureByValue
,
CaptureBy
::
Ref
=>
hir
::
CaptureByRef
,
}
}
fn
lower_block_check_mode
(
&
mut
self
,
b
:
&
BlockCheckMode
)
->
hir
::
BlockCheckMode
{
match
*
b
{
BlockCheckMode
::
Default
=>
hir
::
DefaultBlock
,
...
...
src/librustc/hir/lowering/expr.rs
浏览文件 @
28af5336
...
...
@@ -700,9 +700,16 @@ fn lower_expr_closure(
})
}
fn
lower_capture_clause
(
&
mut
self
,
c
:
CaptureBy
)
->
hir
::
CaptureClause
{
match
c
{
CaptureBy
::
Value
=>
hir
::
CaptureByValue
,
CaptureBy
::
Ref
=>
hir
::
CaptureByRef
,
}
}
fn
generator_movability_for_fn
(
&
mut
self
,
decl
:
&
ast
::
FnDecl
,
decl
:
&
FnDecl
,
fn_decl_span
:
Span
,
generator_kind
:
Option
<
hir
::
GeneratorKind
>
,
movability
:
Movability
,
...
...
@@ -898,6 +905,64 @@ fn lower_jump_destination(&mut self, id: NodeId, opt_label: Option<Label>) -> hi
}
}
fn
with_catch_scope
<
T
,
F
>
(
&
mut
self
,
catch_id
:
NodeId
,
f
:
F
)
->
T
where
F
:
FnOnce
(
&
mut
LoweringContext
<
'_
>
)
->
T
,
{
let
len
=
self
.catch_scopes
.len
();
self
.catch_scopes
.push
(
catch_id
);
let
result
=
f
(
self
);
assert_eq!
(
len
+
1
,
self
.catch_scopes
.len
(),
"catch scopes should be added and removed in stack order"
);
self
.catch_scopes
.pop
()
.unwrap
();
result
}
fn
with_loop_scope
<
T
,
F
>
(
&
mut
self
,
loop_id
:
NodeId
,
f
:
F
)
->
T
where
F
:
FnOnce
(
&
mut
LoweringContext
<
'_
>
)
->
T
,
{
// We're no longer in the base loop's condition; we're in another loop.
let
was_in_loop_condition
=
self
.is_in_loop_condition
;
self
.is_in_loop_condition
=
false
;
let
len
=
self
.loop_scopes
.len
();
self
.loop_scopes
.push
(
loop_id
);
let
result
=
f
(
self
);
assert_eq!
(
len
+
1
,
self
.loop_scopes
.len
(),
"loop scopes should be added and removed in stack order"
);
self
.loop_scopes
.pop
()
.unwrap
();
self
.is_in_loop_condition
=
was_in_loop_condition
;
result
}
fn
with_loop_condition_scope
<
T
,
F
>
(
&
mut
self
,
f
:
F
)
->
T
where
F
:
FnOnce
(
&
mut
LoweringContext
<
'_
>
)
->
T
,
{
let
was_in_loop_condition
=
self
.is_in_loop_condition
;
self
.is_in_loop_condition
=
true
;
let
result
=
f
(
self
);
self
.is_in_loop_condition
=
was_in_loop_condition
;
result
}
fn
lower_expr_asm
(
&
mut
self
,
asm
:
&
InlineAsm
)
->
hir
::
ExprKind
{
let
hir_asm
=
hir
::
InlineAsm
{
inputs
:
asm
.inputs
.iter
()
.map
(|
&
(
ref
c
,
_
)|
c
.clone
())
.collect
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录