use of org.eclipse.ceylon.model.typechecker.model.LazyType in project ceylon by eclipse.
the class DeclarationVisitor method visit.
public void visit(Tree.IntersectionType that) {
super.visit(that);
if (inExtends) {
final List<Tree.StaticType> sts = that.getStaticTypes();
Type t = new LazyType(unit) {
@Override
public TypeDeclaration initDeclaration() {
List<Type> types = new ArrayList<Type>(sts.size());
for (Tree.StaticType st : sts) {
Type t = st.getTypeModel();
if (t != null) {
types.add(t);
}
}
IntersectionType it = new IntersectionType(unit);
it.setSatisfiedTypes(types);
return it;
}
@Override
public Map<TypeParameter, Type> initTypeArguments() {
return emptyMap();
}
};
that.setTypeModel(t);
}
}
use of org.eclipse.ceylon.model.typechecker.model.LazyType in project ceylon by eclipse.
the class DeclarationVisitor method visit.
public void visit(Tree.EntryType that) {
super.visit(that);
if (inExtends) {
final Tree.StaticType keyType = that.getKeyType();
final Tree.StaticType valueType = that.getValueType();
Type t = new LazyType(unit) {
@Override
public boolean isUnknown() {
return false;
}
@Override
public TypeDeclaration initDeclaration() {
return unit.getEntryDeclaration();
}
@Override
public Map<TypeParameter, Type> initTypeArguments() {
HashMap<TypeParameter, Type> map = new HashMap<TypeParameter, Type>();
List<TypeParameter> itps = unit.getEntryDeclaration().getTypeParameters();
map.put(itps.get(0), keyType.getTypeModel());
map.put(itps.get(1), valueType.getTypeModel());
return map;
}
};
that.setTypeModel(t);
}
}
use of org.eclipse.ceylon.model.typechecker.model.LazyType in project ceylon by eclipse.
the class DeclarationVisitor method visit.
public void visit(Tree.TupleType that) {
super.visit(that);
if (inExtends) {
final List<Tree.Type> ets = that.getElementTypes();
Type t = new LazyType(unit) {
private Type tupleType() {
return getTupleType(ets, unit);
}
@Override
public TypeDeclaration initDeclaration() {
return tupleType().getDeclaration();
}
@Override
public Map<TypeParameter, Type> initTypeArguments() {
return tupleType().getTypeArguments();
}
};
that.setTypeModel(t);
}
}
Aggregations