No need to pass name => __ANON__ in _create_type()
gfx [Sun, 20 Dec 2009 07:42:22 +0000 (16:42 +0900)]
lib/Mouse/Util/TypeConstraints.pm

index ebb71dd..12a9a1b 100644 (file)
@@ -96,8 +96,10 @@ sub _create_type{
     if(!defined $name){
         $name = $args{name};
     }
+    else{
+        $args{name} = $name;
+    }
 
-    $args{name} = $name;
     my $parent;
     if($mode eq 'subtype'){
         $parent = delete $args{as};
@@ -115,9 +117,6 @@ sub _create_type{
                   . "$existing->{package_defined_in} and cannot be created again in $package_defined_in");
         }
     }
-    else{
-        $args{name} = '__ANON__';
-    }
 
     $args{constraint} = delete $args{where}        if exists $args{where};
     $args{optimized}  = delete $args{optimized_as} if exists $args{optimized_as};