Skip to content

Commit 712df8f

Browse files
author
Lukasz A.J. Wrona
committed
Combine create_synthetic_symbol and create_synthetic_type
1 parent 2aa5835 commit 712df8f

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

jbmc/src/java_bytecode/lambda_synthesis.cpp

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static optionalt<irep_idt> interface_method_id(
118118
return implemented_interface_type.methods().at(0).get_name();
119119
}
120120

121-
const java_class_typet synthetic_class_type(
121+
symbolt synthetic_class_symbol(
122122
const irep_idt &synthetic_class_name,
123123
const irep_idt &lambda_method_name,
124124
const struct_tag_typet &implemented_interface_tag,
@@ -163,7 +163,11 @@ const java_class_typet synthetic_class_type(
163163
synthetic_class_type.components().emplace_back(std::move(new_field));
164164
}
165165
}
166-
return synthetic_class_type;
166+
167+
type_symbolt synthetic_class_symbol(synthetic_class_type);
168+
synthetic_class_symbol.name = synthetic_class_name;
169+
synthetic_class_symbol.mode = ID_java;
170+
return synthetic_class_symbol;
167171
}
168172

169173
static symbolt create_constructor_symbol(
@@ -328,12 +332,6 @@ void create_invokedynamic_synthetic_classes(
328332
const irep_idt synthetic_class_name =
329333
lambda_synthetic_class_name(method_identifier, instruction.address);
330334

331-
const java_class_typet synthetic_class_type = ::synthetic_class_type(
332-
synthetic_class_name,
333-
*lambda_method_name,
334-
implemented_interface_tag,
335-
dynamic_method_type);
336-
337335
symbol_table.add(create_constructor_symbol(
338336
synthetic_methods, synthetic_class_name, dynamic_method_type));
339337

@@ -343,14 +341,11 @@ void create_invokedynamic_synthetic_classes(
343341
implemented_interface_tag,
344342
synthetic_class_name));
345343

346-
// Register class symbol:
347-
348-
symbol_table.add([&] {
349-
type_symbolt synthetic_class_symbol(synthetic_class_type);
350-
synthetic_class_symbol.name = synthetic_class_name;
351-
synthetic_class_symbol.mode = ID_java;
352-
return synthetic_class_symbol;
353-
}());
344+
symbol_table.add(synthetic_class_symbol(
345+
synthetic_class_name,
346+
*lambda_method_name,
347+
implemented_interface_tag,
348+
dynamic_method_type));
354349
}
355350
}
356351
}

0 commit comments

Comments
 (0)