Teach the compiler to understand yield and join, as well as using task as a type name.

This commit is contained in:
Eric Holk 2011-05-31 16:27:39 -07:00
parent 9daa00bf83
commit 84a56ed7cd
6 changed files with 6 additions and 2 deletions

View File

@ -321,6 +321,7 @@ tag ty_ {
ty_str;
ty_box(mt);
ty_vec(mt);
ty_task;
ty_port(@ty);
ty_chan(@ty);
ty_tup(vec[mt]);

View File

@ -106,6 +106,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty::t {
case ('p') { ret ty::mk_param(st.tcx, parse_int(st) as uint); }
case ('@') { ret ty::mk_box(st.tcx, parse_mt(st, sd)); }
case ('V') { ret ty::mk_vec(st.tcx, parse_mt(st, sd)); }
case ('a') { ret ty::mk_task(st.tcx); }
case ('P') { ret ty::mk_port(st.tcx, parse_ty(st, sd)); }
case ('C') { ret ty::mk_chan(st.tcx, parse_ty(st, sd)); }
case ('T') {

View File

@ -208,7 +208,6 @@ fn bad_expr_word_table() -> std::map::hashmap[str, ()] {
words.insert("const", ());
words.insert("log", ());
words.insert("log_err", ());
words.insert("yield", ());
words.insert("tag", ());
words.insert("obj", ());
ret words;
@ -482,6 +481,7 @@ fn parse_ty(&parser p) -> @ast::ty {
else if (eat_word(p, "float")) { t = ast::ty_float; }
else if (eat_word(p, "str")) { t = ast::ty_str; }
else if (eat_word(p, "char")) { t = ast::ty_char; }
else if (eat_word(p, "task")) { t = ast::ty_task; }
else if (eat_word(p, "i8")) { t = ast::ty_machine(common::ty_i8); }
else if (eat_word(p, "i16")) { t = ast::ty_machine(common::ty_i16); }
else if (eat_word(p, "i32")) { t = ast::ty_machine(common::ty_i32); }

View File

@ -772,6 +772,7 @@ fn fold_ty(&ctxt cx, ty_fold fld, t ty_0) -> t {
case (ty_str) { /* no-op */ }
case (ty_type) { /* no-op */ }
case (ty_native) { /* no-op */ }
case (ty_task) { /* no-op */ }
case (ty_box(?tm)) {
ty = copy_cname(cx, mk_box(cx, rec(ty=fold_ty(cx, fld, tm.ty),
mut=tm.mut)), ty);

View File

@ -284,7 +284,7 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
case (ast::ty_vec(?mt)) {
typ = ty::mk_vec(tcx, ast_mt_to_mt(tcx, getter, mt));
}
case (ast::ty_task) { typ = ty::mk_task(tcx); }
case (ast::ty_port(?t)) {
typ = ty::mk_port(tcx, ast_ty_to_ty(tcx, getter, t));
}

View File

@ -154,6 +154,7 @@ fn walk_ty(&ast_visitor v, @ast::ty t) {
case (ast::ty_str) {}
case (ast::ty_box(?mt)) { walk_ty(v, mt.ty); }
case (ast::ty_vec(?mt)) { walk_ty(v, mt.ty); }
case (ast::ty_task) {}
case (ast::ty_port(?t)) { walk_ty(v, t); }
case (ast::ty_chan(?t)) { walk_ty(v, t); }
case (ast::ty_tup(?mts)) {