use of org.eclipse.ceylon.compiler.java.language.InternalMap in project ceylon by eclipse.
the class Metamodel method getTypeArgumentWithVariances.
public static ceylon.language.Map<? extends ceylon.language.meta.declaration.TypeParameter, ? extends ceylon.language.Sequence<? extends Object>> getTypeArgumentWithVariances(ceylon.language.meta.declaration.GenericDeclaration declaration, Reference appliedFunction) {
java.util.Map<ceylon.language.meta.declaration.TypeParameter, ceylon.language.Sequence<? extends Object>> typeArguments = new LinkedHashMap<ceylon.language.meta.declaration.TypeParameter, ceylon.language.Sequence<? extends Object>>();
Iterator<? extends ceylon.language.meta.declaration.TypeParameter> typeParameters = declaration.getTypeParameterDeclarations().iterator();
Object it;
java.util.Map<org.eclipse.ceylon.model.typechecker.model.TypeParameter, org.eclipse.ceylon.model.typechecker.model.Type> ptArguments = appliedFunction.getTypeArguments();
Map<TypeParameter, SiteVariance> varianceOverrides = appliedFunction instanceof org.eclipse.ceylon.model.typechecker.model.Type ? ((org.eclipse.ceylon.model.typechecker.model.Type) appliedFunction).getVarianceOverrides() : null;
while ((it = typeParameters.next()) != finished_.get_()) {
org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.TypeParameterImpl tp = (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.TypeParameterImpl) it;
org.eclipse.ceylon.model.typechecker.model.TypeParameter tpDecl = (org.eclipse.ceylon.model.typechecker.model.TypeParameter) tp.declaration;
org.eclipse.ceylon.model.typechecker.model.Type ptArg = ptArguments.get(tpDecl);
ceylon.language.meta.model.Type<?> ptArgWrapped = Metamodel.getAppliedMetamodel(ptArg);
ceylon.language.meta.declaration.Variance variance = modelVarianceToMetaModel(varianceOverrides, tpDecl);
ceylon.language.Sequence<? extends Object> tuple = ceylon.language.Tuple.instance(TD_ClosedTypeArgumentElement, new Object[] { ptArgWrapped, variance });
typeArguments.put(tp, tuple);
}
return new InternalMap<ceylon.language.meta.declaration.TypeParameter, ceylon.language.Sequence<?>>(ceylon.language.meta.declaration.TypeParameter.$TypeDescriptor$, TD_ClosedTypeArgument, typeArguments);
}
use of org.eclipse.ceylon.compiler.java.language.InternalMap in project ceylon by eclipse.
the class Metamodel method getTypeArguments.
public static ceylon.language.Map<? extends ceylon.language.meta.declaration.TypeParameter, ? extends ceylon.language.meta.model.Type<?>> getTypeArguments(ceylon.language.meta.declaration.GenericDeclaration declaration, Reference appliedFunction) {
java.util.Map<ceylon.language.meta.declaration.TypeParameter, ceylon.language.meta.model.Type<?>> typeArguments = new LinkedHashMap<ceylon.language.meta.declaration.TypeParameter, ceylon.language.meta.model.Type<?>>();
Iterator<? extends ceylon.language.meta.declaration.TypeParameter> typeParameters = declaration.getTypeParameterDeclarations().iterator();
Object it;
java.util.Map<org.eclipse.ceylon.model.typechecker.model.TypeParameter, org.eclipse.ceylon.model.typechecker.model.Type> ptArguments = appliedFunction.getTypeArguments();
while ((it = typeParameters.next()) != finished_.get_()) {
org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.TypeParameterImpl tp = (org.eclipse.ceylon.compiler.java.runtime.metamodel.decl.TypeParameterImpl) it;
org.eclipse.ceylon.model.typechecker.model.TypeParameter tpDecl = (org.eclipse.ceylon.model.typechecker.model.TypeParameter) tp.declaration;
org.eclipse.ceylon.model.typechecker.model.Type ptArg = ptArguments.get(tpDecl);
ceylon.language.meta.model.Type<?> ptArgWrapped = Metamodel.getAppliedMetamodel(ptArg);
typeArguments.put(tp, ptArgWrapped);
}
return new InternalMap<ceylon.language.meta.declaration.TypeParameter, ceylon.language.meta.model.Type<?>>(ceylon.language.meta.declaration.TypeParameter.$TypeDescriptor$, TD_ClosedTypeOfAnything, typeArguments);
}
Aggregations