提交 baa0bc5b 编写于 作者: A Andrey Breslav

Java constructors supported

上级 0340e962
......@@ -5,6 +5,7 @@ import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.resolve.WritableFunctionGroup;
import org.jetbrains.jet.lang.types.*;
import java.util.*;
......@@ -53,7 +54,6 @@ public class JavaDescriptorResolver {
return null;
}
classDescriptor = createJavaClassDescriptor(psiClass);
classDescriptorCache.put(qualifiedName, classDescriptor);
}
return classDescriptor;
}
......@@ -66,31 +66,31 @@ public class JavaDescriptorResolver {
Collections.<Attribute>emptyList(), // TODO
name
);
WritableFunctionGroup constructors = new WritableFunctionGroup("<init>");
classDescriptor.initialize(
// TODO
modifierList == null ? false : modifierList.hasModifierProperty(PsiModifier.FINAL),
Collections.<TypeParameterDescriptor>emptyList(),
getSupertypes(psiClass),
new JavaClassMembersScope(classDescriptor, psiClass, semanticServices, false),
new FunctionGroup() {
@NotNull
@Override
public String getName() {
throw new UnsupportedOperationException(); // TODO
}
@NotNull
@Override
public Collection<FunctionDescriptor> getPossiblyApplicableFunctions(@NotNull List<JetType> typeArguments, @NotNull List<JetType> positionedValueArgumentTypes) {
throw new UnsupportedOperationException(); // TODO
}
@Override
public boolean isEmpty() {
throw new UnsupportedOperationException(); // TODO
}
}
constructors
);
classDescriptorCache.put(psiClass.getQualifiedName(), classDescriptor);
// NOTE: this writes into constructors after it is remembered by the classDescriptor
PsiMethod[] psiConstructors = psiClass.getConstructors();
for (PsiMethod constructor : psiConstructors) {
ConstructorDescriptorImpl constructorDescriptor = new ConstructorDescriptorImpl(
classDescriptor,
Collections.<Attribute>emptyList(), // TODO
false);
constructorDescriptor.initialize(resolveParameterDescriptors(constructorDescriptor, constructor.getParameterList().getParameters()));
constructors.addFunction(
constructorDescriptor);
}
semanticServices.getTrace().recordDeclarationResolution(psiClass, classDescriptor);
return classDescriptor;
}
......
......@@ -766,7 +766,7 @@ public class JetTypeInferrer {
List<JetType> valueArgumentTypes = new ArrayList<JetType>();
for (JetExpression valueArgument : positionedValueArguments) {
valueArgumentTypes.add(getType(scope, valueArgument, false));
valueArgumentTypes.add(safeGetType(scope, valueArgument, false));
}
FunctionDescriptor functionDescriptor = overloadDomain.getFunctionDescriptorForPositionedArguments(types, valueArgumentTypes);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册