Skip to content

Commit 448bf32

Browse files
authored
Merge pull request #26 from egorklementev/master
FEATURE: class decl. translation
2 parents abb8d4f + 3fc2695 commit 448bf32

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/java/translator/Declarations.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
import eotree.EOBnd;
44
import eotree.EOBndExpr;
5+
import tree.Declaration.ClassDeclaration;
56
import tree.Declaration.Declaration;
67
import tree.Declaration.MethodDeclaration;
8+
import tree.Declaration.NormalClassDeclaration;
79

810
public class Declarations {
911

1012
public static EOBndExpr mapDeclaration(Declaration dec) {
1113
if (dec instanceof MethodDeclaration) {
1214
return Methods.mapMethodDeclaration((MethodDeclaration) dec);
15+
}
16+
else if (dec instanceof NormalClassDeclaration) {
17+
return (EOBndExpr) Classes.mapClass((ClassDeclaration) dec);
1318
} else
1419
throw new IllegalArgumentException("Declaration of type " +
1520
dec.getClass().getSimpleName()

src/test/java/common/TestJ2EO.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ private ArrayList<DynamicTest> testChapter(String chapterPath) {
138138

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

0 commit comments

Comments
 (0)