mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 07:19:22 +00:00
delegate to parent adapter (if any) in default behavior
This commit is contained in:
parent
75ae2096f4
commit
4d724291c8
@ -1210,12 +1210,16 @@ public class PrinterAdapter {
|
||||
* (default will keep order of appearance in the source code).
|
||||
*/
|
||||
public Comparator<ExtendedElement> getClassMemberComparator() {
|
||||
return new Comparator<ExtendedElement>() {
|
||||
@Override
|
||||
public int compare(ExtendedElement e1, ExtendedElement e2) {
|
||||
return e1.getStartSourcePosition() - e2.getStartSourcePosition();
|
||||
}
|
||||
};
|
||||
if (parentAdapter == null) {
|
||||
return new Comparator<ExtendedElement>() {
|
||||
@Override
|
||||
public int compare(ExtendedElement e1, ExtendedElement e2) {
|
||||
return e1.getStartSourcePosition() - e2.getStartSourcePosition();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return parentAdapter.getClassMemberComparator();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1230,7 +1234,7 @@ public class PrinterAdapter {
|
||||
* (default is false)
|
||||
*/
|
||||
public boolean substituteVariableDeclarationKeyword(VariableElement variable) {
|
||||
return false;
|
||||
return parentAdapter == null ? false : parentAdapter.substituteVariableDeclarationKeyword(variable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user