@@ -43,15 +43,15 @@ struct lambda_assignment_test_datat
43
43
// / \param symbol_table: The loaded symbol table
44
44
// / \param instructions: The instructions of the method that calls invokedynamic
45
45
// / \param test_data: The parameters for the test
46
+ // / \param lambda_assignment: The assignment statement for the lambda method
46
47
void validate_lambda_assignment (
47
48
const symbol_tablet &symbol_table,
48
49
const std::vector<codet> &instructions,
49
50
const lambda_assignment_test_datat &test_data,
50
- const require_goto_statements::pointer_assignment_locationt
51
- &lambda_assignment)
51
+ const code_assignt &lambda_assignment)
52
52
{
53
- const typecast_exprt &rhs_value = require_expr::require_typecast (
54
- lambda_assignment. non_null_assignments [ 0 ] .rhs ());
53
+ const typecast_exprt &rhs_value =
54
+ require_expr::require_typecast ( lambda_assignment.rhs ());
55
55
56
56
const symbol_exprt &rhs_symbol =
57
57
require_expr::require_symbol (rhs_value.op0 ());
@@ -85,15 +85,16 @@ void validate_lambda_assignment(
85
85
const class_typet &tmp_lambda_class_type =
86
86
require_type::require_complete_class (lambda_implementor_type_symbol.type );
87
87
88
- REQUIRE (tmp_lambda_class_type.has_base (test_data.lambda_interface ));
89
88
REQUIRE (tmp_lambda_class_type.has_base (" java::java.lang.Object" ));
89
+ REQUIRE (tmp_lambda_class_type.has_base (test_data.lambda_interface ));
90
90
91
91
class_hierarchyt class_hierarchy;
92
92
class_hierarchy (symbol_table);
93
93
94
94
const auto &parents = class_hierarchy.get_parents_trans (tmp_class_identifier);
95
95
REQUIRE_THAT (
96
96
parents,
97
+ // NOLINTNEXTLINE(whitespace/braces)
97
98
Catch::Matchers::Vector::ContainsElementMatcher<irep_idt>{
98
99
test_data.lambda_interface });
99
100
@@ -102,6 +103,7 @@ void validate_lambda_assignment(
102
103
103
104
REQUIRE_THAT (
104
105
interface_children,
106
+ // NOLINTNEXTLINE(whitespace/braces)
105
107
Catch::Matchers::Vector::ContainsElementMatcher<irep_idt>{
106
108
tmp_class_identifier});
107
109
@@ -111,16 +113,6 @@ void validate_lambda_assignment(
111
113
const symbol_typet &super_class_type = require_type::require_symbol (
112
114
super_class_component.type (), " java::java.lang.Object" );
113
115
114
- const symbolt &base_class_symbol = require_symbol::require_symbol_exists (
115
- symbol_table, super_class_type.get_identifier ());
116
-
117
- REQUIRE (base_class_symbol.is_type );
118
- const class_typet &super_class_type_struct =
119
- require_type::require_incomplete_class (base_class_symbol.type );
120
-
121
- require_type::require_component (super_class_type_struct, " @class_identifier" );
122
- // TODO verify the components of the class have been set correctly
123
-
124
116
THEN (" The function in the class should call the lambda method" )
125
117
{
126
118
const irep_idt method_identifier =
@@ -175,6 +167,11 @@ void validate_lambda_assignment(
175
167
176
168
// / Find the assignment to the lambda and then call validate_lamdba_assignement
177
169
// / for full validation.
170
+ // / \param symbol_table: The loaded symbol table
171
+ // / \param instructions: The instructions of the method that calls invokedynamic
172
+ // / \param test_data: The parameters for the test
173
+ // / \param lambda_variable_id: A regex matching the name of the variable which
174
+ // / stores the lambda
178
175
void validate_local_variable_lambda_assignment (
179
176
const symbol_tablet &symbol_table,
180
177
const std::vector<codet> &instructions,
@@ -189,7 +186,10 @@ void validate_local_variable_lambda_assignment(
189
186
REQUIRE_FALSE (lambda_assignment.null_assignment .has_value ());
190
187
191
188
validate_lambda_assignment (
192
- symbol_table, instructions, test_data, lambda_assignment);
189
+ symbol_table,
190
+ instructions,
191
+ test_data,
192
+ lambda_assignment.non_null_assignments [0 ]);
193
193
}
194
194
195
195
SCENARIO (
@@ -248,6 +248,7 @@ SCENARIO(
248
248
symbol_exprt integer_param{" primitive" , java_int_type ()};
249
249
symbol_exprt ref_param{" reference" ,
250
250
java_type_from_string (" Ljava/lang/Object;" )};
251
+ // NOLINTNEXTLINE(whitespace/braces)
251
252
symbol_exprt generic_param{
252
253
" specalisedGeneric" ,
253
254
java_type_from_string (" LDummyGeneric<Ljava/lang/Interger;>;" )};
@@ -275,6 +276,8 @@ SCENARIO(
275
276
symbol_exprt integer_param{" primitive" , java_type_from_string (" [I" )};
276
277
symbol_exprt ref_param{" reference" ,
277
278
java_type_from_string (" [Ljava/lang/Object;" )};
279
+
280
+ // NOLINTNEXTLINE(whitespace/braces)
278
281
symbol_exprt generic_param{
279
282
" specalisedGeneric" ,
280
283
java_type_from_string (" [LDummyGeneric<Ljava/lang/Interger;>;" )};
@@ -315,7 +318,6 @@ SCENARIO(
315
318
test_data.lambda_interface_method_descriptor =
316
319
" .Execute:()Ljava/lang/Object;" ;
317
320
318
- // "java::LocalLambdas.lambda$test$0:()V"
319
321
test_data.lambda_function_id =
320
322
" java::LocalLambdas.lambda$test$4:()Ljava/lang/Object;" ;
321
323
test_data.expected_params = {};
@@ -348,14 +350,20 @@ SCENARIO(
348
350
function_prefix_regex_str +
349
351
R"( ::\d+::returningSpecalisedGenericLambda$)" ));
350
352
}
351
- // TODO[TG-2482]: Tests for local lambdas that capture variables
353
+ // TODO(tkiley): Tests for local lambdas that capture
354
+ // TODO(tkiley): variables [TG-2482]
352
355
}
353
356
}
354
357
});
355
358
}
356
359
357
360
// / Find the assignment to the lambda in the constructor
358
361
// / and then call validate_lamdba_assignement for full validation.
362
+ // / \param symbol_table: The loaded symbol table
363
+ // / \param instructions: The instructions of the method that calls invokedynamic
364
+ // / \param test_data: The parameters for the test
365
+ // / \param lambda_variable_id: The name of the member variable that stores the
366
+ // / lambda
359
367
void validate_member_variable_lambda_assignment (
360
368
const symbol_tablet &symbol_table,
361
369
const std::vector<codet> &instructions,
@@ -370,7 +378,10 @@ void validate_member_variable_lambda_assignment(
370
378
REQUIRE_FALSE (lambda_assignment.null_assignment .has_value ());
371
379
372
380
validate_lambda_assignment (
373
- symbol_table, instructions, test_data, lambda_assignment);
381
+ symbol_table,
382
+ instructions,
383
+ test_data,
384
+ lambda_assignment.non_null_assignments [0 ]);
374
385
}
375
386
376
387
SCENARIO (
@@ -423,8 +434,9 @@ SCENARIO(
423
434
" (ILjava/lang/Object;LDummyGeneric;)V" ;
424
435
425
436
symbol_exprt integer_param{" primitive" , java_int_type ()};
426
- symbol_exprt ref_param{" reference" ,
437
+ symbol_exprt ref_param{" reference" , // NOLINT(whitespace/braces)
427
438
java_type_from_string (" Ljava/lang/Object;" )};
439
+ // NOLINTNEXTLINE(whitespace/braces)
428
440
symbol_exprt generic_param{
429
441
" specalisedGeneric" ,
430
442
java_type_from_string (" LDummyGeneric<Ljava/lang/Interger;>;" )};
@@ -447,8 +459,9 @@ SCENARIO(
447
459
" ([I[Ljava/lang/Object;[LDummyGeneric;)V" ;
448
460
449
461
symbol_exprt integer_param{" primitive" , java_type_from_string (" [I" )};
450
- symbol_exprt ref_param{" reference" ,
462
+ symbol_exprt ref_param{" reference" , // NOLINT(whitespace/braces)
451
463
java_type_from_string (" [Ljava/lang/Object;" )};
464
+ // NOLINTNEXTLINE(whitespace/braces)
452
465
symbol_exprt generic_param{
453
466
" specalisedGeneric" ,
454
467
java_type_from_string (" [LDummyGeneric<Ljava/lang/Interger;>;" )};
@@ -505,14 +518,20 @@ SCENARIO(
505
518
" returningSpecalisedGenericLambda" );
506
519
}
507
520
508
- // TODO[TG-2486]: Tests for member lambdas that capture member variables
521
+ // TODO(tkiley): Tests for member lambdas that capture member variables
522
+ // TODO(tkiley): [TG-2486]
509
523
}
510
524
}
511
525
});
512
526
}
513
527
514
528
// / Find the assignment to the lambda in the <clinit> and then call
515
529
// / validate_lamdba_assignement for full validation.
530
+ // / \param symbol_table: The loaded symbol table
531
+ // / \param instructions: The instructions of the method that calls invokedynamic
532
+ // / \param test_data: The parameters for the test
533
+ // / \param static_field_name: The name of the static variable that stores the
534
+ // / lambda
516
535
void validate_static_member_variable_lambda_assignment (
517
536
const symbol_tablet &symbol_table,
518
537
const std::vector<codet> &instructions,
@@ -527,7 +546,10 @@ void validate_static_member_variable_lambda_assignment(
527
546
REQUIRE_FALSE (lambda_assignment.null_assignment .has_value ());
528
547
529
548
validate_lambda_assignment (
530
- symbol_table, instructions, test_data, lambda_assignment);
549
+ symbol_table,
550
+ instructions,
551
+ test_data,
552
+ lambda_assignment.non_null_assignments [0 ]);
531
553
}
532
554
533
555
SCENARIO (
@@ -586,6 +608,7 @@ SCENARIO(
586
608
symbol_exprt integer_param{" primitive" , java_int_type ()};
587
609
symbol_exprt ref_param{" reference" ,
588
610
java_type_from_string (" Ljava/lang/Object;" )};
611
+ // NOLINTNEXTLINE(whitespace/braces)
589
612
symbol_exprt generic_param{
590
613
" specalisedGeneric" ,
591
614
java_type_from_string (" LDummyGeneric<Ljava/lang/Interger;>;" )};
@@ -610,6 +633,7 @@ SCENARIO(
610
633
symbol_exprt integer_param{" primitive" , java_type_from_string (" [I" )};
611
634
symbol_exprt ref_param{" reference" ,
612
635
java_type_from_string (" [Ljava/lang/Object;" )};
636
+ // NOLINTNEXTLINE(whitespace/braces)
613
637
symbol_exprt generic_param{
614
638
" specalisedGeneric" ,
615
639
java_type_from_string (" [LDummyGeneric<Ljava/lang/Interger;>;" )};
@@ -667,7 +691,8 @@ SCENARIO(
667
691
" returningSpecalisedGenericLambda" );
668
692
}
669
693
670
- // TODO[TG-2486]: Tests for member lambdas that capture member variables
694
+ // TODO(tkiley): Tests for member lambdas that capture member variables
695
+ // TODO(tkiley): [TG-2486]
671
696
}
672
697
}
673
698
});
0 commit comments