view src/gearsTools/lib/Gears/Stub.pm @ 281:4d76280758db

move context.pm to util.pm ...
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 28 Jan 2020 16:50:07 +0900
parents 21a5761e3e7a
children
line wrap: on
line source

package Gears::Stub;
use strict;
use warnings;
use Carp qw/croak/;
use File::Find;
use Gears::Util;

use DDP {deparse => 1};

sub new {
  my ($class, %args) = @_;

  my $self = {};
  $self->{file_name} = $args{file_name} || croak 'invalid file_name!'; 

  return bless $self, $class;
}



sub findInterfacewImpl {
  my $self     = shift;
  my $cbc_file = shift // $self->{file_name};
  my $findInterfaces = Gears::Util->extraction_dg_compile_sources([$cbc_file]);
  my $edgcs = Gears::Util->extraction_dg_compile_sources([$cbc_file]);
  my $findInterfaces = {};

  my %ifs = ();
  map { $ifs{$_}++ } keys %{$edgcs->{interfaces}};
  delete $ifs{Meta};
  delete $ifs{TaskManager};

  push(@{$findInterfaces->{interfaces}}, keys %ifs);
  push(@{$findInterfaces->{impls}}, keys %{$edgcs->{impl}});

  return $findInterfaces;
}

1;