-
Notifications
You must be signed in to change notification settings - Fork 275
Pretty constructors in java parse tree #2152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,9 @@ class java_bytecode_parse_treet | |
bool is_public, is_protected, is_private, is_static, is_final; | ||
annotationst annotations; | ||
|
||
virtual void output(std::ostream &out) const = 0; | ||
virtual void output( | ||
const irep_idt &class_name, | ||
std::ostream &out) const = 0; | ||
|
||
membert(): | ||
is_public(false), is_protected(false), | ||
|
@@ -80,6 +82,12 @@ class java_bytecode_parse_treet | |
{ | ||
public: | ||
irep_idt base_name; | ||
|
||
bool is_constructor() const | ||
{ | ||
return base_name=="<init>"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nooo - this re-duplicates the check that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that |
||
} | ||
|
||
bool is_native, is_abstract, is_synchronized; | ||
source_locationt source_location; | ||
|
||
|
@@ -155,7 +163,9 @@ class java_bytecode_parse_treet | |
typedef std::vector<stack_map_table_entryt> stack_map_tablet; | ||
stack_map_tablet stack_map_table; | ||
|
||
virtual void output(std::ostream &out) const; | ||
void output( | ||
const irep_idt &class_name, | ||
std::ostream &out) const override; | ||
|
||
methodt(): | ||
is_native(false), | ||
|
@@ -171,7 +181,11 @@ class java_bytecode_parse_treet | |
{ | ||
public: | ||
virtual ~fieldt() = default; | ||
virtual void output(std::ostream &out) const; | ||
|
||
void output( | ||
const irep_idt &class_name, | ||
std::ostream &out) const override; | ||
|
||
bool is_enum; | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like something the
methodt
should store rather than something every user has to pass tooutput()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this would be an antipattern; its not unusual to require context for output, say think of indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is reasonable to pass this in, I also think it is reasonable for the method to know what class it belongs to FWIW.