mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
When we cons up vector asts, generate evecs.
This commit is contained in:
parent
a71a49faa8
commit
c087aaf56b
@ -61,6 +61,16 @@ fn mk_vec_e(cx: ext_ctxt, sp: span, exprs: [@ast::expr]) ->
|
|||||||
let vecexpr = ast::expr_vec(exprs, ast::m_imm);
|
let vecexpr = ast::expr_vec(exprs, ast::m_imm);
|
||||||
ret @{id: cx.next_id(), node: vecexpr, span: sp};
|
ret @{id: cx.next_id(), node: vecexpr, span: sp};
|
||||||
}
|
}
|
||||||
|
fn mk_vstore_e(cx: ext_ctxt, sp: span, expr: @ast::expr, vst: ast::vstore) ->
|
||||||
|
@ast::expr {
|
||||||
|
let vstoreexpr = ast::expr_vstore(expr, vst);
|
||||||
|
ret @{id: cx.next_id(), node: vstoreexpr, span: sp};
|
||||||
|
}
|
||||||
|
fn mk_uniq_vec_e(cx: ext_ctxt, sp: span, exprs: [@ast::expr]/~) ->
|
||||||
|
@ast::expr {
|
||||||
|
mk_vstore_e(cx, sp, mk_vec_e(cx, sp, exprs), ast::vstore_uniq)
|
||||||
|
}
|
||||||
|
|
||||||
fn mk_rec_e(cx: ext_ctxt, sp: span,
|
fn mk_rec_e(cx: ext_ctxt, sp: span,
|
||||||
fields: [{ident: ast::ident, ex: @ast::expr}]) ->
|
fields: [{ident: ast::ident, ex: @ast::expr}]) ->
|
||||||
@ast::expr {
|
@ast::expr {
|
||||||
|
@ -61,7 +61,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span, pieces: [piece], args: [@ast::expr])
|
|||||||
}
|
}
|
||||||
flagexprs += [make_rt_path_expr(cx, sp, @fstr)];
|
flagexprs += [make_rt_path_expr(cx, sp, @fstr)];
|
||||||
}
|
}
|
||||||
ret mk_vec_e(cx, sp, flagexprs);
|
ret mk_uniq_vec_e(cx, sp, flagexprs);
|
||||||
}
|
}
|
||||||
fn make_count(cx: ext_ctxt, sp: span, cnt: count) -> @ast::expr {
|
fn make_count(cx: ext_ctxt, sp: span, cnt: count) -> @ast::expr {
|
||||||
alt cnt {
|
alt cnt {
|
||||||
|
@ -258,7 +258,7 @@ fn finish<T: qq_helper>
|
|||||||
rcall = mk_call(cx,sp,
|
rcall = mk_call(cx,sp,
|
||||||
[@"syntax", @"ext", @"qquote", @"replace"],
|
[@"syntax", @"ext", @"qquote", @"replace"],
|
||||||
[pcall,
|
[pcall,
|
||||||
mk_vec_e(cx,sp, qcx.gather.map_to_vec {|g|
|
mk_uniq_vec_e(cx,sp, qcx.gather.map_to_vec {|g|
|
||||||
mk_call(cx,sp,
|
mk_call(cx,sp,
|
||||||
[@"syntax", @"ext",
|
[@"syntax", @"ext",
|
||||||
@"qquote", @g.constr],
|
@"qquote", @g.constr],
|
||||||
|
@ -265,8 +265,11 @@ fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty {
|
|||||||
|
|
||||||
let vec_mt: ast::mt = {ty: @test_desc_ty, mutbl: ast::m_imm};
|
let vec_mt: ast::mt = {ty: @test_desc_ty, mutbl: ast::m_imm};
|
||||||
|
|
||||||
|
let inner_ty = @{id: cx.sess.next_node_id(),
|
||||||
|
node: ast::ty_vec(vec_mt),
|
||||||
|
span: dummy_sp()};
|
||||||
ret @{id: cx.sess.next_node_id(),
|
ret @{id: cx.sess.next_node_id(),
|
||||||
node: ast::ty_vec(vec_mt),
|
node: ast::ty_vstore(inner_ty, ast::vstore_uniq),
|
||||||
span: dummy_sp()};
|
span: dummy_sp()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,8 +280,11 @@ fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr {
|
|||||||
descs += [mk_test_desc_rec(cx, test)];
|
descs += [mk_test_desc_rec(cx, test)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let inner_expr = @{id: cx.sess.next_node_id(),
|
||||||
|
node: ast::expr_vec(descs, ast::m_imm),
|
||||||
|
span: dummy_sp()};
|
||||||
ret @{id: cx.sess.next_node_id(),
|
ret @{id: cx.sess.next_node_id(),
|
||||||
node: ast::expr_vec(descs, ast::m_imm),
|
node: ast::expr_vstore(inner_expr, ast::vstore_uniq),
|
||||||
span: dummy_sp()};
|
span: dummy_sp()};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,10 +390,14 @@ fn mk_main(cx: test_ctxt) -> @ast::item {
|
|||||||
let str_ty = @{id: cx.sess.next_node_id(),
|
let str_ty = @{id: cx.sess.next_node_id(),
|
||||||
node: ast::ty_path(str_pt, cx.sess.next_node_id()),
|
node: ast::ty_path(str_pt, cx.sess.next_node_id()),
|
||||||
span: dummy_sp()};
|
span: dummy_sp()};
|
||||||
let args_mt: ast::mt = {ty: str_ty, mutbl: ast::m_imm};
|
let args_mt = {ty: str_ty, mutbl: ast::m_imm};
|
||||||
let args_ty: ast::ty = {id: cx.sess.next_node_id(),
|
let args_ty_inner = @{id: cx.sess.next_node_id(),
|
||||||
node: ast::ty_vec(args_mt),
|
node: ast::ty_vec(args_mt),
|
||||||
span: dummy_sp()};
|
span: dummy_sp()};
|
||||||
|
let args_ty = {id: cx.sess.next_node_id(),
|
||||||
|
node: ast::ty_vstore(args_ty_inner, ast::vstore_uniq),
|
||||||
|
span: dummy_sp()};
|
||||||
|
|
||||||
|
|
||||||
let args_arg: ast::arg =
|
let args_arg: ast::arg =
|
||||||
{mode: ast::expl(ast::by_val),
|
{mode: ast::expl(ast::by_val),
|
||||||
|
Loading…
Reference in New Issue
Block a user