File Coverage

blib/lib/RPerl/Operation/Expression/SubroutineCall/MethodCall.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             # [[[ HEADER ]]]
2             package RPerl::Operation::Expression::SubroutineCall::MethodCall;
3 5     5   38 use strict;
  5         12  
  5         141  
4 5     5   30 use warnings;
  5         13  
  5         124  
5 5     5   31 use RPerl::AfterSubclass;
  5         19  
  5         728  
6             our $VERSION = 0.002_100;
7              
8             # [[[ OO INHERITANCE ]]]
9 5     5   39 use parent qw(RPerl::Operation::Expression::SubroutineCall);
  5         13  
  5         38  
10 5     5   446 use RPerl::Operation::Expression::SubroutineCall;
  5         12  
  5         2773  
11              
12             # [[[ CRITICS ]]]
13             ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator
14             ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils
15              
16             # [[[ OO PROPERTIES ]]]
17             our hashref $properties = {};
18              
19             # [[[ SUBROUTINES & OO METHODS ]]]
20              
21             our string_hashref::method $ast_to_rperl__generate = sub {
22             ( my object $self, my string_hashref $modes) = @_;
23             my string_hashref $rperl_source_group = { PMC => q{} };
24             my string_hashref $rperl_source_subgroup;
25              
26             # RPerl::diag( 'in MethodCall->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
27              
28             if ( ( ref $self ) ne 'Expression_133' ) {
29             die RPerl::Parser::rperl_rule__replace(
30             'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '
31             . ( ref $self )
32             . ' found where Expression_133 expected, dying' )
33             . "\n";
34             }
35              
36             # Expression -> Variable OP02_METHOD_THINARROW LPAREN OPTIONAL-34 ')'
37             my object $variable = $self->{children}->[0];
38             my string $thin_arrow_name = $self->{children}->[1];
39             my string $left_paren = $self->{children}->[2];
40             my object $arguments_optional = $self->{children}->[3];
41             my string $right_paren = $self->{children}->[4];
42              
43             $rperl_source_subgroup = $variable->ast_to_rperl__generate($modes);
44             RPerl::Generator::source_group_append( $rperl_source_group,
45             $rperl_source_subgroup );
46              
47             $rperl_source_group->{PMC} .= $thin_arrow_name . $left_paren;
48              
49             if ( exists $arguments_optional->{children}->[0] ) {
50             $rperl_source_subgroup = $arguments_optional->{children}->[0]
51             ->ast_to_rperl__generate($modes);
52             RPerl::Generator::source_group_append( $rperl_source_group,
53             $rperl_source_subgroup );
54             }
55              
56             $rperl_source_group->{PMC} .= $right_paren;
57             return $rperl_source_group;
58             };
59              
60             our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub {
61             ( my object $self, my string_hashref $modes) = @_;
62             my string_hashref $cpp_source_group
63             = { CPP =>
64             q{// <<< RP::O::E::SC::MC __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>}
65             . "\n" };
66              
67             #...
68             return $cpp_source_group;
69             };
70              
71             our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub {
72             ( my object $self, my string_hashref $modes) = @_;
73             my string_hashref $cpp_source_group = { CPP => q{} };
74             my string_hashref $cpp_source_subgroup;
75              
76             # RPerl::diag( 'in MethodCall->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
77              
78             if ( ( ref $self ) ne 'Expression_133' ) {
79             die RPerl::Parser::rperl_rule__replace(
80             'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO CPP: Grammar rule '
81             . ( ref $self )
82             . ' found where Expression_133 expected, dying' )
83             . "\n";
84             }
85              
86             # Expression -> Variable OP02_METHOD_THINARROW LPAREN OPTIONAL-34 ')'
87             my object $variable = $self->{children}->[0];
88             my string $thin_arrow_name = $self->{children}->[1];
89             my string $left_paren = $self->{children}->[2];
90             my object $arguments_optional = $self->{children}->[3];
91             my string $right_paren = $self->{children}->[4];
92              
93             $cpp_source_subgroup = $variable->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
94             RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
95              
96             if ($thin_arrow_name eq '->get_raw') {
97             $cpp_source_group->{CPP} .= '.get_raw' . $left_paren;
98             }
99             elsif ($thin_arrow_name eq '->set_raw') {
100             $cpp_source_group->{CPP} .= '.set_raw' . $left_paren;
101             }
102             else {
103             $cpp_source_group->{CPP} .= $thin_arrow_name . $left_paren;
104             }
105              
106             if ( exists $arguments_optional->{children}->[0] ) {
107             $cpp_source_subgroup = $arguments_optional->{children}->[0]
108             ->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
109             RPerl::Generator::source_group_append( $cpp_source_group,
110             $cpp_source_subgroup );
111             }
112              
113             $cpp_source_group->{CPP} .= $right_paren;
114             return $cpp_source_group;
115             };
116              
117             1; # end of class