mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 07:19:22 +00:00
ability to substitute method overload in adapter
This commit is contained in:
parent
ec4b74d740
commit
659e715b1b
@ -2548,6 +2548,10 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
|
||||
}
|
||||
|
||||
private void printCoreOverloadMethod(JCMethodDecl methodDecl, JCClassDecl parent, Overload overload) {
|
||||
if (getAdapter().substituteOverloadMethodBody(parent.sym, overload)) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean wasPrinted = false;
|
||||
for (int i = 0; i < overload.methods.size(); i++) {
|
||||
JCMethodDecl method = overload.methods.get(i);
|
||||
|
||||
@ -43,6 +43,7 @@ import org.jsweet.transpiler.JSweetContext;
|
||||
import org.jsweet.transpiler.JSweetOptions;
|
||||
import org.jsweet.transpiler.JSweetProblem;
|
||||
import org.jsweet.transpiler.ModuleImportDescriptor;
|
||||
import org.jsweet.transpiler.OverloadScanner.Overload;
|
||||
import org.jsweet.transpiler.model.ArrayAccessElement;
|
||||
import org.jsweet.transpiler.model.AssignmentElement;
|
||||
import org.jsweet.transpiler.model.AssignmentWithOperatorElement;
|
||||
@ -762,6 +763,17 @@ public class PrinterAdapter {
|
||||
public boolean substituteVariableAccess(VariableAccessElement variableAccess) {
|
||||
return parentAdapter == null ? false : parentAdapter.substituteVariableAccess(variableAccess);
|
||||
}
|
||||
|
||||
/**
|
||||
* Substitutes overloaded method implementation
|
||||
*
|
||||
* @param parentTypeElement parent class
|
||||
* @param overload overloaded method descriptors
|
||||
* @return true if substituted
|
||||
*/
|
||||
public boolean substituteOverloadMethodBody(TypeElement parentTypeElement, Overload overload) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called if the initializer of a variable is undefined (in order to force a
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user