diff options
-rw-r--r-- | lib/AspectC/Repo.pm | 3 | ||||
-rw-r--r-- | lib/Kratos/DFADriver/Model.pm | 24 |
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/AspectC/Repo.pm b/lib/AspectC/Repo.pm index 35bffbe..2ddccfd 100644 --- a/lib/AspectC/Repo.pm +++ b/lib/AspectC/Repo.pm @@ -129,7 +129,8 @@ sub parse_xml { split( qr{ \s+ }x, $attributes ) ]; } - $class->{function}{$name} = $fun; + my $hash_key = sprintf( '%s(%s)', $name, join( q{, }, @args ) ); + $class->{function}{$hash_key} = $fun; } $self->{class}{$class_name} = $class; } 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}, |