Skip to content

Commit

Permalink
fix: include classpath for all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddie authored and Eddie committed Jun 3, 2024
1 parent de7eaf8 commit 2da02fd
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 142 deletions.
Binary file modified out/artifacts/jungle_jar/jungle.jar
Binary file not shown.
17 changes: 4 additions & 13 deletions src/main/java/com/jungle/compiler/visitor/AssertVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class AssertVisitor implements IVisitor {
public class AssertVisitor extends AbstractClassPathVisitor {
@NotNull
private static final FileLogger logger = new FileLogger(AssertVisitor.class.getName());

Expand All @@ -36,22 +36,13 @@ private OperandStackContext getOperandStackContext() {
@NotNull
private ExpressionVisitor getExpressionVisitor() {
if (expressionVisitor == null) {
expressionVisitor = new ExpressionVisitor();
expressionVisitor = new ExpressionVisitor(getClassPath());
}
return expressionVisitor;
}

private AssertVisitor(
@NotNull final OperandStackContext operandStackContext,
@NotNull final ExpressionVisitor expressionVisitor
) {
super();
this.operandStackContext = operandStackContext;
this.expressionVisitor = expressionVisitor;
}

public AssertVisitor() {
super();
public AssertVisitor(@NotNull final String classPath) {
super(classPath);
}

@Override
Expand Down
17 changes: 4 additions & 13 deletions src/main/java/com/jungle/compiler/visitor/AssignmentVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.MethodVisitor;

public class AssignmentVisitor implements IVisitor {
public class AssignmentVisitor extends AbstractClassPathVisitor {
@NotNull
private static final FileLogger logger = new FileLogger(AssignmentVisitor.class.getName());

Expand All @@ -29,22 +29,13 @@ private OperandStackContext getOperandStackContext() {
@NotNull
private ExpressionVisitor getExpressionVisitor() {
if (expressionVisitor == null) {
expressionVisitor = new ExpressionVisitor();
expressionVisitor = new ExpressionVisitor(getClassPath());
}
return expressionVisitor;
}

private AssignmentVisitor(
@Nullable OperandStackContext operandStackContext,
@Nullable ExpressionVisitor expressionVisitor
) {
super();
this.operandStackContext = operandStackContext;
this.expressionVisitor = expressionVisitor;
}

public AssignmentVisitor() {
super();
public AssignmentVisitor(@NotNull final String classPath) {
super(classPath);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.HashSet;
import java.util.Set;

public class BooleanOperatorVisitor implements IVisitor {
public class BooleanOperatorVisitor extends AbstractClassPathVisitor {
@NotNull
private static final FileLogger logger = new FileLogger(BooleanOperatorVisitor.class.getName());

Expand Down Expand Up @@ -42,18 +42,13 @@ public class BooleanOperatorVisitor implements IVisitor {
@NotNull
private IfVisitor getIfVisitor() {
if (ifVisitor == null) {
ifVisitor = new IfVisitor();
ifVisitor = new IfVisitor(getClassPath());
}
return ifVisitor;
}

private BooleanOperatorVisitor(@NotNull final IfVisitor ifVisitor) {
super();
this.ifVisitor = ifVisitor;
}

public BooleanOperatorVisitor() {
super();
public BooleanOperatorVisitor(@NotNull final String classPath) {
super(classPath);
}

@Override
Expand Down
17 changes: 4 additions & 13 deletions src/main/java/com/jungle/compiler/visitor/CastIntegerVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class CastIntegerVisitor implements IVisitor {
public class CastIntegerVisitor extends AbstractClassPathVisitor {
@NotNull
private static final FileLogger logger = new FileLogger(CastIntegerVisitor.class.getName());

Expand All @@ -31,22 +31,13 @@ private OperandStackContext getOperandStackContext() {
@NotNull
private ExpressionVisitor getExpressionVisitor() {
if (expressionVisitor == null) {
expressionVisitor = new ExpressionVisitor();
expressionVisitor = new ExpressionVisitor(getClassPath());
}
return expressionVisitor;
}

private CastIntegerVisitor(
@NotNull final OperandStackContext operandStackContext,
@NotNull final ExpressionVisitor expressionVisitor
) {
super();
this.operandStackContext = operandStackContext;
this.expressionVisitor = expressionVisitor;
}

public CastIntegerVisitor() {
super();
public CastIntegerVisitor(@NotNull final String classPath) {
super(classPath);
}

@Override
Expand Down
27 changes: 6 additions & 21 deletions src/main/java/com/jungle/compiler/visitor/ExpressionVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.jetbrains.annotations.Nullable;
import org.objectweb.asm.MethodVisitor;

public class ExpressionVisitor implements IVisitor {
public class ExpressionVisitor extends AbstractClassPathVisitor {
@NotNull
private static final FileLogger logger = new FileLogger(ExpressionVisitor.class.getName());

Expand Down Expand Up @@ -39,7 +39,7 @@ private LiteralVisitor getLiteralVisitor() {
@NotNull
private NumericOperatorVisitor getNumericOperatorVisitor() {
if (numericOperatorVisitor == null) {
numericOperatorVisitor = new NumericOperatorVisitor();
numericOperatorVisitor = new NumericOperatorVisitor(getClassPath());
}
return numericOperatorVisitor;
}
Expand All @@ -50,7 +50,7 @@ private NumericOperatorVisitor getNumericOperatorVisitor() {
@NotNull
private CastIntegerVisitor getCastIntegerVisitor() {
if (castIntegerVisitor == null) {
castIntegerVisitor = new CastIntegerVisitor();
castIntegerVisitor = new CastIntegerVisitor(getClassPath());
}
return castIntegerVisitor;
}
Expand All @@ -60,28 +60,13 @@ private CastIntegerVisitor getCastIntegerVisitor() {
@NotNull
private BooleanOperatorVisitor getBooleanOperatorVisitor() {
if (booleanOperatorVisitor == null) {
booleanOperatorVisitor = new BooleanOperatorVisitor();
booleanOperatorVisitor = new BooleanOperatorVisitor(getClassPath());
}
return booleanOperatorVisitor;
}

private ExpressionVisitor(
@Nullable IdentifierVisitor identifierVisitor,
@Nullable LiteralVisitor literalVisitor,
@Nullable NumericOperatorVisitor numericOperatorVisitor,
@Nullable CastIntegerVisitor castIntegerVisitor,
@Nullable BooleanOperatorVisitor booleanOperatorVisitor
) {
super();
this.identifierVisitor = identifierVisitor;
this.literalVisitor = literalVisitor;
this.numericOperatorVisitor = numericOperatorVisitor;
this.castIntegerVisitor = castIntegerVisitor;
this.booleanOperatorVisitor = booleanOperatorVisitor;
}

public ExpressionVisitor() {
super();
public ExpressionVisitor(@NotNull final String classPath) {
super(classPath);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ private OperandStackContext getOperandStackContext() {
return operandStackContext;
}

private IdentifierVisitor(@Nullable OperandStackContext operandStackContext) {
super();
this.operandStackContext = operandStackContext;
}

public IdentifierVisitor() {
super();
}
Expand Down
21 changes: 5 additions & 16 deletions src/main/java/com/jungle/compiler/visitor/IfVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class IfVisitor implements IVisitor {
public class IfVisitor extends AbstractClassPathVisitor {
@NotNull
private static final FileLogger logger = new FileLogger(IfVisitor.class.getName());

Expand All @@ -33,7 +33,7 @@ private OperandStackContext getOperandStackContext() {
@NotNull
private ExpressionVisitor getExpressionVisitor() {
if (expressionVisitor == null) {
expressionVisitor = new ExpressionVisitor();
expressionVisitor = new ExpressionVisitor(getClassPath());
}
return expressionVisitor;
}
Expand All @@ -44,24 +44,13 @@ private ExpressionVisitor getExpressionVisitor() {
@NotNull
private BlockVisitor getBlockVisitor() {
if (blockVisitor == null) {
blockVisitor = new BlockVisitor();
blockVisitor = new BlockVisitor(getClassPath());
}
return blockVisitor;
}

public IfVisitor(
@NotNull final OperandStackContext operandStackContext,
@NotNull final ExpressionVisitor expressionVisitor,
@NotNull final BlockVisitor blockVisitor
) {
super();
this.operandStackContext = operandStackContext;
this.expressionVisitor = expressionVisitor;
this.blockVisitor = blockVisitor;
}

public IfVisitor() {
super();
public IfVisitor(@NotNull final String classPath) {
super(classPath);
}

@Override
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/jungle/compiler/visitor/LiteralVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ private OperandStackContext getOperandStackContext() {
return operandStackContext;
}

private LiteralVisitor(@NotNull final OperandStackContext operandStackContext) {
super();
this.operandStackContext = operandStackContext;
}

public LiteralVisitor() {
super();
}
Expand Down
21 changes: 5 additions & 16 deletions src/main/java/com/jungle/compiler/visitor/LoopVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

public class LoopVisitor implements IVisitor {
public class LoopVisitor extends AbstractClassPathVisitor {
@NotNull
private static final FileLogger logger = new FileLogger(LoopVisitor.class.getName());

Expand All @@ -32,7 +32,7 @@ private OperandStackContext getOperandStackContext() {
@NotNull
private ExpressionVisitor getExpressionVisitor() {
if (expressionVisitor == null) {
expressionVisitor = new ExpressionVisitor();
expressionVisitor = new ExpressionVisitor(getClassPath());
}
return expressionVisitor;
}
Expand All @@ -43,24 +43,13 @@ private ExpressionVisitor getExpressionVisitor() {
@NotNull
private BlockVisitor getBlockVisitor() {
if (blockVisitor == null) {
blockVisitor = new BlockVisitor();
blockVisitor = new BlockVisitor(getClassPath());
}
return blockVisitor;
}

public LoopVisitor(
@NotNull final OperandStackContext operandStackContext,
@NotNull final ExpressionVisitor expressionVisitor,
@NotNull final BlockVisitor blockVisitor
) {
super();
this.operandStackContext = operandStackContext;
this.expressionVisitor = expressionVisitor;
this.blockVisitor = blockVisitor;
}

public LoopVisitor() {
super();
public LoopVisitor(@NotNull final String classPath) {
super(classPath);
}

@Override
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/jungle/compiler/visitor/MainVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private LiteralVisitor getLiteralVisitor() {
@NotNull
private AssignmentVisitor getAssignmentVisitor() {
if (assignmentVisitor == null) {
assignmentVisitor = new AssignmentVisitor();
assignmentVisitor = new AssignmentVisitor(getClassPath());
}
return assignmentVisitor;
}
Expand All @@ -51,7 +51,7 @@ private BlockVisitor getBlockVisitor() {
@NotNull
private AssertVisitor getAssertVisitor() {
if (assertVisitor == null) {
assertVisitor = new AssertVisitor();
assertVisitor = new AssertVisitor(getClassPath());
}
return assertVisitor;
}
Expand All @@ -62,7 +62,7 @@ private AssertVisitor getAssertVisitor() {
@NotNull
private PrintVisitor getPrintVisitor() {
if (printVisitor == null) {
printVisitor = new PrintVisitor();
printVisitor = new PrintVisitor(getClassPath());
}
return printVisitor;
}
Expand All @@ -73,7 +73,7 @@ private PrintVisitor getPrintVisitor() {
@NotNull
private IfVisitor getIfVisitor() {
if (ifVisitor == null) {
ifVisitor = new IfVisitor();
ifVisitor = new IfVisitor(getClassPath());
}
return ifVisitor;
}
Expand All @@ -84,7 +84,7 @@ private IfVisitor getIfVisitor() {
@NotNull
private LoopVisitor getLoopVisitor() {
if (loopVisitor == null) {
loopVisitor = new LoopVisitor();
loopVisitor = new LoopVisitor(getClassPath());
}
return loopVisitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import static com.jungle.ast.NodeType.*;

public class NumericOperatorVisitor implements IVisitor {
public class NumericOperatorVisitor extends AbstractClassPathVisitor {
@NotNull
private static final FileLogger logger = new FileLogger(NumericOperatorVisitor.class.getName());

Expand Down Expand Up @@ -46,22 +46,13 @@ private OperandStackContext getOperandStackContext() {
@NotNull
public ExpressionVisitor getExpressionVisitor() {
if (expressionVisitor == null) {
expressionVisitor = new ExpressionVisitor();
expressionVisitor = new ExpressionVisitor(getClassPath());
}
return expressionVisitor;
}

public NumericOperatorVisitor(
@NotNull final OperandStackContext operandStackContext,
@NotNull final ExpressionVisitor expressionVisitor
) {
super();
this.operandStackContext = operandStackContext;
this.expressionVisitor = expressionVisitor;
}

public NumericOperatorVisitor() {
super();
public NumericOperatorVisitor(@NotNull final String classPath) {
super(classPath);
}

@Override
Expand Down
Loading

0 comments on commit 2da02fd

Please sign in to comment.