Skip to content

Commit

Permalink
Merge pull request #26 from egorklementev/master
Browse files Browse the repository at this point in the history
FEATURE: class decl. translation
  • Loading branch information
IamMaxim committed Oct 25, 2021
2 parents abb8d4f + 3fc2695 commit 448bf32
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/translator/Declarations.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

import eotree.EOBnd;
import eotree.EOBndExpr;
import tree.Declaration.ClassDeclaration;
import tree.Declaration.Declaration;
import tree.Declaration.MethodDeclaration;
import tree.Declaration.NormalClassDeclaration;

public class Declarations {

public static EOBndExpr mapDeclaration(Declaration dec) {
if (dec instanceof MethodDeclaration) {
return Methods.mapMethodDeclaration((MethodDeclaration) dec);
}
else if (dec instanceof NormalClassDeclaration) {
return (EOBndExpr) Classes.mapClass((ClassDeclaration) dec);
} else
throw new IllegalArgumentException("Declaration of type " +
dec.getClass().getSimpleName()
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/common/TestJ2EO.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ private ArrayList<DynamicTest> testChapter(String chapterPath) {

private static DynamicTest testFile(Path path) {
return DynamicTest.dynamicTest(
path.getFileName().toString(), () -> {
path.getParent().getFileName().toString() + "/" +
path.getFileName().toString(), () -> {
// Compile and execute Java file
String javaExecOutput = compileAndExecuteJava(path);

Expand Down

0 comments on commit 448bf32

Please sign in to comment.