Skip to content

Commit 84a56ed

Browse files
author
Eric Holk
committed
Teach the compiler to understand yield and join, as well as using task as a type name.
1 parent 9daa00b commit 84a56ed

File tree

6 files changed

+6
-2
lines changed

6 files changed

+6
-2
lines changed

src/comp/front/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ tag ty_ {
321321
ty_str;
322322
ty_box(mt);
323323
ty_vec(mt);
324+
ty_task;
324325
ty_port(@ty);
325326
ty_chan(@ty);
326327
ty_tup(vec[mt]);

src/comp/front/creader.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ fn parse_ty(@pstate st, str_def sd) -> ty::t {
106106
case ('p') { ret ty::mk_param(st.tcx, parse_int(st) as uint); }
107107
case ('@') { ret ty::mk_box(st.tcx, parse_mt(st, sd)); }
108108
case ('V') { ret ty::mk_vec(st.tcx, parse_mt(st, sd)); }
109+
case ('a') { ret ty::mk_task(st.tcx); }
109110
case ('P') { ret ty::mk_port(st.tcx, parse_ty(st, sd)); }
110111
case ('C') { ret ty::mk_chan(st.tcx, parse_ty(st, sd)); }
111112
case ('T') {

src/comp/front/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ fn bad_expr_word_table() -> std::map::hashmap[str, ()] {
208208
words.insert("const", ());
209209
words.insert("log", ());
210210
words.insert("log_err", ());
211-
words.insert("yield", ());
212211
words.insert("tag", ());
213212
words.insert("obj", ());
214213
ret words;
@@ -482,6 +481,7 @@ fn parse_ty(&parser p) -> @ast::ty {
482481
else if (eat_word(p, "float")) { t = ast::ty_float; }
483482
else if (eat_word(p, "str")) { t = ast::ty_str; }
484483
else if (eat_word(p, "char")) { t = ast::ty_char; }
484+
else if (eat_word(p, "task")) { t = ast::ty_task; }
485485
else if (eat_word(p, "i8")) { t = ast::ty_machine(common::ty_i8); }
486486
else if (eat_word(p, "i16")) { t = ast::ty_machine(common::ty_i16); }
487487
else if (eat_word(p, "i32")) { t = ast::ty_machine(common::ty_i32); }

src/comp/middle/ty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ fn fold_ty(&ctxt cx, ty_fold fld, t ty_0) -> t {
772772
case (ty_str) { /* no-op */ }
773773
case (ty_type) { /* no-op */ }
774774
case (ty_native) { /* no-op */ }
775+
case (ty_task) { /* no-op */ }
775776
case (ty_box(?tm)) {
776777
ty = copy_cname(cx, mk_box(cx, rec(ty=fold_ty(cx, fld, tm.ty),
777778
mut=tm.mut)), ty);

src/comp/middle/typeck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
284284
case (ast::ty_vec(?mt)) {
285285
typ = ty::mk_vec(tcx, ast_mt_to_mt(tcx, getter, mt));
286286
}
287-
287+
case (ast::ty_task) { typ = ty::mk_task(tcx); }
288288
case (ast::ty_port(?t)) {
289289
typ = ty::mk_port(tcx, ast_ty_to_ty(tcx, getter, t));
290290
}

src/comp/middle/walk.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ fn walk_ty(&ast_visitor v, @ast::ty t) {
154154
case (ast::ty_str) {}
155155
case (ast::ty_box(?mt)) { walk_ty(v, mt.ty); }
156156
case (ast::ty_vec(?mt)) { walk_ty(v, mt.ty); }
157+
case (ast::ty_task) {}
157158
case (ast::ty_port(?t)) { walk_ty(v, t); }
158159
case (ast::ty_chan(?t)) { walk_ty(v, t); }
159160
case (ast::ty_tup(?mts)) {

0 commit comments

Comments
 (0)