@@ -125,7 +125,7 @@ class java_bytecode_parsert:public parsert
125
125
void rRuntimeAnnotation_attribute (annotationst &);
126
126
void rRuntimeAnnotation (annotationt &);
127
127
void relement_value_pairs (annotationt::element_value_pairst &);
128
- void relement_value_pair (annotationt::element_value_pairt & );
128
+ exprt get_relement_value ( );
129
129
void rmethod_attribute (methodt &method);
130
130
void rfield_attribute (fieldt &);
131
131
void rcode_attribute (methodt &method);
@@ -1507,16 +1507,14 @@ void java_bytecode_parsert::relement_value_pairs(
1507
1507
{
1508
1508
u2 element_name_index=read_u2 ();
1509
1509
element_value_pair.element_name =pool_entry (element_name_index).s ;
1510
-
1511
- relement_value_pair (element_value_pair);
1510
+ element_value_pair.value = get_relement_value ();
1512
1511
}
1513
1512
}
1514
1513
1515
1514
// / Corresponds to the element_value structure
1516
1515
// / Described in Java 8 specification 4.7.16.1
1517
1516
// / https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.16.1
1518
- void java_bytecode_parsert::relement_value_pair (
1519
- annotationt::element_value_pairt &element_value_pair)
1517
+ exprt java_bytecode_parsert::get_relement_value ()
1520
1518
{
1521
1519
u1 tag=read_u1 ();
1522
1520
@@ -1527,50 +1525,46 @@ void java_bytecode_parsert::relement_value_pair(
1527
1525
UNUSED_u2 (type_name_index);
1528
1526
UNUSED_u2 (const_name_index);
1529
1527
// todo: enum
1528
+ return exprt ();
1530
1529
}
1531
- break ;
1532
1530
1533
1531
case ' c' :
1534
1532
{
1535
1533
u2 class_info_index = read_u2 ();
1536
- element_value_pair. value = symbol_exprt (pool_entry (class_info_index).s );
1534
+ return symbol_exprt (pool_entry (class_info_index).s );
1537
1535
}
1538
- break ;
1539
1536
1540
1537
case ' @' :
1541
1538
{
1539
+ // TODO: return this wrapped in an exprt
1542
1540
// another annotation, recursively
1543
1541
annotationt annotation;
1544
1542
rRuntimeAnnotation (annotation);
1543
+ return exprt ();
1545
1544
}
1546
- break ;
1547
1545
1548
1546
case ' [' :
1549
1547
{
1548
+ array_exprt values;
1550
1549
u2 num_values=read_u2 ();
1551
1550
for (std::size_t i=0 ; i<num_values; i++)
1552
1551
{
1553
- annotationt::element_value_pairt element_value;
1554
- relement_value_pair (element_value); // recursive call
1552
+ values.operands ().push_back (get_relement_value ());
1555
1553
}
1554
+ return values;
1556
1555
}
1557
- break ;
1558
1556
1559
1557
case ' s' :
1560
1558
{
1561
1559
u2 const_value_index=read_u2 ();
1562
- element_value_pair.value =string_constantt (
1563
- pool_entry (const_value_index).s );
1560
+ return string_constantt (pool_entry (const_value_index).s );
1564
1561
}
1565
- break ;
1566
1562
1567
1563
default :
1568
1564
{
1569
1565
u2 const_value_index=read_u2 ();
1570
- element_value_pair. value = constant (const_value_index);
1566
+ return constant (const_value_index);
1571
1567
}
1572
-
1573
- break ;
1574
1568
}
1575
1569
}
1576
1570
0 commit comments