mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-14 23:09:22 +00:00
move the overload method name generation to the adapter layer (for custom naming)
This commit is contained in:
parent
850104f6b2
commit
6763804c19
@ -3209,20 +3209,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
|
||||
}
|
||||
|
||||
private String getOverloadMethodName(MethodSymbol method) {
|
||||
//return getAdapter().getOverloadMethodName(method);
|
||||
if (method.isConstructor()) {
|
||||
return "constructor";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(method.getSimpleName().toString());
|
||||
sb.append("$");
|
||||
for (VarSymbol p : method.getParameters()) {
|
||||
sb.append(context.types.erasure(p.type).toString().replace('.', '_').replace("[]", "_A"));
|
||||
sb.append("$");
|
||||
}
|
||||
if (!method.getParameters().isEmpty()) {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
return sb.toString();
|
||||
return getAdapter().getOverloadName(method);
|
||||
}
|
||||
|
||||
private void checkType(TypeSymbol type) {
|
||||
|
||||
@ -1285,14 +1285,14 @@ public class PrinterAdapter {
|
||||
* @param exectuable the executable to get the overload name
|
||||
* @return the overload name
|
||||
*/
|
||||
public String getOverloadMethodName(ExecutableElement executable) {
|
||||
public String getOverloadName(ExecutableElement executable) {
|
||||
if (executable.getKind() == ElementKind.CONSTRUCTOR) {
|
||||
return "constructor";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(executable.getSimpleName().toString());
|
||||
sb.append("$");
|
||||
for (VariableElement p : executable.getParameters()) {
|
||||
sb.append(types.erasure(p.asType()).toString().replace('.', '_').replace("[]", "_A"));
|
||||
sb.append(types().erasure(p.asType()).toString().replace('.', '_').replace("[]", "_A"));
|
||||
sb.append("$");
|
||||
}
|
||||
if (!executable.getParameters().isEmpty()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user