From dbe3c6ad7ead5fef7d6dde68c9c53bebe3593fe6 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 1 Mar 2016 21:24:45 +0000 Subject: Get static nested classes working on interpreter --- src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java b/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java index ec6b556..b867dc2 100644 --- a/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java +++ b/src/main/java/org/zwobble/couscous/frontends/java/JavaReader.java @@ -68,6 +68,10 @@ public class JavaReader { private TypeNode readCompilationUnit(CompilationUnit ast) { TypeDeclaration type = (TypeDeclaration)ast.types().get(0); + return readTypeDeclaration(type); + } + + private TypeNode readTypeDeclaration(TypeDeclaration type) { TypeName name = typeOf(type.resolveBinding()); Scope scope = Scope.create().enterClass(name); TypeDeclarationBody body = readTypeDeclarationBody(scope, name, type.bodyDeclarations()); @@ -254,6 +258,9 @@ public class JavaReader { Casts.tryCast(FieldDeclaration.class, declaration) .ifPresent(field -> readField(body, scope, type, field)); + + Casts.tryCast(TypeDeclaration.class, declaration) + .ifPresent(typeDeclaration -> classes.add(readTypeDeclaration(typeDeclaration))); } return body.build(); } -- cgit v1.2.3