You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/07/06 19:21:23 UTC
[3/3] git commit: Move 'inherit_metadata' hack to CFC
Move 'inherit_metadata' hack to CFC
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/9150ca3a
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/9150ca3a
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/9150ca3a
Branch: refs/heads/master
Commit: 9150ca3ae90a86bc81cf7ef7cf26f1d306f308c9
Parents: f3c0981
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sun Jul 6 18:56:28 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sun Jul 6 18:56:28 2014 +0200
----------------------------------------------------------------------
compiler/perl/lib/Clownfish/CFC.pm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/9150ca3a/compiler/perl/lib/Clownfish/CFC.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.pm b/compiler/perl/lib/Clownfish/CFC.pm
index 5034e85..8b80ea5 100644
--- a/compiler/perl/lib/Clownfish/CFC.pm
+++ b/compiler/perl/lib/Clownfish/CFC.pm
@@ -255,6 +255,39 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.01' ) }
verify_args( \%new_PARAMS, %args ) or confess $@;
return _new( @args{qw( dest )} );
}
+
+ # Recreate host language specific metadata of dependencies.
+ #
+ # TODO: This should be done automatically when building the hierarchy.
+ # But since the current approach relies on runtime introspection, the Perl
+ # modules for all dependencies must first be loaded.
+ sub inherit_metadata {
+ my $self = shift;
+
+ require Clownfish;
+
+ for my $class (@{ $self->ordered_classes }) {
+ next if !$class->included || $class->inert;
+
+ my $class_name = $class->get_class_name;
+ my $rt_class = Clownfish::Class->fetch_class($class_name)
+ or die("Class $class_name not found");
+
+ for my $rt_method (@{ $rt_class->get_methods }) {
+ if ($rt_method->is_excluded_from_host) {
+ my $method = $class->method($rt_method->get_name);
+ $method->exclude_from_host;
+ }
+ else {
+ my $alias = $rt_method->get_host_alias;
+ if (defined($alias)) {
+ my $method = $class->method($rt_method->get_name);
+ $method->set_host_alias($alias);
+ }
+ }
+ }
+ }
+ }
}
{