Skip to content

Commit

Permalink
Decl #1052: Added a method to get the Module for a declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed May 28, 2013
1 parent 3e8067a commit 8662770
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/com/redhat/ceylon/compiler/java/codegen/Decl.java
Expand Up @@ -38,6 +38,7 @@
import com.redhat.ceylon.compiler.typechecker.model.LiteralAnnotationArgument; import com.redhat.ceylon.compiler.typechecker.model.LiteralAnnotationArgument;
import com.redhat.ceylon.compiler.typechecker.model.Method; import com.redhat.ceylon.compiler.typechecker.model.Method;
import com.redhat.ceylon.compiler.typechecker.model.MethodOrValue; import com.redhat.ceylon.compiler.typechecker.model.MethodOrValue;
import com.redhat.ceylon.compiler.typechecker.model.Module;
import com.redhat.ceylon.compiler.typechecker.model.NamedArgumentList; import com.redhat.ceylon.compiler.typechecker.model.NamedArgumentList;
import com.redhat.ceylon.compiler.typechecker.model.Package; import com.redhat.ceylon.compiler.typechecker.model.Package;
import com.redhat.ceylon.compiler.typechecker.model.Parameter; import com.redhat.ceylon.compiler.typechecker.model.Parameter;
Expand Down Expand Up @@ -448,6 +449,11 @@ public static Package getPackageContainer(Scope scope){
return (Package) scope; return (Package) scope;
} }


public static Module getModuleContainer(Scope scope) {
Package pkg = Decl.getPackageContainer(scope);
return pkg != null ? pkg.getModule() : null;
}

public static boolean isValueTypeDecl(Tree.Term decl) { public static boolean isValueTypeDecl(Tree.Term decl) {
if (decl != null){ if (decl != null){
return isValueTypeDecl(decl.getTypeModel()); return isValueTypeDecl(decl.getTypeModel());
Expand Down

0 comments on commit 8662770

Please sign in to comment.