Skip to content

Commit

Permalink
metamodel #226: abstracted getTypeDescriptorForArguments in Metamodel
Browse files Browse the repository at this point in the history
  • Loading branch information
FroMage committed Jul 16, 2013
1 parent f59e82d commit ec092d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Expand Up @@ -73,11 +73,9 @@ protected void init() {
}

private void initParameters(com.redhat.ceylon.compiler.typechecker.model.Class decl) {
List<Parameter> parameters = decl.getParameterLists().get(0).getParameters();
com.redhat.ceylon.compiler.typechecker.model.ProducedType tupleType
= com.redhat.ceylon.compiler.typechecker.analyzer.Util.getParameterTypesAsTupleType(decl.getUnit(), parameters, producedType);
this.$reifiedArguments = Metamodel.getTypeDescriptorForProducedType(tupleType);
this.$reifiedArguments = Metamodel.getTypeDescriptorForArguments(decl.getUnit(), decl, producedType);

List<Parameter> parameters = decl.getParameterLists().get(0).getParameters();
this.firstDefaulted = Metamodel.getFirstDefaultedParameter(parameters);

Object[] defaultedMethods = null;
Expand Down
Expand Up @@ -3,6 +3,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
Expand All @@ -17,6 +18,7 @@
import ceylon.language.metamodel.Annotated;
import ceylon.language.metamodel.ClassOrInterface;
import ceylon.language.metamodel.ConstrainedAnnotation;
import ceylon.language.metamodel.declaration.ClassOrInterfaceDeclaration;
import ceylon.language.metamodel.declaration.Module;

import com.redhat.ceylon.cmr.api.ArtifactResult;
Expand All @@ -38,6 +40,8 @@
import com.redhat.ceylon.compiler.loader.model.LazyValue;
import com.redhat.ceylon.compiler.typechecker.context.Context;
import com.redhat.ceylon.compiler.typechecker.io.VFS;
import com.redhat.ceylon.compiler.typechecker.model.Declaration;
import com.redhat.ceylon.compiler.typechecker.model.Functional;
import com.redhat.ceylon.compiler.typechecker.model.Method;
import com.redhat.ceylon.compiler.typechecker.model.NothingType;
import com.redhat.ceylon.compiler.typechecker.model.Parameter;
Expand Down Expand Up @@ -520,4 +524,14 @@ public static boolean isCeylon(com.redhat.ceylon.compiler.typechecker.model.Clas
return ((LazyInterface) declaration).isCeylon();
throw new RuntimeException("Declaration type not supported: "+declaration);
}

public static TypeDescriptor getTypeDescriptorForArguments(com.redhat.ceylon.compiler.typechecker.model.Unit unit,
com.redhat.ceylon.compiler.typechecker.model.Functional decl,
ProducedType producedType) {

List<Parameter> parameters = decl.getParameterLists().get(0).getParameters();
com.redhat.ceylon.compiler.typechecker.model.ProducedType tupleType
= com.redhat.ceylon.compiler.typechecker.analyzer.Util.getParameterTypesAsTupleType(unit, parameters, producedType);
return Metamodel.getTypeDescriptorForProducedType(tupleType);
}
}

0 comments on commit ec092d8

Please sign in to comment.