diff options
author | Daniel Friesel <derf@finalrewind.org> | 2017-05-18 10:43:31 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2017-05-18 10:43:31 +0200 |
commit | 4f11a6625e5efe8e4289de3454e2c4acc9c91438 (patch) | |
tree | d2b1ba70dd20731eb0b8d68abc14a26035ba4537 /lib/Kratos/DFADriver/Model.pm | |
parent | 8b41795516bd3d54dedaf1eadc04731ad6c4febb (diff) |
don't get confused by polymorphism
Diffstat (limited to 'lib/Kratos/DFADriver/Model.pm')
-rw-r--r-- | lib/Kratos/DFADriver/Model.pm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Kratos/DFADriver/Model.pm b/lib/Kratos/DFADriver/Model.pm index 3eb89e1..db428e0 100644 --- a/lib/Kratos/DFADriver/Model.pm +++ b/lib/Kratos/DFADriver/Model.pm @@ -88,6 +88,24 @@ sub new_from_repo { say "wat $attrib"; } } + if ( exists $transition{ $function->{name} } ) { + for my $i ( 0 .. $#{ $function->{argtypes} } ) { + my $argtype = $function->{argtypes}[$i]; + my $param_name = sprintf( '%s.arg%d', $function->{name}, $i ); + push( + @{ $transition{ $function->{name} }{parameters} }, + { + name => $param_name, + values => [], + } + ); + $self->{parameter}{$param_name} = { + arg_name => $param_name, + function => $function->{name}, + default => undef, + }; + } + } } @states = uniq @states; @@ -113,7 +131,13 @@ sub new_from_repo { destination => $transition{$name}{dst}[0], origins => $transition{$name}{src}, level => $transition{$name}{level} // $guess_level, + parameters => $transition{$name}{parameters} // [], }; + if ( @{ $transition{$name}{dst} } > 1 ) { + warn( +"Transition ${name} has several destination states. This is not supported yet.\n" + ); + } } write_file( $self->{model_file}, |