close over the coercion sub separately
[gitmo/Moose.git] / lib / Moose / Meta / Method / Constructor.pm
index 693c822..6b1d7c2 100644 (file)
@@ -74,11 +74,18 @@ sub _eval_environment {
         defined $_ ? $_->_compiled_type_constraint : undef;
     } @type_constraints;
 
+    my @type_coercions = map {
+        defined $_ && $_->has_coercion
+            ? $_->coercion->_compiled_type_coercion
+            : undef
+    } @type_constraints;
+
     return {
         '$meta'  => \$self,
         '$attrs' => \$attrs,
         '$defaults' => \$defaults,
         '@type_constraints' => \@type_constraints,
+        '@type_coercions' => \@type_coercions,
         '@type_constraint_bodies' => \@type_constraint_bodies,
         ( map { defined($_) ? %{ $_->inline_environment } : () }
               @type_constraints ),