Commits

Toby Inkster committed e1641cd

some support for MooseX::Types class_types

  • Participants
  • Parent commits 2c382b6

Comments (0)

Files changed (1)

lib/MooseX/Semantic/Util/TypeConstraintWalker.pm

     if ( $type_constraint->can('class') && ! blessed $type_constraint->class && $type_constraint->class eq $needle ) {
         return $type_constraint->class;
     }
-    if ( $type_constraint->{'__type_constraint'} 
-    ) {
+    if ( $type_constraint->{'__type_constraint'} ) {
         # warn Dumper $type_constraint->{'__type_constraint'};
-        # if( $type_constraint->{'__type_constraint'}->can('class')
-        #     && $type_constraint->{'__type_constraint'}->class eq $needle 
-        # ) {
-            # return $needle;
+        if ( $type_constraint->{'__type_constraint'}->can('class')
+             && ref($needle) eq 'CODE'
+             && $needle->( $type_constraint->{'__type_constraint'}->class )
+        ) {
+            return $type_constraint->{'__type_constraint'}->class;
+        }
+        elsif ( $type_constraint->{'__type_constraint'}->can('class')
+                && $type_constraint->{'__type_constraint'}->class eq $needle 
+        ) {
+            return $needle;
         # warn Dumper [ keys(%{$type_constraint}->{'__type_constraint'}) ];
         # warn Dumper {%{$type_constraint->{'__type_constraint'}}};
-        return $self->_find_parent_type_for_type_constraint($type_constraint->{'__type_constraint'}, $needle, %opts);
-        # }
-        # else {
-        #     return
-        # }
+        #return $self->_find_parent_type_for_type_constraint($type_constraint->{'__type_constraint'}, $needle, %opts);
+        }
+        else {
+            return
+        }
     }
     if ($type_constraint->has_parent) {
         # warn Dumper {keys(%{$type_constraint})};