Skip to content

Commit b25301e

Browse files
author
thk123
committed
Remove redundant method and constructor setter
1 parent c84cf21 commit b25301e

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

src/java_bytecode/java_bytecode_convert_method.cpp

+14-22
Original file line numberDiff line numberDiff line change
@@ -518,25 +518,12 @@ void java_bytecode_convert_methodt::convert(
518518
param_index==slots_for_parameters,
519519
"java_parameter_count and local computation must agree");
520520

521-
const bool is_virtual=!m.is_static && !m.is_final;
522-
523-
// Construct a methodt, which lives within the class type; this object is
524-
// never used for anything useful and could be removed
525-
class_typet::methodt method;
526-
method.set_base_name(m.base_name);
527-
method.set_name(method_identifier);
528-
method.set(ID_abstract, m.is_abstract);
529-
method.set(ID_is_virtual, is_virtual);
530-
method.type()=member_type;
531-
if(is_constructor(method))
532-
method.set(ID_constructor, true);
533-
534521
// Check the fields that can't change are valid
535522
INVARIANT(
536-
method_symbol.name==method.get_name(),
523+
method_symbol.name==method_identifier,
537524
"Name of method symbol shouldn't change");
538525
INVARIANT(
539-
method_symbol.base_name==method.get_base_name(),
526+
method_symbol.base_name==m.base_name,
540527
"Base name of method symbol shouldn't change");
541528
INVARIANT(
542529
method_symbol.module.empty(),
@@ -550,16 +537,21 @@ void java_bytecode_convert_methodt::convert(
550537
// The pretty name of a constructor includes the base name of the class
551538
// instead of the internal method name "<init>". For regular methods, it's
552539
// just the base name of the method.
553-
if(method.get_base_name()=="<init>")
554-
method_symbol.pretty_name=id2string(class_symbol.pretty_name)+"."+
555-
id2string(class_symbol.base_name)+"()";
540+
if(method_symbol.base_name=="<init>")
541+
{
542+
method_symbol.pretty_name = id2string(class_symbol.pretty_name) + "." +
543+
id2string(class_symbol.base_name) + "()";
544+
INVARIANT(
545+
member_type.get_bool(ID_constructor),
546+
"Member type should have already been marked as a constructor");
547+
}
556548
else
557-
method_symbol.pretty_name=id2string(class_symbol.pretty_name)+"."+
558-
id2string(method.get_base_name())+"()";
549+
{
550+
method_symbol.pretty_name = id2string(class_symbol.pretty_name) + "." +
551+
id2string(m.base_name) + "()";
552+
}
559553

560554
method_symbol.type=member_type;
561-
if(is_constructor(method))
562-
method_symbol.type.set(ID_constructor, true);
563555

564556
current_method=method_symbol.name;
565557
method_has_this=code_type.has_this();

0 commit comments

Comments
 (0)