From 4f11a6625e5efe8e4289de3454e2c4acc9c91438 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 18 May 2017 10:43:31 +0200 Subject: don't get confused by polymorphism --- lib/Kratos/DFADriver/Model.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/Kratos') 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}, -- cgit v1.2.3