mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 07:54:11 -08:00
This commit is contained in:
parent
a882a4c956
commit
11437af5ae
|
@ -66,32 +66,13 @@ public class DefaultNamingStrategy implements NamingStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNameFor(MethodReference method, char classifier) {
|
private String getNameFor(MethodReference method, char classifier) {
|
||||||
MethodReference origMethod = method;
|
String key = classifier + method.getDescriptor().toString();
|
||||||
method = getRealMethod(method);
|
String alias = aliases.get(key);
|
||||||
if (method == null) {
|
if (alias == null) {
|
||||||
throw new NamingException("Can't provide name for method as it was not found: " + origMethod);
|
alias = aliasProvider.getAlias(method);
|
||||||
}
|
aliases.put(key, alias);
|
||||||
ClassReader clsHolder = classSource.get(method.getClassName());
|
|
||||||
MethodReader methodHolder = clsHolder.getMethod(method.getDescriptor());
|
|
||||||
if (methodHolder.hasModifier(ElementModifier.STATIC) ||
|
|
||||||
method.getDescriptor().getName().equals("<init>") ||
|
|
||||||
methodHolder.getLevel() == AccessLevel.PRIVATE) {
|
|
||||||
String key = classifier + method.toString();
|
|
||||||
String alias = privateAliases.get(key);
|
|
||||||
if (alias == null) {
|
|
||||||
alias = aliasProvider.getAlias(method);
|
|
||||||
privateAliases.put(key, alias);
|
|
||||||
}
|
|
||||||
return alias;
|
|
||||||
} else {
|
|
||||||
String key = classifier + method.getDescriptor().toString();
|
|
||||||
String alias = aliases.get(key);
|
|
||||||
if (alias == null) {
|
|
||||||
alias = aliasProvider.getAlias(method);
|
|
||||||
aliases.put(key, alias);
|
|
||||||
}
|
|
||||||
return alias;
|
|
||||||
}
|
}
|
||||||
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -106,13 +87,13 @@ public class DefaultNamingStrategy implements NamingStrategy {
|
||||||
|
|
||||||
private String getFullNameFor(MethodReference method, char classifier) throws NamingException {
|
private String getFullNameFor(MethodReference method, char classifier) throws NamingException {
|
||||||
MethodReference originalMethod = method;
|
MethodReference originalMethod = method;
|
||||||
if (!minifying) {
|
|
||||||
return getNameFor(method.getClassName()) + "_" + getNameFor(method, classifier);
|
|
||||||
}
|
|
||||||
method = getRealMethod(method);
|
method = getRealMethod(method);
|
||||||
if (method == null) {
|
if (method == null) {
|
||||||
throw new NamingException("Can't provide name for method as it was not found: " + originalMethod);
|
throw new NamingException("Can't provide name for method as it was not found: " + originalMethod);
|
||||||
}
|
}
|
||||||
|
if (!minifying) {
|
||||||
|
return getNameFor(method.getClassName()) + "_" + getNameFor(method, classifier);
|
||||||
|
}
|
||||||
String key = classifier + method.toString();
|
String key = classifier + method.toString();
|
||||||
String alias = privateAliases.get(key);
|
String alias = privateAliases.get(key);
|
||||||
if (alias == null) {
|
if (alias == null) {
|
||||||
|
|
|
@ -1604,7 +1604,6 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
}
|
}
|
||||||
String name = expr.getAsyncTarget() == null ? naming.getNameFor(expr.getMethod()) :
|
String name = expr.getAsyncTarget() == null ? naming.getNameFor(expr.getMethod()) :
|
||||||
naming.getNameForAsync(expr.getMethod());
|
naming.getNameForAsync(expr.getMethod());
|
||||||
String fullName = naming.getFullNameFor(expr.getMethod());
|
|
||||||
DeferredCallSite callSite = prevCallSite;
|
DeferredCallSite callSite = prevCallSite;
|
||||||
boolean shouldEraseCallSite = lastCallSite == null;
|
boolean shouldEraseCallSite = lastCallSite == null;
|
||||||
if (lastCallSite == null) {
|
if (lastCallSite == null) {
|
||||||
|
@ -1615,7 +1614,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
enterPriority(Priority.COMMA, Associativity.NONE, false);
|
enterPriority(Priority.COMMA, Associativity.NONE, false);
|
||||||
switch (expr.getType()) {
|
switch (expr.getType()) {
|
||||||
case STATIC:
|
case STATIC:
|
||||||
writer.append(fullName).append("(");
|
writer.appendMethodBody(expr.getMethod()).append("(");
|
||||||
prevCallSite = debugEmitter.emitCallSite();
|
prevCallSite = debugEmitter.emitCallSite();
|
||||||
for (int i = 0; i < expr.getArguments().size(); ++i) {
|
for (int i = 0; i < expr.getArguments().size(); ++i) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
@ -1626,7 +1625,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SPECIAL:
|
case SPECIAL:
|
||||||
writer.append(fullName).append("(");
|
writer.appendMethodBody(expr.getMethod()).append("(");
|
||||||
prevCallSite = debugEmitter.emitCallSite();
|
prevCallSite = debugEmitter.emitCallSite();
|
||||||
expr.getArguments().get(0).acceptVisitor(this);
|
expr.getArguments().get(0).acceptVisitor(this);
|
||||||
hasParams = true;
|
hasParams = true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user