summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-05-18 10:43:31 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-05-18 10:43:31 +0200
commit4f11a6625e5efe8e4289de3454e2c4acc9c91438 (patch)
treed2b1ba70dd20731eb0b8d68abc14a26035ba4537 /lib
parent8b41795516bd3d54dedaf1eadc04731ad6c4febb (diff)
don't get confused by polymorphism
Diffstat (limited to 'lib')
-rw-r--r--lib/AspectC/Repo.pm3
-rw-r--r--lib/Kratos/DFADriver/Model.pm24
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},