support private method invocation in assign statement

This commit is contained in:
金戟 2021-01-07 18:55:33 +08:00
parent 851ae91406
commit 860fdcf072

View File

@ -103,8 +103,12 @@ public class EnablePrivateAccessTranslator extends BaseTranslator {
} }
} }
/**
* var = d.privateMethod(args) var = PrivateAccessor.invoke(d, "privateMethod", args)
*/
@Override @Override
public void visitVarDef(JCVariableDecl jcVariableDecl) { public void visitVarDef(JCVariableDecl jcVariableDecl) {
jcVariableDecl.init = checkAndExchange(jcVariableDecl.init);
super.visitVarDef(jcVariableDecl); super.visitVarDef(jcVariableDecl);
if (jcVariableDecl.vartype.getClass().equals(JCIdent.class) && if (jcVariableDecl.vartype.getClass().equals(JCIdent.class) &&
((JCIdent)jcVariableDecl.vartype).name.equals(sourceClassName)) { ((JCIdent)jcVariableDecl.vartype).name.equals(sourceClassName)) {