about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-05-17 11:49:50 -0700
committerEric Holk <eholk@mozilla.com>2011-05-17 14:38:32 -0700
commit8d10594ed5f1cf9f8690026f06c86af3a8e61f56 (patch)
treeefbc54cc827f6bab7e78fb74b03aa17d0c016faa /src/comp
parent37768cba92f58c99cc320a02d67165d41d8642f6 (diff)
downloadrust-8d10594ed5f1cf9f8690026f06c86af3a8e61f56.tar.gz
rust-8d10594ed5f1cf9f8690026f06c86af3a8e61f56.zip
Added a few more expr_spawn cases so the spawn.rs test case gets a little further before failing.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/ty.rs1
-rw-r--r--src/comp/middle/typeck.rs16
2 files changed, 17 insertions, 0 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 0526304f066..fe00e4619a6 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -1743,6 +1743,7 @@ fn expr_ann(&@ast::expr e) -> ast::ann {
         case (ast::expr_break(?a)) { ret a; }
         case (ast::expr_cont(?a)) { ret a; }
         case (ast::expr_self_method(_, ?a)) { ret a; }
+        case (ast::expr_spawn(_, _, _, _, ?a)) { ret a; }
     }
 }
 
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 0d0a8c53266..99bed43c166 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -1509,6 +1509,22 @@ mod Pushdown {
                 e_1 = ast::expr_send(lval_1, expr_1, ann);
             }
 
+            case (ast::expr_spawn(?dom, ?name, ?func, ?args, ?ann)) {
+                // TODO: This is copied from call, since spawn is sort of like
+                // a call expression. However, it's not doing anything with
+                // the domain or name parameters.
+
+                // NB: we call 'Demand::autoderef' and pass in adk only in
+                // cases where e is an expression that could *possibly*
+                // produce a box; things like expr_binary or expr_bind can't,
+                // so there's no need.
+                auto t = Demand::autoderef(fcx, e.span, expected,
+                    ann_to_type(fcx.ccx.node_types, ann), adk);
+                e_1 = ast::expr_spawn(dom, name, func, args,
+                                     triv_ann(ast::ann_tag(ann), t));
+                write_type_only(fcx.ccx.node_types, ast::ann_tag(ann), t);
+            }
+
             case (_) {
                 fcx.ccx.sess.span_unimpl(e.span,
                     #fmt("type unification for expression variant: %s",