Skip to content

Commit

Permalink
remove debug
Browse files Browse the repository at this point in the history
  • Loading branch information
yusshu committed Dec 26, 2023
1 parent 1b401a5 commit 5153650
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/main/java/team/unnamed/mocha/MochaEngineImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public double eval(List<Expression> expressions) {
Value lastResult = NumberValue.zero();

for (Expression expression : expressions) {
System.out.println(expression);
lastResult = expression.visit(evaluator);
Value returnValue = evaluator.popReturnValue();
if (returnValue != null) {
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/team/unnamed/mocha/runtime/MolangCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
import javassist.CtMethod;
import javassist.NotFoundException;
import javassist.bytecode.Bytecode;
import javassist.bytecode.CodeIterator;
import javassist.bytecode.Descriptor;
import javassist.bytecode.MethodInfo;
import javassist.bytecode.Mnemonic;
import javassist.bytecode.StackMapTable;
import javassist.bytecode.stackmap.MapMaker;
import org.jetbrains.annotations.ApiStatus;
Expand Down Expand Up @@ -208,13 +206,13 @@ public MolangCompiler(final @NotNull ClassLoader classLoader, final @NotNull Glo
method.setCodeAttribute(bytecode.toCodeAttribute());

// print bytecode
final CodeIterator it = method.getCodeAttribute().iterator();
while (it.hasNext()) {
final int index = it.next();
final int opcode = it.byteAt(index);
final String opcodeName = Mnemonic.OPCODE[opcode];
System.out.println(index + " " + opcodeName);
}
// final CodeIterator it = method.getCodeAttribute().iterator();
// while (it.hasNext()) {
// final int index = it.next();
// final int opcode = it.byteAt(index);
// final String opcodeName = Mnemonic.OPCODE[opcode];
// System.out.println(index + " " + opcodeName);
// }

method.getCodeAttribute().computeMaxStack();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ public CompileVisitResult visitCall(final @NotNull CallExpression expression) {
});

if (!(functionValue instanceof Function<?>)) {
System.out.println("not a function: " + functionValue + " for " + functionExpr);
// not a function, just add 0
bytecode.addDconst(0D);
return new CompileVisitResult(CtClass.doubleType);
Expand Down

0 comments on commit 5153650

Please sign in to comment.