mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Rename achieved -> reached. Fix - operator generation in minified mode
This commit is contained in:
parent
bb16e891b9
commit
2640234391
|
@ -52,7 +52,7 @@ public class SystemNativeGenerator implements Generator, DependencyPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void methodAchieved(DependencyAgent agent, MethodDependency method, CallLocation location) {
|
||||
public void methodReached(DependencyAgent agent, MethodDependency method, CallLocation location) {
|
||||
switch (method.getReference().getName()) {
|
||||
case "doArrayCopy":
|
||||
achieveArrayCopy(method);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ArrayNativeGenerator implements Generator, DependencyPlugin {
|
|||
ValueType.INTEGER, ValueType.LONG, ValueType.FLOAT, ValueType.DOUBLE, ValueType.BOOLEAN };
|
||||
|
||||
@Override
|
||||
public void methodAchieved(DependencyAgent agent, MethodDependency method, CallLocation location) {
|
||||
public void methodReached(DependencyAgent agent, MethodDependency method, CallLocation location) {
|
||||
switch (method.getReference().getName()) {
|
||||
case "getLength":
|
||||
achieveGetLength(agent, method);
|
||||
|
|
|
@ -382,7 +382,7 @@ public class DependencyChecker implements DependencyInfo {
|
|||
private void activateDependencyPlugin(MethodDependency methodDep, CallLocation location) {
|
||||
attachDependencyPlugin(methodDep);
|
||||
if (methodDep.dependencyPlugin != null) {
|
||||
methodDep.dependencyPlugin.methodAchieved(agent, methodDep, location);
|
||||
methodDep.dependencyPlugin.methodReached(agent, methodDep, location);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,5 +22,5 @@ import org.teavm.model.CallLocation;
|
|||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface DependencyPlugin {
|
||||
void methodAchieved(DependencyAgent agent, MethodDependency method, CallLocation location);
|
||||
void methodReached(DependencyAgent agent, MethodDependency method, CallLocation location);
|
||||
}
|
||||
|
|
|
@ -1525,8 +1525,6 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
|||
case NEGATE:
|
||||
if (outerPrecedence.ordinal() > Precedence.UNARY.ordinal()) {
|
||||
writer.append('(');
|
||||
} else if (outerPrecedence.ordinal() >= Precedence.ADDITION.ordinal()) {
|
||||
writer.append(' ');
|
||||
}
|
||||
writer.append(" -");
|
||||
precedence = Precedence.UNARY;
|
||||
|
@ -1664,16 +1662,9 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
|||
}
|
||||
String str = constantToString(expr.getValue());
|
||||
if (str.startsWith("-")) {
|
||||
if (precedence.ordinal() >= Precedence.UNARY.ordinal()) {
|
||||
writer.append('(');
|
||||
} else {
|
||||
writer.append(' ');
|
||||
}
|
||||
}
|
||||
writer.append(str);
|
||||
if (str.startsWith("-") && precedence.ordinal() >= Precedence.UNARY.ordinal()) {
|
||||
writer.append(')');
|
||||
}
|
||||
if (expr.getLocation() != null) {
|
||||
popLocation();
|
||||
}
|
||||
|
|
|
@ -717,13 +717,16 @@ public class AstWriter {
|
|||
private void printUnary(UnaryExpression node, int precedence) throws IOException {
|
||||
int innerPrecedence = node.isPostfix() ? PRECEDENCE_POSTFIX : PRECEDENCE_PREFIX;
|
||||
|
||||
|
||||
if (innerPrecedence > precedence) {
|
||||
writer.append('(');
|
||||
}
|
||||
|
||||
if (!node.isPostfix()) {
|
||||
writer.append(AstNode.operatorToString(node.getType()));
|
||||
String op = AstNode.operatorToString(node.getType());
|
||||
if (op.startsWith("-")) {
|
||||
writer.append(' ');
|
||||
}
|
||||
writer.append(op);
|
||||
if (requiresWhitespaces(node.getType())) {
|
||||
writer.append(' ');
|
||||
}
|
||||
|
@ -768,13 +771,14 @@ public class AstWriter {
|
|||
}
|
||||
print(node.getLeft(), leftPrecedence);
|
||||
|
||||
String op = AstNode.operatorToString(node.getType());
|
||||
boolean ws = requiresWhitespaces(node.getType());
|
||||
if (ws) {
|
||||
if (ws || op.startsWith("-")) {
|
||||
writer.append(' ');
|
||||
} else {
|
||||
writer.ws();
|
||||
}
|
||||
writer.append(AstNode.operatorToString(node.getType()));
|
||||
writer.append(op);
|
||||
if (ws) {
|
||||
writer.append(' ');
|
||||
} else {
|
||||
|
|
|
@ -169,7 +169,7 @@ public class JSNativeGenerator implements Injector, DependencyPlugin, Generator
|
|||
}
|
||||
|
||||
@Override
|
||||
public void methodAchieved(final DependencyAgent agent, final MethodDependency method,
|
||||
public void methodReached(final DependencyAgent agent, final MethodDependency method,
|
||||
final CallLocation location) {
|
||||
switch (method.getReference().getName()) {
|
||||
case "invoke":
|
||||
|
|
|
@ -98,7 +98,7 @@ public class AsyncMethodGenerator implements Generator, DependencyPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void methodAchieved(DependencyAgent checker, MethodDependency method, CallLocation location) {
|
||||
public void methodReached(DependencyAgent checker, MethodDependency method, CallLocation location) {
|
||||
MethodReference ref = method.getReference();
|
||||
MethodReference asyncRef = getAsyncReference(ref);
|
||||
MethodDependency asyncMethod = checker.linkMethod(asyncRef, location);
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.teavm.platform.PlatformRunnable;
|
|||
*/
|
||||
public class PlatformGenerator implements Generator, Injector, DependencyPlugin {
|
||||
@Override
|
||||
public void methodAchieved(DependencyAgent agent, MethodDependency method, CallLocation location) {
|
||||
public void methodReached(DependencyAgent agent, MethodDependency method, CallLocation location) {
|
||||
switch (method.getReference().getName()) {
|
||||
case "asJavaClass":
|
||||
method.getResult().propagate(agent.getType("java.lang.Class"));
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.teavm.platform.PlatformQueue;
|
|||
*/
|
||||
public class PlatformQueueGenerator implements Injector, DependencyPlugin {
|
||||
@Override
|
||||
public void methodAchieved(DependencyAgent agent, MethodDependency method, CallLocation location) {
|
||||
public void methodReached(DependencyAgent agent, MethodDependency method, CallLocation location) {
|
||||
MethodDependency addMethod = agent.linkMethod(new MethodReference(PlatformQueue.class, "wrap",
|
||||
Object.class, PlatformObject.class), null);
|
||||
addMethod.getVariable(1).connect(method.getResult());
|
||||
|
|
Loading…
Reference in New Issue
Block a user