Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1c97510a
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,发现更多精彩内容 >>
提交
1c97510a
编写于
7月 26, 2011
作者:
G
Graydon Hoare
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve printing of mod and native mod.
上级
69f8d0e7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
33 deletion
+47
-33
src/comp/syntax/print/pprust.rs
src/comp/syntax/print/pprust.rs
+47
-33
未找到文件。
src/comp/syntax/print/pprust.rs
浏览文件 @
1c97510a
...
...
@@ -246,17 +246,27 @@ fn commasep_exprs(&ps s, breaks b, &(@ast::expr)[] exprs) {
commasep_cmnt
(
s
,
b
,
exprs
,
print_expr
,
expr_span
);
}
fn
print_mod
(
&
ps
s
,
ast
::
_
mod
_
mod
,
&
ast
::
attribute
[]
attrs
)
{
fn
print_mod
(
&
ps
s
,
&
ast
::
_
mod
_
mod
,
&
ast
::
attribute
[]
attrs
)
{
print_inner_attributes
(
s
,
attrs
);
for
(
@
ast
::
view_item
vitem
in
_
mod
.view_items
)
{
print_view_item
(
s
,
vitem
);
}
for
(
@
ast
::
item
item
in
_
mod
.items
)
{
hardbreak_if_not_bol
(
s
);
print_item
(
s
,
item
);
}
}
fn
print_native_mod
(
&
ps
s
,
&
ast
::
native_mod
nmod
,
&
ast
::
attribute
[]
attrs
)
{
print_inner_attributes
(
s
,
attrs
);
for
(
@
ast
::
view_item
vitem
in
nmod
.view_items
)
{
print_view_item
(
s
,
vitem
);
}
for
(
@
ast
::
native_item
item
in
nmod
.items
)
{
print_native_item
(
s
,
item
);
}
}
fn
print_boxed_type
(
&
ps
s
,
&@
ast
::
ty
ty
)
{
print_type
(
s
,
*
ty
);
}
fn
print_type
(
&
ps
s
,
&
ast
::
ty
ty
)
{
...
...
@@ -347,6 +357,40 @@ fn print_field(&ps s, &ast::ty_field f) {
end
(
s
);
}
fn
print_native_item
(
&
ps
s
,
&@
ast
::
native_item
item
)
{
hardbreak_if_not_bol
(
s
);
maybe_print_comment
(
s
,
item
.span.lo
);
print_outer_attributes
(
s
,
item
.attrs
);
alt
(
item
.node
)
{
ast
::
native_item_ty
{
ibox
(
s
,
indent_unit
);
ibox
(
s
,
0u
);
word_nbsp
(
s
,
"type"
);
word
(
s
.s
,
item
.ident
);
end
(
s
);
// end the inner ibox
word
(
s
.s
,
";"
);
end
(
s
);
// end the outer ibox
}
ast
::
native_item_fn
(
?
lname
,
?
decl
,
?
typarams
)
{
print_fn
(
s
,
decl
,
ast
::
proto_fn
,
item
.ident
,
typarams
);
alt
(
lname
)
{
none
{
}
some
(
?
ss
)
{
space
(
s
.s
);
word_space
(
s
,
"="
);
print_string
(
s
,
ss
);
}
}
end
(
s
);
// end head-ibox
word
(
s
.s
,
";"
);
end
(
s
);
// end the outer fn box
}
}
}
fn
print_item
(
&
ps
s
,
&@
ast
::
item
item
)
{
hardbreak_if_not_bol
(
s
);
maybe_print_comment
(
s
,
item
.span.lo
);
...
...
@@ -392,37 +436,7 @@ fn print_item(&ps s, &@ast::item item) {
word_nbsp
(
s
,
"mod"
);
word_nbsp
(
s
,
item
.ident
);
bopen
(
s
);
print_inner_attributes
(
s
,
item
.attrs
);
for
(
@
ast
::
native_item
item
in
nmod
.items
)
{
hardbreak_if_not_bol
(
s
);
print_outer_attributes
(
s
,
item
.attrs
);
ibox
(
s
,
indent_unit
);
maybe_print_comment
(
s
,
item
.span.lo
);
alt
(
item
.node
)
{
case
(
ast
::
native_item_ty
)
{
word_nbsp
(
s
,
"type"
);
word
(
s
.s
,
item
.ident
);
}
case
(
ast
::
native_item_fn
(
?
lname
,
?
decl
,
?
typarams
))
{
print_fn
(
s
,
decl
,
ast
::
proto_fn
,
item
.ident
,
typarams
);
alt
(
lname
)
{
case
(
none
)
{
}
case
(
some
(
?
ss
))
{
space
(
s
.s
);
word_space
(
s
,
"="
);
print_string
(
s
,
ss
);
}
}
end
(
s
);
// end head-ibox
end
(
s
);
// end the outer fn box
}
}
word
(
s
.s
,
";"
);
end
(
s
);
}
print_native_mod
(
s
,
nmod
,
item
.attrs
);
bclose
(
s
,
item
.span
);
}
case
(
ast
::
item_ty
(
?
ty
,
?
params
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录