Skip to content

Commit

Permalink
Moved metamodel into runtime.metamodel #226
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed Apr 17, 2013
1 parent 2d09241 commit a21f63a
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions runtime/com/redhat/ceylon/compiler/java/Util.java
Expand Up @@ -119,17 +119,17 @@ public static ceylon.language.metamodel.ProducedType getMetamodel(TypeDescriptor
}

// FIXME: this will need better thinking in terms of memory usage
private static Map<com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface, com.redhat.ceylon.compiler.java.metamodel.ClassOrInterface> typeCheckModelToRuntimeModel
= new HashMap<com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface, com.redhat.ceylon.compiler.java.metamodel.ClassOrInterface>();
private static Map<com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface, com.redhat.ceylon.compiler.java.runtime.metamodel.ClassOrInterface> typeCheckModelToRuntimeModel
= new HashMap<com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface, com.redhat.ceylon.compiler.java.runtime.metamodel.ClassOrInterface>();

public static com.redhat.ceylon.compiler.java.metamodel.ClassOrInterface getOrCreateMetamodel(com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface declaration){
public static com.redhat.ceylon.compiler.java.runtime.metamodel.ClassOrInterface getOrCreateMetamodel(com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface declaration){
synchronized(typeCheckModelToRuntimeModel){
com.redhat.ceylon.compiler.java.metamodel.ClassOrInterface ret = typeCheckModelToRuntimeModel.get(declaration);
com.redhat.ceylon.compiler.java.runtime.metamodel.ClassOrInterface ret = typeCheckModelToRuntimeModel.get(declaration);
if(ret == null){
if(declaration instanceof com.redhat.ceylon.compiler.typechecker.model.Class){
ret = new com.redhat.ceylon.compiler.java.metamodel.Class((com.redhat.ceylon.compiler.typechecker.model.Class)declaration);
ret = new com.redhat.ceylon.compiler.java.runtime.metamodel.Class((com.redhat.ceylon.compiler.typechecker.model.Class)declaration);
}else if(declaration instanceof com.redhat.ceylon.compiler.typechecker.model.Interface){
ret = new com.redhat.ceylon.compiler.java.metamodel.Interface((com.redhat.ceylon.compiler.typechecker.model.Interface)declaration);
ret = new com.redhat.ceylon.compiler.java.runtime.metamodel.Interface((com.redhat.ceylon.compiler.typechecker.model.Interface)declaration);
}
typeCheckModelToRuntimeModel.put(declaration, ret);
}
Expand All @@ -140,10 +140,10 @@ public static com.redhat.ceylon.compiler.java.metamodel.ClassOrInterface getOrCr
public static ceylon.language.metamodel.ProducedType getMetamodel(ProducedType pt) {
TypeDeclaration declaration = pt.getDeclaration();
if(declaration instanceof com.redhat.ceylon.compiler.typechecker.model.Class){
return new com.redhat.ceylon.compiler.java.metamodel.ClassType(pt);
return new com.redhat.ceylon.compiler.java.runtime.metamodel.ClassType(pt);
}
if(declaration instanceof com.redhat.ceylon.compiler.typechecker.model.Interface){
return new com.redhat.ceylon.compiler.java.metamodel.InterfaceType(pt);
return new com.redhat.ceylon.compiler.java.runtime.metamodel.InterfaceType(pt);
}
throw new RuntimeException("Declaration type not supported yet: "+declaration);
}
Expand Down
@@ -1,4 +1,4 @@
package com.redhat.ceylon.compiler.java.metamodel;
package com.redhat.ceylon.compiler.java.runtime.metamodel;

import ceylon.language.Empty;
import ceylon.language.Sequential;
Expand Down
@@ -1,4 +1,4 @@
package com.redhat.ceylon.compiler.java.metamodel;
package com.redhat.ceylon.compiler.java.runtime.metamodel;

import java.util.List;

Expand Down Expand Up @@ -66,7 +66,7 @@ protected void init(){
ceylon.language.metamodel.TypeParameter[] typeParametersArray = new ceylon.language.metamodel.TypeParameter[typeParameters.size()];
i=0;
for(com.redhat.ceylon.compiler.typechecker.model.TypeParameter tp : typeParameters){
typeParametersArray[i++] = new com.redhat.ceylon.compiler.java.metamodel.TypeParameter(tp);
typeParametersArray[i++] = new com.redhat.ceylon.compiler.java.runtime.metamodel.TypeParameter(tp);
}
this.typeParameters = (Sequential)Util.sequentialInstance(ceylon.language.metamodel.TypeParameter.$TypeDescriptor, typeParametersArray);
}
Expand Down
@@ -1,4 +1,4 @@
package com.redhat.ceylon.compiler.java.metamodel;
package com.redhat.ceylon.compiler.java.runtime.metamodel;

import java.util.LinkedHashMap;

Expand Down Expand Up @@ -30,7 +30,7 @@ public class ClassOrInterfaceType<Type>

private volatile boolean initialised;
private final com.redhat.ceylon.compiler.typechecker.model.ProducedType producedType;
protected com.redhat.ceylon.compiler.java.metamodel.ClassOrInterface<? extends Type> declaration;
protected com.redhat.ceylon.compiler.java.runtime.metamodel.ClassOrInterface<? extends Type> declaration;
protected ceylon.language.Map<? extends ceylon.language.metamodel.TypeParameter, ? extends ceylon.language.metamodel.ProducedType> typeArguments;

ClassOrInterfaceType(com.redhat.ceylon.compiler.typechecker.model.ProducedType producedType){
Expand Down Expand Up @@ -73,7 +73,7 @@ protected void init() {
java.util.Map<com.redhat.ceylon.compiler.typechecker.model.TypeParameter, com.redhat.ceylon.compiler.typechecker.model.ProducedType> ptArguments
= producedType.getTypeArguments();
while((it = typeParameters.next()) != finished_.getFinished$()){
com.redhat.ceylon.compiler.java.metamodel.TypeParameter tp = (com.redhat.ceylon.compiler.java.metamodel.TypeParameter) it;
com.redhat.ceylon.compiler.java.runtime.metamodel.TypeParameter tp = (com.redhat.ceylon.compiler.java.runtime.metamodel.TypeParameter) it;
com.redhat.ceylon.compiler.typechecker.model.TypeParameter tpDecl = (com.redhat.ceylon.compiler.typechecker.model.TypeParameter) tp.declaration;
com.redhat.ceylon.compiler.typechecker.model.ProducedType ptArg = ptArguments.get(tpDecl);
ProducedType ptArgWrapped = Util.getMetamodel(ptArg);
Expand Down
@@ -1,4 +1,4 @@
package com.redhat.ceylon.compiler.java.metamodel;
package com.redhat.ceylon.compiler.java.runtime.metamodel;

import ceylon.language.Sequential;
import ceylon.language.metamodel.Class;
Expand Down Expand Up @@ -42,7 +42,7 @@ public ClassType(com.redhat.ceylon.compiler.typechecker.model.ProducedType produ
@Override
public TypeDescriptor $getType() {
checkInit();
com.redhat.ceylon.compiler.java.metamodel.Class<Type, Arguments> declaration = (com.redhat.ceylon.compiler.java.metamodel.Class<Type, Arguments>) this.declaration;
com.redhat.ceylon.compiler.java.runtime.metamodel.Class<Type, Arguments> declaration = (com.redhat.ceylon.compiler.java.runtime.metamodel.Class<Type, Arguments>) this.declaration;
return TypeDescriptor.klass(ClassType.class, declaration.$getReifiedType(), declaration.$getReifiedArguments());
}
}
@@ -1,4 +1,4 @@
package com.redhat.ceylon.compiler.java.metamodel;
package com.redhat.ceylon.compiler.java.runtime.metamodel;

import ceylon.language.Sequential;
import ceylon.language.metamodel.Declaration$impl;
Expand Down
@@ -1,4 +1,4 @@
package com.redhat.ceylon.compiler.java.metamodel;
package com.redhat.ceylon.compiler.java.runtime.metamodel;

import java.lang.annotation.RetentionPolicy;

Expand Down
@@ -1,4 +1,4 @@
package com.redhat.ceylon.compiler.java.metamodel;
package com.redhat.ceylon.compiler.java.runtime.metamodel;

import ceylon.language.Sequential;
import ceylon.language.metamodel.InterfaceType$impl;
Expand Down
@@ -1,4 +1,4 @@
package com.redhat.ceylon.compiler.java.metamodel;
package com.redhat.ceylon.compiler.java.runtime.metamodel;

import ceylon.language.metamodel.TypeParameter$impl;

Expand Down

0 comments on commit a21f63a

Please sign in to comment.