Initial version of storing SourceElements in descriptors
Introduce SourceElement, JavaSourceElementFactory, DeclarationDescriptorWithSource Implement getSource() for eager, lazy and java descriptors
This commit is contained in:
@@ -38,7 +38,7 @@ public class AccessorForFunctionDescriptor extends SimpleFunctionDescriptorImpl
|
|||||||
) {
|
) {
|
||||||
super(containingDeclaration, null, Annotations.EMPTY,
|
super(containingDeclaration, null, Annotations.EMPTY,
|
||||||
Name.identifier((descriptor instanceof ConstructorDescriptor ? "$init" : descriptor.getName()) + "$b$" + index),
|
Name.identifier((descriptor instanceof ConstructorDescriptor ? "$init" : descriptor.getName()) + "$b$" + index),
|
||||||
Kind.DECLARATION);
|
Kind.DECLARATION, SourceElement.NO_SOURCE);
|
||||||
|
|
||||||
initialize(DescriptorUtils.getReceiverParameterType(descriptor.getReceiverParameter()),
|
initialize(DescriptorUtils.getReceiverParameterType(descriptor.getReceiverParameter()),
|
||||||
descriptor instanceof ConstructorDescriptor ? NO_RECEIVER_PARAMETER : descriptor.getExpectedThisObject(),
|
descriptor instanceof ConstructorDescriptor ? NO_RECEIVER_PARAMETER : descriptor.getExpectedThisObject(),
|
||||||
@@ -56,7 +56,7 @@ public class AccessorForFunctionDescriptor extends SimpleFunctionDescriptorImpl
|
|||||||
for (TypeParameterDescriptor typeParameter : typeParameters) {
|
for (TypeParameterDescriptor typeParameter : typeParameters) {
|
||||||
TypeParameterDescriptorImpl copy = TypeParameterDescriptorImpl.createForFurtherModification(
|
TypeParameterDescriptorImpl copy = TypeParameterDescriptorImpl.createForFurtherModification(
|
||||||
this, typeParameter.getAnnotations(), typeParameter.isReified(),
|
this, typeParameter.getAnnotations(), typeParameter.isReified(),
|
||||||
typeParameter.getVariance(), typeParameter.getName(), typeParameter.getIndex()
|
typeParameter.getVariance(), typeParameter.getName(), typeParameter.getIndex(), SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
for (JetType upperBound : typeParameter.getUpperBounds()) {
|
for (JetType upperBound : typeParameter.getUpperBounds()) {
|
||||||
copy.addUpperBound(upperBound);
|
copy.addUpperBound(upperBound);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl {
|
|||||||
) {
|
) {
|
||||||
super(containingDeclaration, null, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
|
super(containingDeclaration, null, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
|
||||||
original.isVar(), Name.identifier(original.getName() + "$b$" + index),
|
original.isVar(), Name.identifier(original.getName() + "$b$" + index),
|
||||||
Kind.DECLARATION);
|
Kind.DECLARATION, SourceElement.NO_SOURCE);
|
||||||
|
|
||||||
setType(propertyType, Collections.<TypeParameterDescriptorImpl>emptyList(), expectedThisObject, receiverType);
|
setType(propertyType, Collections.<TypeParameterDescriptorImpl>emptyList(), expectedThisObject, receiverType);
|
||||||
initialize(new Getter(this), new Setter(this));
|
initialize(new Getter(this), new Setter(this));
|
||||||
@@ -54,15 +54,15 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl {
|
|||||||
public static class Getter extends PropertyGetterDescriptorImpl {
|
public static class Getter extends PropertyGetterDescriptorImpl {
|
||||||
public Getter(AccessorForPropertyDescriptor property) {
|
public Getter(AccessorForPropertyDescriptor property) {
|
||||||
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
|
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
|
||||||
false,
|
false, false, Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||||
false, Kind.DECLARATION, null);
|
|
||||||
initialize(property.getType());
|
initialize(property.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Setter extends PropertySetterDescriptorImpl {
|
public static class Setter extends PropertySetterDescriptorImpl {
|
||||||
public Setter(AccessorForPropertyDescriptor property) {
|
public Setter(AccessorForPropertyDescriptor property) {
|
||||||
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL, false, false, Kind.DECLARATION, null);
|
super(property, Annotations.EMPTY, Modality.FINAL, Visibilities.LOCAL,
|
||||||
|
false, false, Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||||
initializeDefault();
|
initializeDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ public class JvmCodegenUtil {
|
|||||||
? KotlinBuiltIns.getInstance().getExtensionFunction(arity) : KotlinBuiltIns.getInstance().getFunction(arity),
|
? KotlinBuiltIns.getInstance().getExtensionFunction(arity) : KotlinBuiltIns.getInstance().getFunction(arity),
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
Name.identifier("invoke"),
|
Name.identifier("invoke"),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
|
|
||||||
invokeDescriptor.initialize(DescriptorUtils.getReceiverParameterType(fd.getReceiverParameter()),
|
invokeDescriptor.initialize(DescriptorUtils.getReceiverParameterType(fd.getReceiverParameter()),
|
||||||
|
|||||||
@@ -68,14 +68,14 @@ public class JvmRuntimeTypes {
|
|||||||
@NotNull String... typeParameters
|
@NotNull String... typeParameters
|
||||||
) {
|
) {
|
||||||
MutableClassDescriptor descriptor = new MutableClassDescriptor(packageFragment, packageFragment.getMemberScope(),
|
MutableClassDescriptor descriptor = new MutableClassDescriptor(packageFragment, packageFragment.getMemberScope(),
|
||||||
ClassKind.CLASS, false, Name.identifier(name));
|
ClassKind.CLASS, false, Name.identifier(name), SourceElement.NO_SOURCE);
|
||||||
List<TypeParameterDescriptor> typeParameterDescriptors = new ArrayList<TypeParameterDescriptor>(typeParameters.length);
|
List<TypeParameterDescriptor> typeParameterDescriptors = new ArrayList<TypeParameterDescriptor>(typeParameters.length);
|
||||||
for (int i = 0; i < typeParameters.length; i++) {
|
for (int i = 0; i < typeParameters.length; i++) {
|
||||||
String[] s = typeParameters[i].split(" ");
|
String[] s = typeParameters[i].split(" ");
|
||||||
Variance variance = Variance.valueOf(s[0].toUpperCase() + "_VARIANCE");
|
Variance variance = Variance.valueOf(s[0].toUpperCase() + "_VARIANCE");
|
||||||
String typeParameterName = s[1];
|
String typeParameterName = s[1];
|
||||||
TypeParameterDescriptorImpl typeParameter = TypeParameterDescriptorImpl.createForFurtherModification(
|
TypeParameterDescriptorImpl typeParameter = TypeParameterDescriptorImpl.createForFurtherModification(
|
||||||
descriptor, Annotations.EMPTY, false, variance, Name.identifier(typeParameterName), i
|
descriptor, Annotations.EMPTY, false, variance, Name.identifier(typeParameterName), i, SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
typeParameter.setInitialized();
|
typeParameter.setInitialized();
|
||||||
typeParameterDescriptors.add(typeParameter);
|
typeParameterDescriptors.add(typeParameter);
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import java.util.List;
|
|||||||
import static org.jetbrains.jet.codegen.AsmUtil.boxType;
|
import static org.jetbrains.jet.codegen.AsmUtil.boxType;
|
||||||
import static org.jetbrains.jet.codegen.AsmUtil.isPrimitive;
|
import static org.jetbrains.jet.codegen.AsmUtil.isPrimitive;
|
||||||
import static org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED;
|
import static org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED;
|
||||||
|
import static org.jetbrains.jet.lang.descriptors.SourceElement.NO_SOURCE;
|
||||||
import static org.jetbrains.jet.lang.resolve.BindingContext.VARIABLE;
|
import static org.jetbrains.jet.lang.resolve.BindingContext.VARIABLE;
|
||||||
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.*;
|
import static org.jetbrains.jet.lang.resolve.java.AsmTypeConstants.*;
|
||||||
import static org.jetbrains.jet.lang.resolve.java.diagnostics.DiagnosticsPackage.OtherOrigin;
|
import static org.jetbrains.jet.lang.resolve.java.diagnostics.DiagnosticsPackage.OtherOrigin;
|
||||||
@@ -203,7 +204,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
|||||||
if (clInit == null) {
|
if (clInit == null) {
|
||||||
MethodVisitor mv = v.newMethod(OtherOrigin(descriptor), ACC_STATIC, "<clinit>", "()V", null, null);
|
MethodVisitor mv = v.newMethod(OtherOrigin(descriptor), ACC_STATIC, "<clinit>", "()V", null, null);
|
||||||
SimpleFunctionDescriptorImpl clInit =
|
SimpleFunctionDescriptorImpl clInit =
|
||||||
SimpleFunctionDescriptorImpl.create(descriptor, Annotations.EMPTY, Name.special("<clinit>"), SYNTHESIZED);
|
SimpleFunctionDescriptorImpl.create(descriptor, Annotations.EMPTY, Name.special("<clinit>"), SYNTHESIZED, NO_SOURCE);
|
||||||
clInit.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(),
|
clInit.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(),
|
||||||
Collections.<ValueParameterDescriptor>emptyList(), null, null, Visibilities.PRIVATE);
|
Collections.<ValueParameterDescriptor>emptyList(), null, null, Visibilities.PRIVATE);
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,6 @@
|
|||||||
package org.jetbrains.jet.codegen;
|
package org.jetbrains.jet.codegen;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.resolve.kotlin.PackagePartClassUtils;
|
|
||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
|
||||||
import org.jetbrains.org.objectweb.asm.Type;
|
|
||||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
|
||||||
import org.jetbrains.jet.codegen.context.CodegenContext;
|
import org.jetbrains.jet.codegen.context.CodegenContext;
|
||||||
import org.jetbrains.jet.codegen.state.GenerationState;
|
import org.jetbrains.jet.codegen.state.GenerationState;
|
||||||
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
import org.jetbrains.jet.codegen.state.JetTypeMapper;
|
||||||
@@ -30,9 +26,13 @@ import org.jetbrains.jet.lang.psi.JetFile;
|
|||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor;
|
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.resolve.kotlin.PackagePartClassUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
|
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||||
|
import org.jetbrains.org.objectweb.asm.Type;
|
||||||
|
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
@@ -69,7 +69,8 @@ public class SamWrapperCodegen {
|
|||||||
samType.getJavaClassDescriptor().getContainingDeclaration(),
|
samType.getJavaClassDescriptor().getContainingDeclaration(),
|
||||||
fqName.shortName(),
|
fqName.shortName(),
|
||||||
Modality.FINAL,
|
Modality.FINAL,
|
||||||
Collections.singleton(samType.getType())
|
Collections.singleton(samType.getType()),
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
// e.g. compare(T, T)
|
// e.g. compare(T, T)
|
||||||
SimpleFunctionDescriptor erasedInterfaceFunction = samType.getAbstractMethod().getOriginal().copy(
|
SimpleFunctionDescriptor erasedInterfaceFunction = samType.getAbstractMethod().getOriginal().copy(
|
||||||
|
|||||||
+3
-2
@@ -100,8 +100,9 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private ClassDescriptor recordClassForFunction(@NotNull FunctionDescriptor funDescriptor, @NotNull Collection<JetType> supertypes) {
|
private ClassDescriptor recordClassForFunction(@NotNull FunctionDescriptor funDescriptor, @NotNull Collection<JetType> supertypes) {
|
||||||
ClassDescriptorImpl classDescriptor =
|
ClassDescriptorImpl classDescriptor = new ClassDescriptorImpl(
|
||||||
new ClassDescriptorImpl(funDescriptor.getContainingDeclaration(), Name.special("<closure>"), Modality.FINAL, supertypes);
|
funDescriptor.getContainingDeclaration(), Name.special("<closure>"), Modality.FINAL, supertypes, SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
classDescriptor.initialize(JetScope.EMPTY, Collections.<ConstructorDescriptor>emptySet(), null);
|
classDescriptor.initialize(JetScope.EMPTY, Collections.<ConstructorDescriptor>emptySet(), null);
|
||||||
|
|
||||||
bindingTrace.record(CLASS_FOR_FUNCTION, funDescriptor, classDescriptor);
|
bindingTrace.record(CLASS_FOR_FUNCTION, funDescriptor, classDescriptor);
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ public class CodegenBinding {
|
|||||||
) {
|
) {
|
||||||
ClassDescriptorImpl classDescriptor =
|
ClassDescriptorImpl classDescriptor =
|
||||||
new ClassDescriptorImpl(scriptDescriptor, Name.special("<script-" + asmType.getInternalName() + ">"), Modality.FINAL,
|
new ClassDescriptorImpl(scriptDescriptor, Name.special("<script-" + asmType.getInternalName() + ">"), Modality.FINAL,
|
||||||
Collections.singleton(KotlinBuiltIns.getInstance().getAnyType()));
|
Collections.singleton(KotlinBuiltIns.getInstance().getAnyType()), SourceElement.NO_SOURCE);
|
||||||
classDescriptor.initialize(JetScope.EMPTY, Collections.<ConstructorDescriptor>emptySet(), null);
|
classDescriptor.initialize(JetScope.EMPTY, Collections.<ConstructorDescriptor>emptySet(), null);
|
||||||
|
|
||||||
recordClosure(bindingTrace, null, classDescriptor, null, asmType);
|
recordClosure(bindingTrace, null, classDescriptor, null, asmType);
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ public abstract class CodegenContext<T extends DeclarationDescriptor> {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public ConstructorContext intoConstructor(@Nullable ConstructorDescriptor descriptor, @Nullable MutableClosure closure) {
|
public ConstructorContext intoConstructor(@Nullable ConstructorDescriptor descriptor, @Nullable MutableClosure closure) {
|
||||||
if (descriptor == null) {
|
if (descriptor == null) {
|
||||||
descriptor = ConstructorDescriptorImpl.create(getThisDescriptor(), Annotations.EMPTY, true)
|
descriptor = ConstructorDescriptorImpl.create(getThisDescriptor(), Annotations.EMPTY, true, SourceElement.NO_SOURCE)
|
||||||
.initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
|
.initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
|
||||||
Visibilities.PUBLIC, false);
|
Visibilities.PUBLIC, false);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -29,6 +29,7 @@ import org.jetbrains.jet.lang.resolve.java.resolver.TraceBasedErrorReporter;
|
|||||||
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedMethodSignatureChecker;
|
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedMethodSignatureChecker;
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedExternalAnnotationResolver;
|
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedExternalAnnotationResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaPropertyInitializerEvaluatorImpl;
|
import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaPropertyInitializerEvaluatorImpl;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.resolver.JavaSourceElementFactoryImpl;
|
||||||
import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder;
|
import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder;
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaPackageFragmentProvider;
|
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaPackageFragmentProvider;
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.GlobalJavaResolverContext;
|
import org.jetbrains.jet.lang.resolve.java.lazy.GlobalJavaResolverContext;
|
||||||
@@ -58,6 +59,7 @@ public class InjectorForJavaDescriptorResolver {
|
|||||||
private final PsiBasedMethodSignatureChecker psiBasedMethodSignatureChecker;
|
private final PsiBasedMethodSignatureChecker psiBasedMethodSignatureChecker;
|
||||||
private final PsiBasedExternalAnnotationResolver psiBasedExternalAnnotationResolver;
|
private final PsiBasedExternalAnnotationResolver psiBasedExternalAnnotationResolver;
|
||||||
private final JavaPropertyInitializerEvaluatorImpl javaPropertyInitializerEvaluator;
|
private final JavaPropertyInitializerEvaluatorImpl javaPropertyInitializerEvaluator;
|
||||||
|
private final JavaSourceElementFactoryImpl javaSourceElementFactory;
|
||||||
private final VirtualFileFinder virtualFileFinder;
|
private final VirtualFileFinder virtualFileFinder;
|
||||||
private final LazyJavaPackageFragmentProvider lazyJavaPackageFragmentProvider;
|
private final LazyJavaPackageFragmentProvider lazyJavaPackageFragmentProvider;
|
||||||
private final GlobalJavaResolverContext globalJavaResolverContext;
|
private final GlobalJavaResolverContext globalJavaResolverContext;
|
||||||
@@ -86,7 +88,8 @@ public class InjectorForJavaDescriptorResolver {
|
|||||||
this.psiBasedMethodSignatureChecker = new PsiBasedMethodSignatureChecker();
|
this.psiBasedMethodSignatureChecker = new PsiBasedMethodSignatureChecker();
|
||||||
this.traceBasedJavaResolverCache = new TraceBasedJavaResolverCache();
|
this.traceBasedJavaResolverCache = new TraceBasedJavaResolverCache();
|
||||||
this.javaPropertyInitializerEvaluator = new JavaPropertyInitializerEvaluatorImpl();
|
this.javaPropertyInitializerEvaluator = new JavaPropertyInitializerEvaluatorImpl();
|
||||||
this.globalJavaResolverContext = new GlobalJavaResolverContext(lockBasedStorageManager, getJavaClassFinder(), virtualFileFinder, deserializedDescriptorResolver, psiBasedExternalAnnotationResolver, traceBasedExternalSignatureResolver, traceBasedErrorReporter, psiBasedMethodSignatureChecker, traceBasedJavaResolverCache, javaPropertyInitializerEvaluator);
|
this.javaSourceElementFactory = new JavaSourceElementFactoryImpl();
|
||||||
|
this.globalJavaResolverContext = new GlobalJavaResolverContext(lockBasedStorageManager, getJavaClassFinder(), virtualFileFinder, deserializedDescriptorResolver, psiBasedExternalAnnotationResolver, traceBasedExternalSignatureResolver, traceBasedErrorReporter, psiBasedMethodSignatureChecker, traceBasedJavaResolverCache, javaPropertyInitializerEvaluator, javaSourceElementFactory);
|
||||||
this.lazyJavaPackageFragmentProvider = new LazyJavaPackageFragmentProvider(globalJavaResolverContext, getModule());
|
this.lazyJavaPackageFragmentProvider = new LazyJavaPackageFragmentProvider(globalJavaResolverContext, getModule());
|
||||||
this.javaDescriptorResolver = new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, getModule());
|
this.javaDescriptorResolver = new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, getModule());
|
||||||
this.javaClassDataFinder = new JavaClassDataFinder(virtualFileFinder, deserializedDescriptorResolver);
|
this.javaClassDataFinder = new JavaClassDataFinder(virtualFileFinder, deserializedDescriptorResolver);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import org.jetbrains.jet.lang.resolve.java.resolver.TraceBasedErrorReporter;
|
|||||||
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedMethodSignatureChecker;
|
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedMethodSignatureChecker;
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedExternalAnnotationResolver;
|
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedExternalAnnotationResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaPropertyInitializerEvaluatorImpl;
|
import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaPropertyInitializerEvaluatorImpl;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.resolver.JavaSourceElementFactoryImpl;
|
||||||
import org.jetbrains.jet.lang.resolve.AnnotationResolver;
|
import org.jetbrains.jet.lang.resolve.AnnotationResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.CallResolver;
|
import org.jetbrains.jet.lang.resolve.calls.CallResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.calls.ArgumentTypeResolver;
|
import org.jetbrains.jet.lang.resolve.calls.ArgumentTypeResolver;
|
||||||
@@ -85,6 +86,7 @@ public class InjectorForLazyResolveWithJava {
|
|||||||
private final PsiBasedMethodSignatureChecker psiBasedMethodSignatureChecker;
|
private final PsiBasedMethodSignatureChecker psiBasedMethodSignatureChecker;
|
||||||
private final PsiBasedExternalAnnotationResolver psiBasedExternalAnnotationResolver;
|
private final PsiBasedExternalAnnotationResolver psiBasedExternalAnnotationResolver;
|
||||||
private final JavaPropertyInitializerEvaluatorImpl javaPropertyInitializerEvaluator;
|
private final JavaPropertyInitializerEvaluatorImpl javaPropertyInitializerEvaluator;
|
||||||
|
private final JavaSourceElementFactoryImpl javaSourceElementFactory;
|
||||||
private final AnnotationResolver annotationResolver;
|
private final AnnotationResolver annotationResolver;
|
||||||
private final CallResolver callResolver;
|
private final CallResolver callResolver;
|
||||||
private final ArgumentTypeResolver argumentTypeResolver;
|
private final ArgumentTypeResolver argumentTypeResolver;
|
||||||
@@ -137,7 +139,8 @@ public class InjectorForLazyResolveWithJava {
|
|||||||
this.psiBasedMethodSignatureChecker = new PsiBasedMethodSignatureChecker();
|
this.psiBasedMethodSignatureChecker = new PsiBasedMethodSignatureChecker();
|
||||||
this.lazyResolveBasedCache = new LazyResolveBasedCache();
|
this.lazyResolveBasedCache = new LazyResolveBasedCache();
|
||||||
this.javaPropertyInitializerEvaluator = new JavaPropertyInitializerEvaluatorImpl();
|
this.javaPropertyInitializerEvaluator = new JavaPropertyInitializerEvaluatorImpl();
|
||||||
this.globalJavaResolverContext = new GlobalJavaResolverContext(lockBasedStorageManager, javaClassFinder, virtualFileFinder, deserializedDescriptorResolver, psiBasedExternalAnnotationResolver, traceBasedExternalSignatureResolver, traceBasedErrorReporter, psiBasedMethodSignatureChecker, lazyResolveBasedCache, javaPropertyInitializerEvaluator);
|
this.javaSourceElementFactory = new JavaSourceElementFactoryImpl();
|
||||||
|
this.globalJavaResolverContext = new GlobalJavaResolverContext(lockBasedStorageManager, javaClassFinder, virtualFileFinder, deserializedDescriptorResolver, psiBasedExternalAnnotationResolver, traceBasedExternalSignatureResolver, traceBasedErrorReporter, psiBasedMethodSignatureChecker, lazyResolveBasedCache, javaPropertyInitializerEvaluator, javaSourceElementFactory);
|
||||||
this.lazyJavaPackageFragmentProvider = new LazyJavaPackageFragmentProvider(globalJavaResolverContext, getModule());
|
this.lazyJavaPackageFragmentProvider = new LazyJavaPackageFragmentProvider(globalJavaResolverContext, getModule());
|
||||||
this.javaDescriptorResolver = new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, getModule());
|
this.javaDescriptorResolver = new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, getModule());
|
||||||
this.annotationResolver = new AnnotationResolver();
|
this.annotationResolver = new AnnotationResolver();
|
||||||
|
|||||||
+4
-1
@@ -34,6 +34,7 @@ import org.jetbrains.jet.lang.resolve.java.resolver.TraceBasedErrorReporter;
|
|||||||
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedMethodSignatureChecker;
|
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedMethodSignatureChecker;
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedExternalAnnotationResolver;
|
import org.jetbrains.jet.lang.resolve.java.resolver.PsiBasedExternalAnnotationResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaPropertyInitializerEvaluatorImpl;
|
import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaPropertyInitializerEvaluatorImpl;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.resolver.JavaSourceElementFactoryImpl;
|
||||||
import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder;
|
import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileFinder;
|
||||||
import org.jetbrains.jet.lang.resolve.BodyResolver;
|
import org.jetbrains.jet.lang.resolve.BodyResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.AnnotationResolver;
|
import org.jetbrains.jet.lang.resolve.AnnotationResolver;
|
||||||
@@ -96,6 +97,7 @@ public class InjectorForTopDownAnalyzerForJvm implements InjectorForTopDownAnaly
|
|||||||
private final PsiBasedMethodSignatureChecker psiBasedMethodSignatureChecker;
|
private final PsiBasedMethodSignatureChecker psiBasedMethodSignatureChecker;
|
||||||
private final PsiBasedExternalAnnotationResolver psiBasedExternalAnnotationResolver;
|
private final PsiBasedExternalAnnotationResolver psiBasedExternalAnnotationResolver;
|
||||||
private final JavaPropertyInitializerEvaluatorImpl javaPropertyInitializerEvaluator;
|
private final JavaPropertyInitializerEvaluatorImpl javaPropertyInitializerEvaluator;
|
||||||
|
private final JavaSourceElementFactoryImpl javaSourceElementFactory;
|
||||||
private final VirtualFileFinder virtualFileFinder;
|
private final VirtualFileFinder virtualFileFinder;
|
||||||
private final BodyResolver bodyResolver;
|
private final BodyResolver bodyResolver;
|
||||||
private final AnnotationResolver annotationResolver;
|
private final AnnotationResolver annotationResolver;
|
||||||
@@ -158,7 +160,8 @@ public class InjectorForTopDownAnalyzerForJvm implements InjectorForTopDownAnaly
|
|||||||
this.psiBasedMethodSignatureChecker = new PsiBasedMethodSignatureChecker();
|
this.psiBasedMethodSignatureChecker = new PsiBasedMethodSignatureChecker();
|
||||||
this.traceBasedJavaResolverCache = new TraceBasedJavaResolverCache();
|
this.traceBasedJavaResolverCache = new TraceBasedJavaResolverCache();
|
||||||
this.javaPropertyInitializerEvaluator = new JavaPropertyInitializerEvaluatorImpl();
|
this.javaPropertyInitializerEvaluator = new JavaPropertyInitializerEvaluatorImpl();
|
||||||
this.globalJavaResolverContext = new GlobalJavaResolverContext(storageManager, javaClassFinder, virtualFileFinder, deserializedDescriptorResolver, psiBasedExternalAnnotationResolver, traceBasedExternalSignatureResolver, traceBasedErrorReporter, psiBasedMethodSignatureChecker, traceBasedJavaResolverCache, javaPropertyInitializerEvaluator);
|
this.javaSourceElementFactory = new JavaSourceElementFactoryImpl();
|
||||||
|
this.globalJavaResolverContext = new GlobalJavaResolverContext(storageManager, javaClassFinder, virtualFileFinder, deserializedDescriptorResolver, psiBasedExternalAnnotationResolver, traceBasedExternalSignatureResolver, traceBasedErrorReporter, psiBasedMethodSignatureChecker, traceBasedJavaResolverCache, javaPropertyInitializerEvaluator, javaSourceElementFactory);
|
||||||
this.lazyJavaPackageFragmentProvider = new LazyJavaPackageFragmentProvider(globalJavaResolverContext, getModuleDescriptor());
|
this.lazyJavaPackageFragmentProvider = new LazyJavaPackageFragmentProvider(globalJavaResolverContext, getModuleDescriptor());
|
||||||
this.javaDescriptorResolver = new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, getModuleDescriptor());
|
this.javaDescriptorResolver = new JavaDescriptorResolver(lazyJavaPackageFragmentProvider, getModuleDescriptor());
|
||||||
this.javaClassDataFinder = new JavaClassDataFinder(virtualFileFinder, deserializedDescriptorResolver);
|
this.javaClassDataFinder = new JavaClassDataFinder(virtualFileFinder, deserializedDescriptorResolver);
|
||||||
|
|||||||
+4
-1
@@ -22,6 +22,7 @@ import com.intellij.util.containers.ComparatorUtil;
|
|||||||
import com.intellij.util.containers.ContainerUtil;
|
import com.intellij.util.containers.ContainerUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||||
@@ -211,7 +212,9 @@ public class AlternativeMethodSignatureData extends ElementAlternativeSignatureD
|
|||||||
altName != null ? altName : originalParameterDescriptor.getName(),
|
altName != null ? altName : originalParameterDescriptor.getName(),
|
||||||
alternativeType,
|
alternativeType,
|
||||||
originalParameterDescriptor.declaresDefaultValue(),
|
originalParameterDescriptor.declaresDefaultValue(),
|
||||||
alternativeVarargElementType));
|
alternativeVarargElementType,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
altValueParameters = altParamDescriptors;
|
altValueParameters = altParamDescriptors;
|
||||||
|
|||||||
+6
-3
@@ -30,10 +30,10 @@ import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
|||||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.jvmSignature.KotlinToJvmSignatureMapper;
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaMethodDescriptor;
|
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaMethodDescriptor;
|
||||||
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodSignature;
|
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodSignature;
|
||||||
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmSignaturePackage;
|
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmSignaturePackage;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.jvmSignature.KotlinToJvmSignatureMapper;
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils;
|
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage;
|
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage;
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod;
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod;
|
||||||
@@ -99,7 +99,9 @@ public class SignaturesPropagationData {
|
|||||||
JavaMethodDescriptor autoMethodDescriptor = JavaMethodDescriptor.createJavaMethod(
|
JavaMethodDescriptor autoMethodDescriptor = JavaMethodDescriptor.createJavaMethod(
|
||||||
containingClass,
|
containingClass,
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
method.getName()
|
method.getName(),
|
||||||
|
//TODO: what to do?
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
autoMethodDescriptor.initialize(
|
autoMethodDescriptor.initialize(
|
||||||
receiverType,
|
receiverType,
|
||||||
@@ -253,7 +255,8 @@ public class SignaturesPropagationData {
|
|||||||
stableName != null ? stableName : originalParam.getName(),
|
stableName != null ? stableName : originalParam.getName(),
|
||||||
altType,
|
altType,
|
||||||
originalParam.declaresDefaultValue(),
|
originalParam.declaresDefaultValue(),
|
||||||
varargCheckResult.isVararg ? KotlinBuiltIns.getInstance().getArrayElementType(altType) : null
|
varargCheckResult.isVararg ? KotlinBuiltIns.getInstance().getArrayElementType(altType) : null,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.resolve.java.resolver
|
||||||
|
|
||||||
|
import org.jetbrains.jet.lang.resolve.source.PsiSourceElement
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaElement
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaElementImpl
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.sources.JavaSourceElementFactory
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement
|
||||||
|
|
||||||
|
private class JavaSourceElementImpl(val element: JavaElement) : PsiSourceElement {
|
||||||
|
override val psi: PsiElement?
|
||||||
|
get() = (element as JavaElementImpl<*>).getPsi()
|
||||||
|
}
|
||||||
|
|
||||||
|
public class JavaSourceElementFactoryImpl : JavaSourceElementFactory {
|
||||||
|
override fun source(javaElement: JavaElement): SourceElement = JavaSourceElementImpl(javaElement)
|
||||||
|
}
|
||||||
+4
-6
@@ -18,10 +18,7 @@ package org.jetbrains.jet.lang.descriptors.impl;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorVisitor;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.Visibilities;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.Visibility;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
@@ -35,9 +32,10 @@ public class LocalVariableDescriptor extends VariableDescriptorImpl {
|
|||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@Nullable JetType type,
|
@Nullable JetType type,
|
||||||
boolean mutable
|
boolean mutable,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, annotations, name, type);
|
super(containingDeclaration, annotations, name, type, source);
|
||||||
isVar = mutable;
|
isVar = mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -65,9 +65,10 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
|
|||||||
@NotNull JetScope outerScope,
|
@NotNull JetScope outerScope,
|
||||||
@NotNull ClassKind kind,
|
@NotNull ClassKind kind,
|
||||||
boolean isInner,
|
boolean isInner,
|
||||||
@NotNull Name name
|
@NotNull Name name,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name);
|
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source);
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.isInner = isInner;
|
this.isInner = isInner;
|
||||||
|
|
||||||
|
|||||||
+18
-12
@@ -57,12 +57,14 @@ public class ScriptDescriptorImpl extends DeclarationDescriptorNonRootImpl imple
|
|||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
int priority,
|
int priority,
|
||||||
@NotNull JetScope scriptScope,
|
@NotNull JetScope scriptScope,
|
||||||
@NotNull Name className
|
@NotNull Name className,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, Annotations.EMPTY, NAME);
|
super(containingDeclaration, Annotations.EMPTY, NAME, source);
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
|
|
||||||
classDescriptor = new MutableClassDescriptor(containingDeclaration, scriptScope, ClassKind.CLASS, false, className);
|
classDescriptor = new MutableClassDescriptor(containingDeclaration, scriptScope, ClassKind.CLASS,
|
||||||
|
false, className, SourceElement.NO_SOURCE);
|
||||||
classDescriptor.addSupertype(KotlinBuiltIns.getInstance().getAnyType());
|
classDescriptor.addSupertype(KotlinBuiltIns.getInstance().getAnyType());
|
||||||
classDescriptor.setModality(Modality.FINAL);
|
classDescriptor.setModality(Modality.FINAL);
|
||||||
classDescriptor.setVisibility(Visibilities.PUBLIC);
|
classDescriptor.setVisibility(Visibilities.PUBLIC);
|
||||||
@@ -102,7 +104,8 @@ public class ScriptDescriptorImpl extends DeclarationDescriptorNonRootImpl imple
|
|||||||
Visibilities.PUBLIC,
|
Visibilities.PUBLIC,
|
||||||
false,
|
false,
|
||||||
Name.identifier(LAST_EXPRESSION_VALUE_FIELD_NAME),
|
Name.identifier(LAST_EXPRESSION_VALUE_FIELD_NAME),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION);
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
SourceElement.NO_SOURCE);
|
||||||
JetType returnType = scriptDescriptor.getScriptCodeDescriptor().getReturnType();
|
JetType returnType = scriptDescriptor.getScriptCodeDescriptor().getReturnType();
|
||||||
assert returnType != null : "Return type not initialized for " + scriptDescriptor;
|
assert returnType != null : "Return type not initialized for " + scriptDescriptor;
|
||||||
propertyDescriptor.setType(
|
propertyDescriptor.setType(
|
||||||
@@ -164,7 +167,7 @@ public class ScriptDescriptorImpl extends DeclarationDescriptorNonRootImpl imple
|
|||||||
public static ConstructorDescriptorImpl createConstructor(
|
public static ConstructorDescriptorImpl createConstructor(
|
||||||
@NotNull ScriptDescriptor scriptDescriptor, @NotNull List<ValueParameterDescriptor> valueParameters
|
@NotNull ScriptDescriptor scriptDescriptor, @NotNull List<ValueParameterDescriptor> valueParameters
|
||||||
) {
|
) {
|
||||||
return ConstructorDescriptorImpl.create(scriptDescriptor.getClassDescriptor(), Annotations.EMPTY, true)
|
return ConstructorDescriptorImpl.create(scriptDescriptor.getClassDescriptor(), Annotations.EMPTY, true, SourceElement.NO_SOURCE)
|
||||||
.initialize(
|
.initialize(
|
||||||
Collections.<TypeParameterDescriptor>emptyList(),
|
Collections.<TypeParameterDescriptor>emptyList(),
|
||||||
valueParameters,
|
valueParameters,
|
||||||
@@ -178,13 +181,16 @@ public class ScriptDescriptorImpl extends DeclarationDescriptorNonRootImpl imple
|
|||||||
@NotNull ScriptDescriptor scriptDescriptor,
|
@NotNull ScriptDescriptor scriptDescriptor,
|
||||||
@NotNull ValueParameterDescriptor parameter
|
@NotNull ValueParameterDescriptor parameter
|
||||||
) {
|
) {
|
||||||
PropertyDescriptorImpl propertyDescriptor = PropertyDescriptorImpl.create(scriptDescriptor.getClassDescriptor(),
|
PropertyDescriptorImpl propertyDescriptor = PropertyDescriptorImpl.create(
|
||||||
Annotations.EMPTY,
|
scriptDescriptor.getClassDescriptor(),
|
||||||
Modality.FINAL,
|
Annotations.EMPTY,
|
||||||
Visibilities.PUBLIC,
|
Modality.FINAL,
|
||||||
false,
|
Visibilities.PUBLIC,
|
||||||
parameter.getName(),
|
false,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION);
|
parameter.getName(),
|
||||||
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
propertyDescriptor.setType(
|
propertyDescriptor.setType(
|
||||||
parameter.getType(),
|
parameter.getType(),
|
||||||
Collections.<TypeParameterDescriptor>emptyList(),
|
Collections.<TypeParameterDescriptor>emptyList(),
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import static org.jetbrains.jet.lang.diagnostics.Errors.*;
|
|||||||
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
||||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.*;
|
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.*;
|
||||||
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.*;
|
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.*;
|
||||||
|
import static org.jetbrains.jet.lang.resolve.source.SourcePackage.toSourceElement;
|
||||||
import static org.jetbrains.jet.lexer.JetTokens.OVERRIDE_KEYWORD;
|
import static org.jetbrains.jet.lexer.JetTokens.OVERRIDE_KEYWORD;
|
||||||
import static org.jetbrains.jet.lexer.JetTokens.VARARG_KEYWORD;
|
import static org.jetbrains.jet.lexer.JetTokens.VARARG_KEYWORD;
|
||||||
|
|
||||||
@@ -127,7 +128,8 @@ public class DescriptorResolver {
|
|||||||
typeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
|
typeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
|
||||||
typeParameter.getVariance(),
|
typeParameter.getVariance(),
|
||||||
JetPsiUtil.safeName(typeParameter.getName()),
|
JetPsiUtil.safeName(typeParameter.getName()),
|
||||||
index
|
index,
|
||||||
|
toSourceElement(typeParameter)
|
||||||
);
|
);
|
||||||
trace.record(BindingContext.TYPE_PARAMETER, typeParameter, typeParameterDescriptor);
|
trace.record(BindingContext.TYPE_PARAMETER, typeParameter, typeParameterDescriptor);
|
||||||
typeParameters.add(typeParameterDescriptor);
|
typeParameters.add(typeParameterDescriptor);
|
||||||
@@ -302,7 +304,8 @@ public class DescriptorResolver {
|
|||||||
containingDescriptor,
|
containingDescriptor,
|
||||||
annotations,
|
annotations,
|
||||||
JetPsiUtil.safeName(function.getName()),
|
JetPsiUtil.safeName(function.getName()),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
toSourceElement(function)
|
||||||
);
|
);
|
||||||
WritableScope innerScope = new WritableScopeImpl(scope, functionDescriptor, new TraceBasedRedeclarationHandler(trace),
|
WritableScope innerScope = new WritableScopeImpl(scope, functionDescriptor, new TraceBasedRedeclarationHandler(trace),
|
||||||
"Function descriptor header scope");
|
"Function descriptor header scope");
|
||||||
@@ -386,7 +389,8 @@ public class DescriptorResolver {
|
|||||||
classDescriptor,
|
classDescriptor,
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
Name.identifier(functionName),
|
Name.identifier(functionName),
|
||||||
CallableMemberDescriptor.Kind.SYNTHESIZED
|
CallableMemberDescriptor.Kind.SYNTHESIZED,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
|
|
||||||
functionDescriptor.initialize(
|
functionDescriptor.initialize(
|
||||||
@@ -416,7 +420,8 @@ public class DescriptorResolver {
|
|||||||
classDescriptor,
|
classDescriptor,
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
COPY_METHOD_NAME,
|
COPY_METHOD_NAME,
|
||||||
CallableMemberDescriptor.Kind.SYNTHESIZED
|
CallableMemberDescriptor.Kind.SYNTHESIZED,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
|
|
||||||
List<ValueParameterDescriptor> parameterDescriptors = Lists.newArrayList();
|
List<ValueParameterDescriptor> parameterDescriptors = Lists.newArrayList();
|
||||||
@@ -429,7 +434,7 @@ public class DescriptorResolver {
|
|||||||
new ValueParameterDescriptorImpl(functionDescriptor, null, parameter.getIndex(), parameter.getAnnotations(),
|
new ValueParameterDescriptorImpl(functionDescriptor, null, parameter.getIndex(), parameter.getAnnotations(),
|
||||||
parameter.getName(), parameter.getType(),
|
parameter.getName(), parameter.getType(),
|
||||||
declaresDefaultValue,
|
declaresDefaultValue,
|
||||||
parameter.getVarargElementType());
|
parameter.getVarargElementType(), SourceElement.NO_SOURCE);
|
||||||
parameterDescriptors.add(parameterDescriptor);
|
parameterDescriptors.add(parameterDescriptor);
|
||||||
if (declaresDefaultValue) {
|
if (declaresDefaultValue) {
|
||||||
trace.record(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameterDescriptor, propertyDescriptor);
|
trace.record(BindingContext.VALUE_PARAMETER_AS_PROPERTY, parameterDescriptor, propertyDescriptor);
|
||||||
@@ -555,7 +560,8 @@ public class DescriptorResolver {
|
|||||||
JetPsiUtil.safeName(valueParameter.getName()),
|
JetPsiUtil.safeName(valueParameter.getName()),
|
||||||
variableType,
|
variableType,
|
||||||
valueParameter.hasDefaultValue(),
|
valueParameter.hasDefaultValue(),
|
||||||
varargElementType
|
varargElementType,
|
||||||
|
toSourceElement(valueParameter)
|
||||||
);
|
);
|
||||||
|
|
||||||
trace.record(BindingContext.VALUE_PARAMETER, valueParameter, valueParameterDescriptor);
|
trace.record(BindingContext.VALUE_PARAMETER, valueParameter, valueParameterDescriptor);
|
||||||
@@ -606,7 +612,8 @@ public class DescriptorResolver {
|
|||||||
typeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
|
typeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
|
||||||
typeParameter.getVariance(),
|
typeParameter.getVariance(),
|
||||||
JetPsiUtil.safeName(typeParameter.getName()),
|
JetPsiUtil.safeName(typeParameter.getName()),
|
||||||
index
|
index,
|
||||||
|
toSourceElement(typeParameter)
|
||||||
);
|
);
|
||||||
trace.record(BindingContext.TYPE_PARAMETER, typeParameter, typeParameterDescriptor);
|
trace.record(BindingContext.TYPE_PARAMETER, typeParameter, typeParameterDescriptor);
|
||||||
extensibleScope.addTypeParameterDescriptor(typeParameterDescriptor);
|
extensibleScope.addTypeParameterDescriptor(typeParameterDescriptor);
|
||||||
@@ -615,11 +622,12 @@ public class DescriptorResolver {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ConstructorDescriptorImpl createAndRecordPrimaryConstructorForObject(
|
public static ConstructorDescriptorImpl createAndRecordPrimaryConstructorForObject(
|
||||||
@Nullable PsiElement object,
|
@Nullable JetClassOrObject object,
|
||||||
@NotNull ClassDescriptor classDescriptor,
|
@NotNull ClassDescriptor classDescriptor,
|
||||||
@NotNull BindingTrace trace
|
@NotNull BindingTrace trace
|
||||||
) {
|
) {
|
||||||
ConstructorDescriptorImpl constructorDescriptor = DescriptorFactory.createPrimaryConstructorForObject(classDescriptor);
|
ConstructorDescriptorImpl constructorDescriptor =
|
||||||
|
DescriptorFactory.createPrimaryConstructorForObject(classDescriptor, toSourceElement(object));
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
trace.record(CONSTRUCTOR, object, constructorDescriptor);
|
trace.record(CONSTRUCTOR, object, constructorDescriptor);
|
||||||
}
|
}
|
||||||
@@ -815,7 +823,9 @@ public class DescriptorResolver {
|
|||||||
annotationResolver.resolveAnnotationsWithArguments(scope, parameter.getModifierList(), trace),
|
annotationResolver.resolveAnnotationsWithArguments(scope, parameter.getModifierList(), trace),
|
||||||
JetPsiUtil.safeName(parameter.getName()),
|
JetPsiUtil.safeName(parameter.getName()),
|
||||||
type,
|
type,
|
||||||
false);
|
false,
|
||||||
|
toSourceElement(parameter)
|
||||||
|
);
|
||||||
trace.record(BindingContext.VALUE_PARAMETER, parameter, variableDescriptor);
|
trace.record(BindingContext.VALUE_PARAMETER, parameter, variableDescriptor);
|
||||||
return variableDescriptor;
|
return variableDescriptor;
|
||||||
}
|
}
|
||||||
@@ -837,7 +847,8 @@ public class DescriptorResolver {
|
|||||||
Visibilities.INTERNAL,
|
Visibilities.INTERNAL,
|
||||||
variable.isVar(),
|
variable.isVar(),
|
||||||
JetPsiUtil.safeName(variable.getName()),
|
JetPsiUtil.safeName(variable.getName()),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
toSourceElement(variable)
|
||||||
);
|
);
|
||||||
|
|
||||||
JetType type =
|
JetType type =
|
||||||
@@ -886,7 +897,9 @@ public class DescriptorResolver {
|
|||||||
annotationResolver.resolveAnnotationsWithArguments(scope, variable.getModifierList(), trace),
|
annotationResolver.resolveAnnotationsWithArguments(scope, variable.getModifierList(), trace),
|
||||||
JetPsiUtil.safeName(variable.getName()),
|
JetPsiUtil.safeName(variable.getName()),
|
||||||
type,
|
type,
|
||||||
variable.isVar());
|
variable.isVar(),
|
||||||
|
toSourceElement(variable)
|
||||||
|
);
|
||||||
trace.record(BindingContext.VARIABLE, variable, variableDescriptor);
|
trace.record(BindingContext.VARIABLE, variable, variableDescriptor);
|
||||||
return variableDescriptor;
|
return variableDescriptor;
|
||||||
}
|
}
|
||||||
@@ -914,7 +927,8 @@ public class DescriptorResolver {
|
|||||||
visibility,
|
visibility,
|
||||||
isVar,
|
isVar,
|
||||||
JetPsiUtil.safeName(property.getName()),
|
JetPsiUtil.safeName(property.getName()),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
toSourceElement(property)
|
||||||
);
|
);
|
||||||
|
|
||||||
List<TypeParameterDescriptorImpl> typeParameterDescriptors;
|
List<TypeParameterDescriptorImpl> typeParameterDescriptors;
|
||||||
@@ -1155,7 +1169,7 @@ public class DescriptorResolver {
|
|||||||
resolveModalityFromModifiers(setter, propertyDescriptor.getModality()),
|
resolveModalityFromModifiers(setter, propertyDescriptor.getModality()),
|
||||||
resolveVisibilityFromModifiers(setter, propertyDescriptor.getVisibility()),
|
resolveVisibilityFromModifiers(setter, propertyDescriptor.getVisibility()),
|
||||||
setter.hasBody(), false,
|
setter.hasBody(), false,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION, null);
|
CallableMemberDescriptor.Kind.DECLARATION, null, toSourceElement(setter));
|
||||||
if (parameter != null) {
|
if (parameter != null) {
|
||||||
|
|
||||||
// This check is redundant: the parser does not allow a default value, but we'll keep it just in case
|
// This check is redundant: the parser does not allow a default value, but we'll keep it just in case
|
||||||
@@ -1231,7 +1245,7 @@ public class DescriptorResolver {
|
|||||||
resolveModalityFromModifiers(getter, propertyDescriptor.getModality()),
|
resolveModalityFromModifiers(getter, propertyDescriptor.getModality()),
|
||||||
resolveVisibilityFromModifiers(getter, propertyDescriptor.getVisibility()),
|
resolveVisibilityFromModifiers(getter, propertyDescriptor.getVisibility()),
|
||||||
getter.hasBody(), false,
|
getter.hasBody(), false,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION, null);
|
CallableMemberDescriptor.Kind.DECLARATION, null, toSourceElement(getter));
|
||||||
getterDescriptor.initialize(returnType);
|
getterDescriptor.initialize(returnType);
|
||||||
trace.record(BindingContext.PROPERTY_ACCESSOR, getter, getterDescriptor);
|
trace.record(BindingContext.PROPERTY_ACCESSOR, getter, getterDescriptor);
|
||||||
}
|
}
|
||||||
@@ -1254,7 +1268,8 @@ public class DescriptorResolver {
|
|||||||
ConstructorDescriptorImpl constructorDescriptor = ConstructorDescriptorImpl.create(
|
ConstructorDescriptorImpl constructorDescriptor = ConstructorDescriptorImpl.create(
|
||||||
classDescriptor,
|
classDescriptor,
|
||||||
annotationResolver.resolveAnnotationsWithoutArguments(scope, modifierList, trace),
|
annotationResolver.resolveAnnotationsWithoutArguments(scope, modifierList, trace),
|
||||||
isPrimary
|
isPrimary,
|
||||||
|
toSourceElement(declarationToTrace)
|
||||||
);
|
);
|
||||||
trace.record(BindingContext.CONSTRUCTOR, declarationToTrace, constructorDescriptor);
|
trace.record(BindingContext.CONSTRUCTOR, declarationToTrace, constructorDescriptor);
|
||||||
WritableScopeImpl parameterScope = new WritableScopeImpl(
|
WritableScopeImpl parameterScope = new WritableScopeImpl(
|
||||||
@@ -1316,7 +1331,8 @@ public class DescriptorResolver {
|
|||||||
resolveVisibilityFromModifiers(parameter, getDefaultVisibility(parameter, classDescriptor)),
|
resolveVisibilityFromModifiers(parameter, getDefaultVisibility(parameter, classDescriptor)),
|
||||||
isMutable,
|
isMutable,
|
||||||
name,
|
name,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
toSourceElement(parameter)
|
||||||
);
|
);
|
||||||
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(),
|
propertyDescriptor.setType(type, Collections.<TypeParameterDescriptor>emptyList(),
|
||||||
getExpectedThisObjectIfNeeded(classDescriptor), NO_RECEIVER_PARAMETER);
|
getExpectedThisObjectIfNeeded(classDescriptor), NO_RECEIVER_PARAMETER);
|
||||||
|
|||||||
@@ -122,22 +122,27 @@ public class FunctionDescriptorUtil {
|
|||||||
function.getContainingDeclaration(),
|
function.getContainingDeclaration(),
|
||||||
function.getAnnotations(),
|
function.getAnnotations(),
|
||||||
function.getName(),
|
function.getName(),
|
||||||
function.getKind());
|
function.getKind(),
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
List<ValueParameterDescriptor> parameters = new ArrayList<ValueParameterDescriptor>(newParameters.size());
|
List<ValueParameterDescriptor> parameters = new ArrayList<ValueParameterDescriptor>(newParameters.size());
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (ValueParameterDescriptor parameter : newParameters) {
|
for (ValueParameterDescriptor parameter : newParameters) {
|
||||||
JetType returnType = parameter.getReturnType();
|
JetType returnType = parameter.getReturnType();
|
||||||
assert returnType != null;
|
assert returnType != null;
|
||||||
|
|
||||||
parameters.add(new ValueParameterDescriptorImpl(
|
parameters.add(
|
||||||
descriptor,
|
new ValueParameterDescriptorImpl(
|
||||||
null,
|
descriptor,
|
||||||
idx,
|
null,
|
||||||
parameter.getAnnotations(),
|
idx,
|
||||||
parameter.getName(),
|
parameter.getAnnotations(),
|
||||||
returnType,
|
parameter.getName(),
|
||||||
parameter.declaresDefaultValue(),
|
returnType,
|
||||||
parameter.getVarargElementType())
|
parameter.declaresDefaultValue(),
|
||||||
|
parameter.getVarargElementType(),
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
|
)
|
||||||
);
|
);
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ import javax.inject.Inject;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.jetbrains.jet.lang.resolve.source.SourcePackage.toSourceElement;
|
||||||
|
|
||||||
// SCRIPT: Resolve declarations in scripts
|
// SCRIPT: Resolve declarations in scripts
|
||||||
public class ScriptHeaderResolver {
|
public class ScriptHeaderResolver {
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ public class ScriptHeaderResolver {
|
|||||||
|
|
||||||
FqName nameForScript = ScriptNameUtil.classNameForScript(script);
|
FqName nameForScript = ScriptNameUtil.classNameForScript(script);
|
||||||
Name className = nameForScript.shortName();
|
Name className = nameForScript.shortName();
|
||||||
ScriptDescriptorImpl scriptDescriptor = new ScriptDescriptorImpl(ns, priority, outerScope, className);
|
ScriptDescriptorImpl scriptDescriptor = new ScriptDescriptorImpl(ns, priority, outerScope, className, toSourceElement(script));
|
||||||
|
|
||||||
WritableScopeImpl scriptScope = new WritableScopeImpl(outerScope, scriptDescriptor, RedeclarationHandler.DO_NOTHING, "script");
|
WritableScopeImpl scriptScope = new WritableScopeImpl(outerScope, scriptDescriptor, RedeclarationHandler.DO_NOTHING, "script");
|
||||||
scriptScope.changeLockLevel(WritableScope.LockLevel.BOTH);
|
scriptScope.changeLockLevel(WritableScope.LockLevel.BOTH);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package org.jetbrains.jet.lang.resolve;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ScriptDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
||||||
@@ -57,7 +58,7 @@ public final class ScriptParameterResolver {
|
|||||||
@NotNull ScriptDescriptor script
|
@NotNull ScriptDescriptor script
|
||||||
) {
|
) {
|
||||||
return new ValueParameterDescriptorImpl(script, null, index, Annotations.EMPTY, scriptParameter.getName(),
|
return new ValueParameterDescriptorImpl(script, null, index, Annotations.EMPTY, scriptParameter.getName(),
|
||||||
scriptParameter.getType(), false, null);
|
scriptParameter.getType(), false, null, SourceElement.NO_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScriptParameterResolver() {
|
private ScriptParameterResolver() {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isObject;
|
|||||||
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.getDefaultClassVisibility;
|
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.getDefaultClassVisibility;
|
||||||
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.resolveVisibilityFromModifiers;
|
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.resolveVisibilityFromModifiers;
|
||||||
import static org.jetbrains.jet.lang.resolve.name.SpecialNames.getClassObjectName;
|
import static org.jetbrains.jet.lang.resolve.name.SpecialNames.getClassObjectName;
|
||||||
|
import static org.jetbrains.jet.lang.resolve.source.SourcePackage.toSourceElement;
|
||||||
|
|
||||||
public class TypeHierarchyResolver {
|
public class TypeHierarchyResolver {
|
||||||
private static final DFS.Neighbors<ClassDescriptor> CLASS_INHERITANCE_EDGES = new DFS.Neighbors<ClassDescriptor>() {
|
private static final DFS.Neighbors<ClassDescriptor> CLASS_INHERITANCE_EDGES = new DFS.Neighbors<ClassDescriptor>() {
|
||||||
@@ -431,8 +432,9 @@ public class TypeHierarchyResolver {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private MutableClassDescriptor createSyntheticClassObjectForSingleton(@NotNull ClassDescriptor classDescriptor) {
|
private MutableClassDescriptor createSyntheticClassObjectForSingleton(@NotNull ClassDescriptor classDescriptor) {
|
||||||
MutableClassDescriptor classObject = new MutableClassDescriptor(classDescriptor, outerScope, ClassKind.CLASS_OBJECT, false,
|
MutableClassDescriptor classObject =
|
||||||
getClassObjectName(classDescriptor.getName()));
|
new MutableClassDescriptor(classDescriptor, outerScope, ClassKind.CLASS_OBJECT, false,
|
||||||
|
getClassObjectName(classDescriptor.getName()), SourceElement.NO_SOURCE);
|
||||||
|
|
||||||
classObject.setModality(Modality.FINAL);
|
classObject.setModality(Modality.FINAL);
|
||||||
classObject.setVisibility(DescriptorUtils.getSyntheticClassObjectVisibility());
|
classObject.setVisibility(DescriptorUtils.getSyntheticClassObjectVisibility());
|
||||||
@@ -450,8 +452,9 @@ public class TypeHierarchyResolver {
|
|||||||
// Kind check is needed in order to not consider enums as inner in any case
|
// Kind check is needed in order to not consider enums as inner in any case
|
||||||
// (otherwise it would be impossible to create a class object in the enum)
|
// (otherwise it would be impossible to create a class object in the enum)
|
||||||
boolean isInner = kind == ClassKind.CLASS && klass.isInner();
|
boolean isInner = kind == ClassKind.CLASS && klass.isInner();
|
||||||
MutableClassDescriptor descriptor = new MutableClassDescriptor(containingDeclaration, outerScope, kind, isInner,
|
MutableClassDescriptor descriptor = new MutableClassDescriptor(
|
||||||
JetPsiUtil.safeName(klass.getName()));
|
containingDeclaration, outerScope, kind, isInner, JetPsiUtil.safeName(klass.getName()),
|
||||||
|
toSourceElement(klass));
|
||||||
c.getDeclaredClasses().put(klass, descriptor);
|
c.getDeclaredClasses().put(klass, descriptor);
|
||||||
trace.record(FQNAME_TO_CLASS_DESCRIPTOR, JetNamedDeclarationUtil.getUnsafeFQName(klass), descriptor);
|
trace.record(FQNAME_TO_CLASS_DESCRIPTOR, JetNamedDeclarationUtil.getUnsafeFQName(klass), descriptor);
|
||||||
|
|
||||||
@@ -471,7 +474,8 @@ public class TypeHierarchyResolver {
|
|||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull ClassKind kind
|
@NotNull ClassKind kind
|
||||||
) {
|
) {
|
||||||
MutableClassDescriptor descriptor = new MutableClassDescriptor(owner.getOwnerForChildren(), outerScope, kind, false, name);
|
MutableClassDescriptor descriptor = new MutableClassDescriptor(owner.getOwnerForChildren(), outerScope, kind, false, name,
|
||||||
|
toSourceElement(declaration));
|
||||||
|
|
||||||
prepareForDeferredCall(descriptor.getScopeForMemberDeclarationResolution(), descriptor, declaration);
|
prepareForDeferredCall(descriptor.getScopeForMemberDeclarationResolution(), descriptor, declaration);
|
||||||
|
|
||||||
@@ -485,7 +489,7 @@ public class TypeHierarchyResolver {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private ConstructorDescriptorImpl createPrimaryConstructorForObject(
|
private ConstructorDescriptorImpl createPrimaryConstructorForObject(
|
||||||
@Nullable PsiElement object,
|
@Nullable JetClassOrObject object,
|
||||||
@NotNull MutableClassDescriptor mutableClassDescriptor
|
@NotNull MutableClassDescriptor mutableClassDescriptor
|
||||||
) {
|
) {
|
||||||
ConstructorDescriptorImpl constructorDescriptor = DescriptorResolver
|
ConstructorDescriptorImpl constructorDescriptor = DescriptorResolver
|
||||||
|
|||||||
+4
-1
@@ -62,6 +62,7 @@ import static org.jetbrains.jet.lang.diagnostics.Errors.CLASS_OBJECT_NOT_ALLOWED
|
|||||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isSyntheticClassObject;
|
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isSyntheticClassObject;
|
||||||
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.*;
|
import static org.jetbrains.jet.lang.resolve.ModifiersChecker.*;
|
||||||
import static org.jetbrains.jet.lang.resolve.name.SpecialNames.getClassObjectName;
|
import static org.jetbrains.jet.lang.resolve.name.SpecialNames.getClassObjectName;
|
||||||
|
import static org.jetbrains.jet.lang.resolve.source.SourcePackage.toSourceElement;
|
||||||
|
|
||||||
public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDescriptorWithResolutionScopes, LazyEntity {
|
public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDescriptorWithResolutionScopes, LazyEntity {
|
||||||
private static final Predicate<JetType> VALID_SUPERTYPE = new Predicate<JetType>() {
|
private static final Predicate<JetType> VALID_SUPERTYPE = new Predicate<JetType>() {
|
||||||
@@ -100,7 +101,9 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
|||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull JetClassLikeInfo classLikeInfo
|
@NotNull JetClassLikeInfo classLikeInfo
|
||||||
) {
|
) {
|
||||||
super(resolveSession.getStorageManager(), containingDeclaration, name);
|
super(resolveSession.getStorageManager(), containingDeclaration, name,
|
||||||
|
toSourceElement(classLikeInfo.getCorrespondingClassOrObject())
|
||||||
|
);
|
||||||
this.resolveSession = resolveSession;
|
this.resolveSession = resolveSession;
|
||||||
|
|
||||||
if (classLikeInfo.getCorrespondingClassOrObject() != null) {
|
if (classLikeInfo.getCorrespondingClassOrObject() != null) {
|
||||||
|
|||||||
+4
-2
@@ -40,6 +40,7 @@ import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorVisitor
|
|||||||
import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler
|
import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope
|
import org.jetbrains.jet.lang.resolve.scopes.WritableScope
|
||||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor
|
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor
|
||||||
|
import org.jetbrains.jet.lang.resolve.source.toSourceElement
|
||||||
|
|
||||||
public class LazyScriptDescriptor(
|
public class LazyScriptDescriptor(
|
||||||
val resolveSession: ResolveSession,
|
val resolveSession: ResolveSession,
|
||||||
@@ -52,9 +53,9 @@ public class LazyScriptDescriptor(
|
|||||||
resolveSession.getPackageFragment(fqName).sure("Package not found $fqName")
|
resolveSession.getPackageFragment(fqName).sure("Package not found $fqName")
|
||||||
},
|
},
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
ScriptDescriptor.NAME
|
ScriptDescriptor.NAME,
|
||||||
|
jetScript.toSourceElement()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
{
|
{
|
||||||
resolveSession.getTrace().record(BindingContext.SCRIPT, jetScript, this)
|
resolveSession.getTrace().record(BindingContext.SCRIPT, jetScript, this)
|
||||||
}
|
}
|
||||||
@@ -80,6 +81,7 @@ public class LazyScriptDescriptor(
|
|||||||
)
|
)
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getScriptCodeDescriptor() = _scriptCodeDescriptor()
|
override fun getScriptCodeDescriptor() = _scriptCodeDescriptor()
|
||||||
|
|
||||||
override fun getScopeForBodyResolution(): JetScope {
|
override fun getScopeForBodyResolution(): JetScope {
|
||||||
|
|||||||
+4
-1
@@ -31,6 +31,8 @@ import org.jetbrains.jet.lexer.JetTokens;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static org.jetbrains.jet.lang.resolve.source.SourcePackage.toSourceElement;
|
||||||
|
|
||||||
public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescriptor implements LazyEntity {
|
public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescriptor implements LazyEntity {
|
||||||
private final ResolveSession resolveSession;
|
private final ResolveSession resolveSession;
|
||||||
|
|
||||||
@@ -47,7 +49,8 @@ public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescri
|
|||||||
jetTypeParameter.getNameAsSafeName(),
|
jetTypeParameter.getNameAsSafeName(),
|
||||||
jetTypeParameter.getVariance(),
|
jetTypeParameter.getVariance(),
|
||||||
jetTypeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
|
jetTypeParameter.hasModifier(JetTokens.REIFIED_KEYWORD),
|
||||||
index
|
index,
|
||||||
|
toSourceElement(jetTypeParameter)
|
||||||
);
|
);
|
||||||
this.resolveSession = resolveSession;
|
this.resolveSession = resolveSession;
|
||||||
this.jetTypeParameter = jetTypeParameter;
|
this.jetTypeParameter = jetTypeParameter;
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.resolve.source
|
||||||
|
|
||||||
|
import org.jetbrains.jet.lang.psi.JetElement
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
|
||||||
|
public class KotlinSourceElement(override val psi: JetElement) : PsiSourceElement
|
||||||
|
|
||||||
|
public fun JetElement?.toSourceElement(): SourceElement = if (this == null) SourceElement.NO_SOURCE else KotlinSourceElement(this)
|
||||||
|
|
||||||
|
public fun SourceElement.getPsi(): PsiElement? = (this as? PsiSourceElement)?.psi
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.resolve.source
|
||||||
|
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement
|
||||||
|
|
||||||
|
public trait PsiSourceElement : SourceElement {
|
||||||
|
public val psi: PsiElement?
|
||||||
|
}
|
||||||
+4
-2
@@ -74,6 +74,7 @@ import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
|||||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getStaticNestedClassesScope;
|
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getStaticNestedClassesScope;
|
||||||
import static org.jetbrains.jet.lang.resolve.calls.context.ContextDependency.INDEPENDENT;
|
import static org.jetbrains.jet.lang.resolve.calls.context.ContextDependency.INDEPENDENT;
|
||||||
import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
|
import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER;
|
||||||
|
import static org.jetbrains.jet.lang.resolve.source.SourcePackage.toSourceElement;
|
||||||
import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE;
|
import static org.jetbrains.jet.lang.types.TypeUtils.NO_EXPECTED_TYPE;
|
||||||
import static org.jetbrains.jet.lang.types.TypeUtils.noExpectedType;
|
import static org.jetbrains.jet.lang.types.TypeUtils.noExpectedType;
|
||||||
import static org.jetbrains.jet.lang.types.expressions.ControlStructureTypingUtils.createCallForSpecialConstruction;
|
import static org.jetbrains.jet.lang.types.expressions.ControlStructureTypingUtils.createCallForSpecialConstruction;
|
||||||
@@ -532,7 +533,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
AnonymousFunctionDescriptor functionDescriptor = new AnonymousFunctionDescriptor(
|
AnonymousFunctionDescriptor functionDescriptor = new AnonymousFunctionDescriptor(
|
||||||
context.scope.getContainingDeclaration(),
|
context.scope.getContainingDeclaration(),
|
||||||
Annotations.EMPTY,
|
Annotations.EMPTY,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
toSourceElement(expression)
|
||||||
);
|
);
|
||||||
|
|
||||||
FunctionDescriptorUtil.initializeFromFunctionType(functionDescriptor, type, null, Modality.FINAL, Visibilities.PUBLIC);
|
FunctionDescriptorUtil.initializeFromFunctionType(functionDescriptor, type, null, Modality.FINAL, Visibilities.PUBLIC);
|
||||||
@@ -560,7 +562,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
|
|
||||||
LocalVariableDescriptor localVariable =
|
LocalVariableDescriptor localVariable =
|
||||||
new LocalVariableDescriptor(context.scope.getContainingDeclaration(), Annotations.EMPTY, Name.special("<anonymous>"),
|
new LocalVariableDescriptor(context.scope.getContainingDeclaration(), Annotations.EMPTY, Name.special("<anonymous>"),
|
||||||
type, /* mutable = */ false);
|
type, /* mutable = */ false, toSourceElement(expression));
|
||||||
|
|
||||||
context.trace.record(VARIABLE, expression, localVariable);
|
context.trace.record(VARIABLE, expression, localVariable);
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -42,6 +42,7 @@ import java.util.List;
|
|||||||
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
|
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
|
||||||
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
import static org.jetbrains.jet.lang.resolve.BindingContext.*;
|
||||||
import static org.jetbrains.jet.lang.resolve.calls.context.ContextDependency.INDEPENDENT;
|
import static org.jetbrains.jet.lang.resolve.calls.context.ContextDependency.INDEPENDENT;
|
||||||
|
import static org.jetbrains.jet.lang.resolve.source.SourcePackage.toSourceElement;
|
||||||
import static org.jetbrains.jet.lang.types.TypeUtils.*;
|
import static org.jetbrains.jet.lang.types.TypeUtils.*;
|
||||||
import static org.jetbrains.jet.lang.types.expressions.CoercionStrategy.COERCION_TO_UNIT;
|
import static org.jetbrains.jet.lang.types.expressions.CoercionStrategy.COERCION_TO_UNIT;
|
||||||
|
|
||||||
@@ -131,7 +132,9 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||||
JetTypeReference receiverTypeRef = functionLiteral.getReceiverTypeRef();
|
JetTypeReference receiverTypeRef = functionLiteral.getReceiverTypeRef();
|
||||||
AnonymousFunctionDescriptor functionDescriptor = new AnonymousFunctionDescriptor(
|
AnonymousFunctionDescriptor functionDescriptor = new AnonymousFunctionDescriptor(
|
||||||
context.scope.getContainingDeclaration(), Annotations.EMPTY, CallableMemberDescriptor.Kind.DECLARATION);
|
context.scope.getContainingDeclaration(), Annotations.EMPTY, CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
toSourceElement(functionLiteral)
|
||||||
|
);
|
||||||
|
|
||||||
List<ValueParameterDescriptor> valueParameterDescriptors = createValueParameterDescriptors(context, functionLiteral,
|
List<ValueParameterDescriptor> valueParameterDescriptors = createValueParameterDescriptors(context, functionLiteral,
|
||||||
functionDescriptor, functionTypeExpected);
|
functionDescriptor, functionTypeExpected);
|
||||||
@@ -180,7 +183,8 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
|||||||
ValueParameterDescriptor valueParameterDescriptor = expectedValueParameters.get(0);
|
ValueParameterDescriptor valueParameterDescriptor = expectedValueParameters.get(0);
|
||||||
ValueParameterDescriptor it = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptor it = new ValueParameterDescriptorImpl(
|
||||||
functionDescriptor, null, 0, Annotations.EMPTY, Name.identifier("it"),
|
functionDescriptor, null, 0, Annotations.EMPTY, Name.identifier("it"),
|
||||||
valueParameterDescriptor.getType(), valueParameterDescriptor.hasDefaultValue(), valueParameterDescriptor.getVarargElementType()
|
valueParameterDescriptor.getType(), valueParameterDescriptor.hasDefaultValue(), valueParameterDescriptor.getVarargElementType(),
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
valueParameterDescriptors.add(it);
|
valueParameterDescriptors.add(it);
|
||||||
context.trace.record(AUTO_CREATED_IT, it);
|
context.trace.record(AUTO_CREATED_IT, it);
|
||||||
|
|||||||
+4
-2
@@ -86,7 +86,7 @@ public class ControlStructureTypingUtils {
|
|||||||
|
|
||||||
SimpleFunctionDescriptorImpl function = SimpleFunctionDescriptorImpl.create(
|
SimpleFunctionDescriptorImpl function = SimpleFunctionDescriptorImpl.create(
|
||||||
ErrorUtils.getErrorModule(),//todo hack to avoid returning true in 'isError(DeclarationDescriptor)'
|
ErrorUtils.getErrorModule(),//todo hack to avoid returning true in 'isError(DeclarationDescriptor)'
|
||||||
Annotations.EMPTY, specialFunctionName, CallableMemberDescriptor.Kind.DECLARATION);
|
Annotations.EMPTY, specialFunctionName, CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE);
|
||||||
|
|
||||||
TypeParameterDescriptor typeParameter = TypeParameterDescriptorImpl.createWithDefaultBound(
|
TypeParameterDescriptor typeParameter = TypeParameterDescriptorImpl.createWithDefaultBound(
|
||||||
function, Annotations.EMPTY, false, Variance.INVARIANT,
|
function, Annotations.EMPTY, false, Variance.INVARIANT,
|
||||||
@@ -99,7 +99,9 @@ public class ControlStructureTypingUtils {
|
|||||||
for (int i = 0; i < argumentNames.size(); i++) {
|
for (int i = 0; i < argumentNames.size(); i++) {
|
||||||
JetType argumentType = isArgumentNullable.get(i) ? nullableType : type;
|
JetType argumentType = isArgumentNullable.get(i) ? nullableType : type;
|
||||||
ValueParameterDescriptorImpl valueParameter = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptorImpl valueParameter = new ValueParameterDescriptorImpl(
|
||||||
function, null, i, Annotations.EMPTY, Name.identifier(argumentNames.get(i)), argumentType, false, null);
|
function, null, i, Annotations.EMPTY, Name.identifier(argumentNames.get(i)),
|
||||||
|
argumentType, false, null, SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
valueParameters.add(valueParameter);
|
valueParameters.add(valueParameter);
|
||||||
}
|
}
|
||||||
function.initialize(
|
function.initialize(
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ClassDescriptorWithResolutionScopes createClassDescriptor(ClassKind kind, JetClass aClass) {
|
private ClassDescriptorWithResolutionScopes createClassDescriptor(ClassKind kind, JetClass aClass) {
|
||||||
MutableClassDescriptor classDescriptor = new MutableClassDescriptor(root, scope, kind, false, aClass.getNameAsSafeName());
|
MutableClassDescriptor classDescriptor =
|
||||||
|
new MutableClassDescriptor(root, scope, kind, false, aClass.getNameAsSafeName(), SourceElement.NO_SOURCE);
|
||||||
TopDownAnalysisParameters parameters = TopDownAnalysisParameters.create(
|
TopDownAnalysisParameters parameters = TopDownAnalysisParameters.create(
|
||||||
LockBasedStorageManager.NO_LOCKS, new ExceptionTracker(), Predicates.<PsiFile>alwaysTrue(), false, false
|
LockBasedStorageManager.NO_LOCKS, new ExceptionTracker(), Predicates.<PsiFile>alwaysTrue(), false, false
|
||||||
);
|
);
|
||||||
|
|||||||
+10
-6
@@ -21,6 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.ConstructorDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.ConstructorDescriptorImpl;
|
||||||
|
|
||||||
@@ -33,18 +34,20 @@ public class JavaConstructorDescriptor extends ConstructorDescriptorImpl impleme
|
|||||||
@Nullable JavaConstructorDescriptor original,
|
@Nullable JavaConstructorDescriptor original,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
boolean isPrimary,
|
boolean isPrimary,
|
||||||
@NotNull Kind kind
|
@NotNull Kind kind,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, original, annotations, isPrimary, kind);
|
super(containingDeclaration, original, annotations, isPrimary, kind, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JavaConstructorDescriptor createJavaConstructor(
|
public static JavaConstructorDescriptor createJavaConstructor(
|
||||||
@NotNull ClassDescriptor containingDeclaration,
|
@NotNull ClassDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
boolean isPrimary
|
boolean isPrimary,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
return new JavaConstructorDescriptor(containingDeclaration, null, annotations, isPrimary, Kind.DECLARATION);
|
return new JavaConstructorDescriptor(containingDeclaration, null, annotations, isPrimary, Kind.DECLARATION, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -80,8 +83,9 @@ public class JavaConstructorDescriptor extends ConstructorDescriptorImpl impleme
|
|||||||
"newOwner: " + newOwner + "\n" +
|
"newOwner: " + newOwner + "\n" +
|
||||||
"kind: " + kind);
|
"kind: " + kind);
|
||||||
}
|
}
|
||||||
JavaConstructorDescriptor result =
|
JavaConstructorDescriptor result = new JavaConstructorDescriptor(
|
||||||
new JavaConstructorDescriptor((ClassDescriptor) newOwner, this, Annotations.EMPTY /* TODO */, isPrimary, kind);
|
(ClassDescriptor) newOwner, this, Annotations.EMPTY /* TODO */, isPrimary, kind, SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
result.setHasStableParameterNames(hasStableParameterNames());
|
result.setHasStableParameterNames(hasStableParameterNames());
|
||||||
result.setHasSynthesizedParameterNames(hasSynthesizedParameterNames());
|
result.setHasSynthesizedParameterNames(hasSynthesizedParameterNames());
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
+9
-5
@@ -21,6 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.FunctionDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.FunctionDescriptorImpl;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||||
@@ -35,18 +36,20 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement
|
|||||||
@Nullable SimpleFunctionDescriptor original,
|
@Nullable SimpleFunctionDescriptor original,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Kind kind
|
@NotNull Kind kind,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, original, annotations, name, kind);
|
super(containingDeclaration, original, annotations, name, kind, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JavaMethodDescriptor createJavaMethod(
|
public static JavaMethodDescriptor createJavaMethod(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name
|
@NotNull Name name,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
return new JavaMethodDescriptor(containingDeclaration, null, annotations, name, Kind.DECLARATION);
|
return new JavaMethodDescriptor(containingDeclaration, null, annotations, name, Kind.DECLARATION, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -81,7 +84,8 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement
|
|||||||
(SimpleFunctionDescriptor) original,
|
(SimpleFunctionDescriptor) original,
|
||||||
getAnnotations(),
|
getAnnotations(),
|
||||||
getName(),
|
getName(),
|
||||||
kind
|
kind,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
result.setHasStableParameterNames(hasStableParameterNames());
|
result.setHasStableParameterNames(hasStableParameterNames());
|
||||||
result.setHasSynthesizedParameterNames(hasSynthesizedParameterNames());
|
result.setHasSynthesizedParameterNames(hasSynthesizedParameterNames());
|
||||||
|
|||||||
+4
-2
@@ -19,6 +19,7 @@ package org.jetbrains.jet.lang.resolve.java.descriptor;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.Modality;
|
import org.jetbrains.jet.lang.descriptors.Modality;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.Visibility;
|
import org.jetbrains.jet.lang.descriptors.Visibility;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.PropertyDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.PropertyDescriptorImpl;
|
||||||
@@ -30,9 +31,10 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
|
|||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Visibility visibility,
|
@NotNull Visibility visibility,
|
||||||
boolean isVar,
|
boolean isVar,
|
||||||
@NotNull Name name
|
@NotNull Name name,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, null, annotations, Modality.FINAL, visibility, isVar, name, Kind.DECLARATION);
|
super(containingDeclaration, null, annotations, Modality.FINAL, visibility, isVar, name, Kind.DECLARATION, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+4
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2013 JetBrains s.r.o.
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.resolve.java.descriptor;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassOrPackageFragmentDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ClassOrPackageFragmentDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.SynthesizedCallableMemberDescriptor;
|
import org.jetbrains.jet.lang.descriptors.SynthesizedCallableMemberDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||||
|
|
||||||
@@ -29,7 +30,8 @@ public class SamConstructorDescriptor extends SimpleFunctionDescriptorImpl
|
|||||||
@NotNull ClassOrPackageFragmentDescriptor containingDeclaration,
|
@NotNull ClassOrPackageFragmentDescriptor containingDeclaration,
|
||||||
@NotNull JavaClassDescriptor samInterface
|
@NotNull JavaClassDescriptor samInterface
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, null, samInterface.getAnnotations(), samInterface.getName(), Kind.SYNTHESIZED);
|
super(containingDeclaration, null, samInterface.getAnnotations(), samInterface.getName(),
|
||||||
|
Kind.SYNTHESIZED, samInterface.getSource());
|
||||||
this.samInterface = samInterface;
|
this.samInterface = samInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -46,7 +46,8 @@ public class LazyJavaPackageFragmentProvider(
|
|||||||
outerContext.errorReporter,
|
outerContext.errorReporter,
|
||||||
outerContext.methodSignatureChecker,
|
outerContext.methodSignatureChecker,
|
||||||
outerContext.javaResolverCache,
|
outerContext.javaResolverCache,
|
||||||
outerContext.javaPropertyInitializerEvaluator
|
outerContext.javaPropertyInitializerEvaluator,
|
||||||
|
outerContext.sourceElementFactory
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun getModule() = _module
|
override fun getModule() = _module
|
||||||
|
|||||||
+11
-5
@@ -29,6 +29,7 @@ import org.jetbrains.jet.lang.resolve.java.resolver.JavaResolverCache
|
|||||||
import org.jetbrains.jet.lang.resolve.kotlin.DeserializedDescriptorResolver
|
import org.jetbrains.jet.lang.resolve.kotlin.DeserializedDescriptorResolver
|
||||||
import org.jetbrains.jet.lang.resolve.kotlin.KotlinClassFinder
|
import org.jetbrains.jet.lang.resolve.kotlin.KotlinClassFinder
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaPropertyInitializerEvaluator
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaPropertyInitializerEvaluator
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.sources.JavaSourceElementFactory
|
||||||
|
|
||||||
open class GlobalJavaResolverContext(
|
open class GlobalJavaResolverContext(
|
||||||
val storageManager: StorageManager,
|
val storageManager: StorageManager,
|
||||||
@@ -40,7 +41,8 @@ open class GlobalJavaResolverContext(
|
|||||||
val errorReporter: ErrorReporter,
|
val errorReporter: ErrorReporter,
|
||||||
val methodSignatureChecker: MethodSignatureChecker,
|
val methodSignatureChecker: MethodSignatureChecker,
|
||||||
val javaResolverCache: JavaResolverCache,
|
val javaResolverCache: JavaResolverCache,
|
||||||
val javaPropertyInitializerEvaluator: JavaPropertyInitializerEvaluator
|
val javaPropertyInitializerEvaluator: JavaPropertyInitializerEvaluator,
|
||||||
|
val sourceElementFactory: JavaSourceElementFactory
|
||||||
)
|
)
|
||||||
|
|
||||||
open class LazyJavaResolverContext(
|
open class LazyJavaResolverContext(
|
||||||
@@ -55,10 +57,12 @@ open class LazyJavaResolverContext(
|
|||||||
errorReporter: ErrorReporter,
|
errorReporter: ErrorReporter,
|
||||||
methodSignatureChecker: MethodSignatureChecker,
|
methodSignatureChecker: MethodSignatureChecker,
|
||||||
javaResolverCache: JavaResolverCache,
|
javaResolverCache: JavaResolverCache,
|
||||||
javaPropertyInitializerEvaluator: JavaPropertyInitializerEvaluator
|
javaPropertyInitializerEvaluator: JavaPropertyInitializerEvaluator,
|
||||||
|
sourceElementFactory: JavaSourceElementFactory
|
||||||
) : GlobalJavaResolverContext(storageManager, finder, kotlinClassFinder, deserializedDescriptorResolver,
|
) : GlobalJavaResolverContext(storageManager, finder, kotlinClassFinder, deserializedDescriptorResolver,
|
||||||
externalAnnotationResolver, externalSignatureResolver,
|
externalAnnotationResolver, externalSignatureResolver,
|
||||||
errorReporter, methodSignatureChecker, javaResolverCache, javaPropertyInitializerEvaluator)
|
errorReporter, methodSignatureChecker, javaResolverCache, javaPropertyInitializerEvaluator,
|
||||||
|
sourceElementFactory)
|
||||||
|
|
||||||
fun LazyJavaResolverContext.withTypes(
|
fun LazyJavaResolverContext.withTypes(
|
||||||
typeParameterResolver: TypeParameterResolver = TypeParameterResolver.EMPTY
|
typeParameterResolver: TypeParameterResolver = TypeParameterResolver.EMPTY
|
||||||
@@ -75,6 +79,7 @@ fun LazyJavaResolverContext.withTypes(
|
|||||||
methodSignatureChecker,
|
methodSignatureChecker,
|
||||||
javaResolverCache,
|
javaResolverCache,
|
||||||
javaPropertyInitializerEvaluator,
|
javaPropertyInitializerEvaluator,
|
||||||
|
sourceElementFactory,
|
||||||
LazyJavaTypeResolver(this, typeParameterResolver),
|
LazyJavaTypeResolver(this, typeParameterResolver),
|
||||||
typeParameterResolver)
|
typeParameterResolver)
|
||||||
|
|
||||||
@@ -91,12 +96,13 @@ class LazyJavaResolverContextWithTypes(
|
|||||||
methodSignatureChecker: MethodSignatureChecker,
|
methodSignatureChecker: MethodSignatureChecker,
|
||||||
javaResolverCache: JavaResolverCache,
|
javaResolverCache: JavaResolverCache,
|
||||||
javaPropertyInitializerEvaluator: JavaPropertyInitializerEvaluator,
|
javaPropertyInitializerEvaluator: JavaPropertyInitializerEvaluator,
|
||||||
|
sourceElementFactory: JavaSourceElementFactory,
|
||||||
val typeResolver: LazyJavaTypeResolver,
|
val typeResolver: LazyJavaTypeResolver,
|
||||||
val typeParameterResolver: TypeParameterResolver
|
val typeParameterResolver: TypeParameterResolver
|
||||||
) : LazyJavaResolverContext(packageFragmentProvider, javaClassResolver, storageManager, finder,
|
) : LazyJavaResolverContext(packageFragmentProvider, javaClassResolver, storageManager, finder,
|
||||||
kotlinClassFinder, deserializedDescriptorResolver,
|
kotlinClassFinder, deserializedDescriptorResolver,
|
||||||
externalAnnotationResolver, externalSignatureResolver,
|
externalAnnotationResolver, externalSignatureResolver, errorReporter, methodSignatureChecker,
|
||||||
errorReporter, methodSignatureChecker, javaResolverCache, javaPropertyInitializerEvaluator)
|
javaResolverCache, javaPropertyInitializerEvaluator, sourceElementFactory)
|
||||||
|
|
||||||
fun LazyJavaResolverContextWithTypes.child(
|
fun LazyJavaResolverContextWithTypes.child(
|
||||||
containingDeclaration: DeclarationDescriptor,
|
containingDeclaration: DeclarationDescriptor,
|
||||||
|
|||||||
+3
-1
@@ -49,13 +49,15 @@ import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassStaticsPackageFra
|
|||||||
import org.jetbrains.jet.lang.types.AbstractClassTypeConstructor
|
import org.jetbrains.jet.lang.types.AbstractClassTypeConstructor
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.resolveTopLevelClassInModule
|
import org.jetbrains.jet.lang.resolve.java.lazy.resolveTopLevelClassInModule
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.EnumClassObjectDescriptor
|
import org.jetbrains.jet.lang.descriptors.impl.EnumClassObjectDescriptor
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement
|
||||||
|
|
||||||
class LazyJavaClassDescriptor(
|
class LazyJavaClassDescriptor(
|
||||||
private val outerC: LazyJavaResolverContextWithTypes,
|
private val outerC: LazyJavaResolverContextWithTypes,
|
||||||
containingDeclaration: DeclarationDescriptor,
|
containingDeclaration: DeclarationDescriptor,
|
||||||
internal val fqName: FqName,
|
internal val fqName: FqName,
|
||||||
private val jClass: JavaClass
|
private val jClass: JavaClass
|
||||||
) : ClassDescriptorBase(outerC.storageManager, containingDeclaration, fqName.shortName()), LazyJavaDescriptor, JavaClassDescriptor {
|
) : ClassDescriptorBase(outerC.storageManager, containingDeclaration, fqName.shortName(),
|
||||||
|
outerC.sourceElementFactory.source(jClass)), LazyJavaDescriptor, JavaClassDescriptor {
|
||||||
|
|
||||||
private val c: LazyJavaResolverContextWithTypes = outerC.child(this, jClass.getTypeParameters().toSet());
|
private val c: LazyJavaResolverContextWithTypes = outerC.child(this, jClass.getTypeParameters().toSet());
|
||||||
|
|
||||||
|
|||||||
+9
-4
@@ -114,7 +114,9 @@ public class LazyJavaClassMemberScope(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun resolveConstructor(constructor: JavaMethod, classDescriptor: ClassDescriptor, isStaticClass: Boolean): JavaConstructorDescriptor {
|
private fun resolveConstructor(constructor: JavaMethod, classDescriptor: ClassDescriptor, isStaticClass: Boolean): JavaConstructorDescriptor {
|
||||||
val constructorDescriptor = JavaConstructorDescriptor.createJavaConstructor(classDescriptor, Annotations.EMPTY, /* isPrimary = */ false)
|
val constructorDescriptor = JavaConstructorDescriptor.createJavaConstructor(
|
||||||
|
classDescriptor, Annotations.EMPTY, /* isPrimary = */ false, c.sourceElementFactory.source(constructor)
|
||||||
|
)
|
||||||
|
|
||||||
val valueParameters = resolveValueParameters(c, constructorDescriptor, constructor.getValueParameters())
|
val valueParameters = resolveValueParameters(c, constructorDescriptor, constructor.getValueParameters())
|
||||||
val effectiveSignature = c.externalSignatureResolver.resolveAlternativeMethodSignature(
|
val effectiveSignature = c.externalSignatureResolver.resolveAlternativeMethodSignature(
|
||||||
@@ -147,7 +149,9 @@ public class LazyJavaClassMemberScope(
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
val classDescriptor = getContainingDeclaration()
|
val classDescriptor = getContainingDeclaration()
|
||||||
val constructorDescriptor = JavaConstructorDescriptor.createJavaConstructor(classDescriptor, Annotations.EMPTY, /* isPrimary = */ true)
|
val constructorDescriptor = JavaConstructorDescriptor.createJavaConstructor(
|
||||||
|
classDescriptor, Annotations.EMPTY, /* isPrimary = */ true, c.sourceElementFactory.source(jClass)
|
||||||
|
)
|
||||||
val typeParameters = classDescriptor.getTypeConstructor().getParameters()
|
val typeParameters = classDescriptor.getTypeConstructor().getParameters()
|
||||||
val valueParameters = if (isAnnotation) createAnnotationConstructorParameters(constructorDescriptor)
|
val valueParameters = if (isAnnotation) createAnnotationConstructorParameters(constructorDescriptor)
|
||||||
else Collections.emptyList<ValueParameterDescriptor>()
|
else Collections.emptyList<ValueParameterDescriptor>()
|
||||||
@@ -198,7 +202,8 @@ public class LazyJavaClassMemberScope(
|
|||||||
TypeUtils.makeNotNullable(returnType),
|
TypeUtils.makeNotNullable(returnType),
|
||||||
method.hasAnnotationParameterDefaultValue(),
|
method.hasAnnotationParameterDefaultValue(),
|
||||||
// Nulls are not allowed in annotation arguments in Java
|
// Nulls are not allowed in annotation arguments in Java
|
||||||
varargElementType?.let { TypeUtils.makeNotNullable(it) }
|
varargElementType?.let { TypeUtils.makeNotNullable(it) },
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +227,7 @@ public class LazyJavaClassMemberScope(
|
|||||||
EnumEntrySyntheticClassDescriptor.create(c.storageManager, getContainingDeclaration(), name,
|
EnumEntrySyntheticClassDescriptor.create(c.storageManager, getContainingDeclaration(), name,
|
||||||
c.storageManager.createLazyValue {
|
c.storageManager.createLazyValue {
|
||||||
memberIndex().getAllFieldNames() + memberIndex().getAllMethodNames()
|
memberIndex().getAllFieldNames() + memberIndex().getAllMethodNames()
|
||||||
})
|
}, SourceElement.NO_SOURCE)
|
||||||
}
|
}
|
||||||
else null
|
else null
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -112,7 +112,9 @@ public abstract class LazyJavaMemberScope(
|
|||||||
|
|
||||||
fun resolveMethodToFunctionDescriptor(method: JavaMethod, record: Boolean = true): JavaMethodDescriptor {
|
fun resolveMethodToFunctionDescriptor(method: JavaMethod, record: Boolean = true): JavaMethodDescriptor {
|
||||||
|
|
||||||
val functionDescriptorImpl = JavaMethodDescriptor.createJavaMethod(_containingDeclaration, c.resolveAnnotations(method), method.getName())
|
val functionDescriptorImpl = JavaMethodDescriptor.createJavaMethod(
|
||||||
|
_containingDeclaration, c.resolveAnnotations(method), method.getName(), c.sourceElementFactory.source(method)
|
||||||
|
)
|
||||||
|
|
||||||
val c = c.child(functionDescriptorImpl, method.getTypeParameters().toSet())
|
val c = c.child(functionDescriptorImpl, method.getTypeParameters().toSet())
|
||||||
|
|
||||||
@@ -210,7 +212,8 @@ public abstract class LazyJavaMemberScope(
|
|||||||
name,
|
name,
|
||||||
outType,
|
outType,
|
||||||
false,
|
false,
|
||||||
varargElementType
|
varargElementType,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
)
|
)
|
||||||
}.toList()
|
}.toList()
|
||||||
return ResolvedValueParameters(descriptors, synthesizedNames)
|
return ResolvedValueParameters(descriptors, synthesizedNames)
|
||||||
@@ -273,7 +276,8 @@ public abstract class LazyJavaMemberScope(
|
|||||||
val annotations = c.resolveAnnotations(field)
|
val annotations = c.resolveAnnotations(field)
|
||||||
val propertyName = field.getName()
|
val propertyName = field.getName()
|
||||||
|
|
||||||
return JavaPropertyDescriptor(_containingDeclaration, annotations, visibility, isVar, propertyName)
|
return JavaPropertyDescriptor(_containingDeclaration, annotations, visibility, isVar, propertyName,
|
||||||
|
c.sourceElementFactory.source(field))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPropertyType(field: JavaField): JetType {
|
private fun getPropertyType(field: JavaField): JetType {
|
||||||
|
|||||||
+3
-1
@@ -25,6 +25,7 @@ import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns
|
|||||||
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage
|
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaResolverContextWithTypes
|
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaResolverContextWithTypes
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.types.toAttributes
|
import org.jetbrains.jet.lang.resolve.java.lazy.types.toAttributes
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement
|
||||||
|
|
||||||
class LazyJavaTypeParameterDescriptor(
|
class LazyJavaTypeParameterDescriptor(
|
||||||
private val c: LazyJavaResolverContextWithTypes,
|
private val c: LazyJavaResolverContextWithTypes,
|
||||||
@@ -36,7 +37,8 @@ class LazyJavaTypeParameterDescriptor(
|
|||||||
javaTypeParameter.getName(),
|
javaTypeParameter.getName(),
|
||||||
Variance.INVARIANT,
|
Variance.INVARIANT,
|
||||||
/* isReified = */ false,
|
/* isReified = */ false,
|
||||||
javaTypeParameter.getIndex()
|
javaTypeParameter.getIndex(),
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun resolveUpperBounds(): Set<JetType> {
|
override fun resolveUpperBounds(): Set<JetType> {
|
||||||
|
|||||||
+3
-1
@@ -245,7 +245,9 @@ public final class DescriptorResolverUtils {
|
|||||||
typeParameter.isReified(),
|
typeParameter.isReified(),
|
||||||
typeParameter.getVariance(),
|
typeParameter.getVariance(),
|
||||||
typeParameter.getName(),
|
typeParameter.getName(),
|
||||||
typeParameter.getIndex()));
|
typeParameter.getIndex(),
|
||||||
|
SourceElement.NO_SOURCE)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.java.sam;
|
package org.jetbrains.jet.lang.resolve.java.sam;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaConstructorDescriptor;
|
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaConstructorDescriptor;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.SamAdapterDescriptor;
|
import org.jetbrains.jet.lang.resolve.java.descriptor.SamAdapterDescriptor;
|
||||||
|
|
||||||
@@ -24,7 +25,8 @@ import org.jetbrains.jet.lang.resolve.java.descriptor.SamAdapterDescriptor;
|
|||||||
private final JavaConstructorDescriptor declaration;
|
private final JavaConstructorDescriptor declaration;
|
||||||
|
|
||||||
public SamAdapterConstructorDescriptor(@NotNull JavaConstructorDescriptor declaration) {
|
public SamAdapterConstructorDescriptor(@NotNull JavaConstructorDescriptor declaration) {
|
||||||
super(declaration.getContainingDeclaration(), null, declaration.getAnnotations(), declaration.isPrimary(), Kind.SYNTHESIZED);
|
super(declaration.getContainingDeclaration(), null, declaration.getAnnotations(),
|
||||||
|
declaration.isPrimary(), Kind.SYNTHESIZED, declaration.getSource());
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
setHasStableParameterNames(declaration.hasStableParameterNames());
|
setHasStableParameterNames(declaration.hasStableParameterNames());
|
||||||
setHasSynthesizedParameterNames(declaration.hasSynthesizedParameterNames());
|
setHasSynthesizedParameterNames(declaration.hasSynthesizedParameterNames());
|
||||||
|
|||||||
+3
-1
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.java.sam;
|
package org.jetbrains.jet.lang.resolve.java.sam;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaMethodDescriptor;
|
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaMethodDescriptor;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.SamAdapterDescriptor;
|
import org.jetbrains.jet.lang.resolve.java.descriptor.SamAdapterDescriptor;
|
||||||
|
|
||||||
@@ -24,7 +25,8 @@ import org.jetbrains.jet.lang.resolve.java.descriptor.SamAdapterDescriptor;
|
|||||||
private final JavaMethodDescriptor declaration;
|
private final JavaMethodDescriptor declaration;
|
||||||
|
|
||||||
public SamAdapterFunctionDescriptor(@NotNull JavaMethodDescriptor declaration) {
|
public SamAdapterFunctionDescriptor(@NotNull JavaMethodDescriptor declaration) {
|
||||||
super(declaration.getContainingDeclaration(), null, declaration.getAnnotations(), declaration.getName(), Kind.SYNTHESIZED);
|
super(declaration.getContainingDeclaration(), null, declaration.getAnnotations(),
|
||||||
|
declaration.getName(), Kind.SYNTHESIZED, declaration.getSource());
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
setHasStableParameterNames(declaration.hasStableParameterNames());
|
setHasStableParameterNames(declaration.hasStableParameterNames());
|
||||||
setHasSynthesizedParameterNames(declaration.hasSynthesizedParameterNames());
|
setHasSynthesizedParameterNames(declaration.hasSynthesizedParameterNames());
|
||||||
|
|||||||
+4
-2
@@ -145,7 +145,7 @@ public class SingleAbstractMethodUtils {
|
|||||||
assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted +
|
assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted +
|
||||||
", substitutor = " + typeParameters.substitutor;
|
", substitutor = " + typeParameters.substitutor;
|
||||||
ValueParameterDescriptor parameter = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptor parameter = new ValueParameterDescriptorImpl(
|
||||||
result, null, 0, Annotations.EMPTY, Name.identifier("function"), parameterType, false, null);
|
result, null, 0, Annotations.EMPTY, Name.identifier("function"), parameterType, false, null, SourceElement.NO_SOURCE);
|
||||||
|
|
||||||
JetType returnType = typeParameters.substitutor.substitute(samInterface.getDefaultType(), Variance.OUT_VARIANCE);
|
JetType returnType = typeParameters.substitutor.substitute(samInterface.getDefaultType(), Variance.OUT_VARIANCE);
|
||||||
assert returnType != null : "couldn't substitute type: " + samInterface.getDefaultType() +
|
assert returnType != null : "couldn't substitute type: " + samInterface.getDefaultType() +
|
||||||
@@ -249,7 +249,9 @@ public class SingleAbstractMethodUtils {
|
|||||||
assert newType != null : "couldn't substitute type: " + newTypeUnsubstituted + ", substitutor = " + typeParameters.substitutor;
|
assert newType != null : "couldn't substitute type: " + newTypeUnsubstituted + ", substitutor = " + typeParameters.substitutor;
|
||||||
|
|
||||||
ValueParameterDescriptor newParam = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptor newParam = new ValueParameterDescriptorImpl(
|
||||||
adapter, null, originalParam.getIndex(), originalParam.getAnnotations(), originalParam.getName(), newType, false, null);
|
adapter, null, originalParam.getIndex(), originalParam.getAnnotations(),
|
||||||
|
originalParam.getName(), newType, false, null, SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
valueParameters.add(newParam);
|
valueParameters.add(newParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.resolve.java.sources
|
||||||
|
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaElement
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement
|
||||||
|
|
||||||
|
trait JavaSourceElementFactory {
|
||||||
|
fun source(javaElement: JavaElement): SourceElement
|
||||||
|
}
|
||||||
+1
-1
@@ -18,7 +18,7 @@ package org.jetbrains.jet.lang.descriptors;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public interface DeclarationDescriptorNonRoot extends DeclarationDescriptor {
|
public interface DeclarationDescriptorNonRoot extends DeclarationDescriptorWithSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.descriptors;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public interface DeclarationDescriptorWithSource extends DeclarationDescriptor {
|
||||||
|
@NotNull
|
||||||
|
SourceElement getSource();
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.jet.lang.descriptors;
|
||||||
|
|
||||||
|
public interface SourceElement {
|
||||||
|
SourceElement NO_SOURCE = new SourceElement() { };
|
||||||
|
}
|
||||||
+1
@@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.descriptors;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
//TODO: drop
|
||||||
public interface SynthesizedCallableMemberDescriptor<D extends DeclarationDescriptor> extends CallableMemberDescriptor {
|
public interface SynthesizedCallableMemberDescriptor<D extends DeclarationDescriptor> extends CallableMemberDescriptor {
|
||||||
@NotNull
|
@NotNull
|
||||||
D getBaseForSynthesized();
|
D getBaseForSynthesized();
|
||||||
|
|||||||
+4
-2
@@ -19,6 +19,7 @@ package org.jetbrains.jet.lang.descriptors.impl;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
@@ -38,9 +39,10 @@ public abstract class AbstractLazyTypeParameterDescriptor extends AbstractTypePa
|
|||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Variance variance,
|
@NotNull Variance variance,
|
||||||
boolean isReified,
|
boolean isReified,
|
||||||
int index
|
int index,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(storageManager, containingDeclaration, Annotations.EMPTY /* TODO */, name, variance, isReified, index);
|
super(storageManager, containingDeclaration, Annotations.EMPTY /* TODO */, name, variance, isReified, index, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+6
@@ -109,4 +109,10 @@ public abstract class AbstractReceiverParameterDescriptor extends DeclarationDes
|
|||||||
public CallableDescriptor getOriginal() {
|
public CallableDescriptor getOriginal() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public SourceElement getSource() {
|
||||||
|
return SourceElement.NO_SOURCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.ReadOnly;
|
import org.jetbrains.annotations.ReadOnly;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorVisitor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorVisitor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
@@ -52,9 +53,10 @@ public abstract class AbstractTypeParameterDescriptor extends DeclarationDescrip
|
|||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Variance variance,
|
@NotNull Variance variance,
|
||||||
boolean isReified,
|
boolean isReified,
|
||||||
int index
|
int index,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, annotations, name);
|
super(containingDeclaration, annotations, name, source);
|
||||||
this.variance = variance;
|
this.variance = variance;
|
||||||
this.reified = isReified;
|
this.reified = isReified;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
|||||||
+4
-2
@@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.descriptors.impl;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
|
|
||||||
@@ -25,8 +26,9 @@ public class AnonymousFunctionDescriptor extends SimpleFunctionDescriptorImpl {
|
|||||||
public AnonymousFunctionDescriptor(
|
public AnonymousFunctionDescriptor(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Kind kind
|
@NotNull Kind kind,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, null, annotations, Name.special("<anonymous>"), kind);
|
super(containingDeclaration, null, annotations, Name.special("<anonymous>"), kind, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-1
@@ -18,20 +18,24 @@ package org.jetbrains.jet.lang.descriptors.impl;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.storage.StorageManager;
|
import org.jetbrains.jet.storage.StorageManager;
|
||||||
|
|
||||||
public abstract class ClassDescriptorBase extends AbstractClassDescriptor {
|
public abstract class ClassDescriptorBase extends AbstractClassDescriptor {
|
||||||
|
|
||||||
private final DeclarationDescriptor containingDeclaration;
|
private final DeclarationDescriptor containingDeclaration;
|
||||||
|
private final SourceElement source;
|
||||||
|
|
||||||
protected ClassDescriptorBase(
|
protected ClassDescriptorBase(
|
||||||
@NotNull StorageManager storageManager,
|
@NotNull StorageManager storageManager,
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Name name
|
@NotNull Name name,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(storageManager, name);
|
super(storageManager, name);
|
||||||
this.containingDeclaration = containingDeclaration;
|
this.containingDeclaration = containingDeclaration;
|
||||||
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -39,4 +43,10 @@ public abstract class ClassDescriptorBase extends AbstractClassDescriptor {
|
|||||||
public DeclarationDescriptor getContainingDeclaration() {
|
public DeclarationDescriptor getContainingDeclaration() {
|
||||||
return containingDeclaration;
|
return containingDeclaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public SourceElement getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -43,9 +43,10 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
|
|||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Modality modality,
|
@NotNull Modality modality,
|
||||||
@NotNull Collection<JetType> supertypes
|
@NotNull Collection<JetType> supertypes,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name);
|
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, name, source);
|
||||||
this.modality = modality;
|
this.modality = modality;
|
||||||
|
|
||||||
this.typeConstructor = TypeConstructorImpl.createForClass(this, Annotations.EMPTY, false, getName().asString(),
|
this.typeConstructor = TypeConstructorImpl.createForClass(this, Annotations.EMPTY, false, getName().asString(),
|
||||||
|
|||||||
+10
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2013 JetBrains s.r.o.
|
* Copyright 2010-2014 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -40,9 +40,10 @@ public class ConstructorDescriptorImpl extends FunctionDescriptorImpl implements
|
|||||||
@Nullable ConstructorDescriptor original,
|
@Nullable ConstructorDescriptor original,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
boolean isPrimary,
|
boolean isPrimary,
|
||||||
@NotNull Kind kind
|
@NotNull Kind kind,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, original, annotations, NAME, kind);
|
super(containingDeclaration, original, annotations, NAME, kind, source);
|
||||||
this.isPrimary = isPrimary;
|
this.isPrimary = isPrimary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,9 +51,10 @@ public class ConstructorDescriptorImpl extends FunctionDescriptorImpl implements
|
|||||||
public static ConstructorDescriptorImpl create(
|
public static ConstructorDescriptorImpl create(
|
||||||
@NotNull ClassDescriptor containingDeclaration,
|
@NotNull ClassDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
boolean isPrimary
|
boolean isPrimary,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
return new ConstructorDescriptorImpl(containingDeclaration, null, annotations, isPrimary, Kind.DECLARATION);
|
return new ConstructorDescriptorImpl(containingDeclaration, null, annotations, isPrimary, Kind.DECLARATION, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConstructorDescriptorImpl initialize(
|
public ConstructorDescriptorImpl initialize(
|
||||||
@@ -124,7 +126,9 @@ public class ConstructorDescriptorImpl extends FunctionDescriptorImpl implements
|
|||||||
this,
|
this,
|
||||||
Annotations.EMPTY, // TODO
|
Annotations.EMPTY, // TODO
|
||||||
isPrimary,
|
isPrimary,
|
||||||
Kind.DECLARATION);
|
Kind.DECLARATION,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+14
-1
@@ -19,6 +19,7 @@ package org.jetbrains.jet.lang.descriptors.impl;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorNonRoot;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorNonRoot;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
|
|
||||||
@@ -29,13 +30,19 @@ public abstract class DeclarationDescriptorNonRootImpl
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final DeclarationDescriptor containingDeclaration;
|
private final DeclarationDescriptor containingDeclaration;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final SourceElement source;
|
||||||
|
|
||||||
protected DeclarationDescriptorNonRootImpl(
|
protected DeclarationDescriptorNonRootImpl(
|
||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name) {
|
@NotNull Name name,
|
||||||
|
@NotNull SourceElement source
|
||||||
|
) {
|
||||||
super(annotations, name);
|
super(annotations, name);
|
||||||
|
|
||||||
this.containingDeclaration = containingDeclaration;
|
this.containingDeclaration = containingDeclaration;
|
||||||
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -44,4 +51,10 @@ public abstract class DeclarationDescriptorNonRootImpl
|
|||||||
return containingDeclaration;
|
return containingDeclaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@NotNull
|
||||||
|
public SourceElement getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -39,8 +39,8 @@ import kotlin.properties.Delegates
|
|||||||
public class EnumClassObjectDescriptor(
|
public class EnumClassObjectDescriptor(
|
||||||
storageManager: StorageManager,
|
storageManager: StorageManager,
|
||||||
enumClass: ClassDescriptor
|
enumClass: ClassDescriptor
|
||||||
) : ClassDescriptorBase(storageManager, enumClass, SpecialNames.getClassObjectName(enumClass.getName())) {
|
) : ClassDescriptorBase(storageManager, enumClass, SpecialNames.getClassObjectName(enumClass.getName()), SourceElement.NO_SOURCE) {
|
||||||
private val primaryConstructor = DescriptorFactory.createPrimaryConstructorForObject(this)
|
private val primaryConstructor = DescriptorFactory.createPrimaryConstructorForObject(this, SourceElement.NO_SOURCE)
|
||||||
|
|
||||||
;{
|
;{
|
||||||
primaryConstructor.setReturnType(object : DelegatingType() {
|
primaryConstructor.setReturnType(object : DelegatingType() {
|
||||||
@@ -112,14 +112,14 @@ public class EnumClassObjectDescriptor(
|
|||||||
|
|
||||||
private fun createEnumClassObjectValuesMethod(enumType: JetType): SimpleFunctionDescriptor {
|
private fun createEnumClassObjectValuesMethod(enumType: JetType): SimpleFunctionDescriptor {
|
||||||
val enumArrayType = KotlinBuiltIns.getInstance().getArrayType(enumType)
|
val enumArrayType = KotlinBuiltIns.getInstance().getArrayType(enumType)
|
||||||
val values = SimpleFunctionDescriptorImpl.create(enumClassObject, Annotations.EMPTY, Name.identifier("values"), SYNTHESIZED)
|
val values = SimpleFunctionDescriptorImpl.create(enumClassObject, Annotations.EMPTY, Name.identifier("values"), SYNTHESIZED, SourceElement.NO_SOURCE)
|
||||||
return values.initialize(null, getThisAsReceiverParameter(), listOf(), listOf(), enumArrayType, Modality.FINAL, Visibilities.PUBLIC)
|
return values.initialize(null, getThisAsReceiverParameter(), listOf(), listOf(), enumArrayType, Modality.FINAL, Visibilities.PUBLIC)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createEnumClassObjectValueOfMethod(enumType: JetType): SimpleFunctionDescriptor {
|
private fun createEnumClassObjectValueOfMethod(enumType: JetType): SimpleFunctionDescriptor {
|
||||||
val values = SimpleFunctionDescriptorImpl.create(enumClassObject, Annotations.EMPTY, Name.identifier("valueOf"), SYNTHESIZED)
|
val values = SimpleFunctionDescriptorImpl.create(enumClassObject, Annotations.EMPTY, Name.identifier("valueOf"), SYNTHESIZED, SourceElement.NO_SOURCE)
|
||||||
val parameter = ValueParameterDescriptorImpl(values, null, 0, Annotations.EMPTY, Name.identifier("value"),
|
val parameter = ValueParameterDescriptorImpl(values, null, 0, Annotations.EMPTY, Name.identifier("value"),
|
||||||
KotlinBuiltIns.getInstance().getStringType(), false, null)
|
KotlinBuiltIns.getInstance().getStringType(), false, null, SourceElement.NO_SOURCE)
|
||||||
return values.initialize(null, getThisAsReceiverParameter(), listOf(), listOf(parameter), enumType, Modality.FINAL, Visibilities.PUBLIC)
|
return values.initialize(null, getThisAsReceiverParameter(), listOf(), listOf(parameter), enumType, Modality.FINAL, Visibilities.PUBLIC)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-6
@@ -58,11 +58,12 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
|||||||
@NotNull StorageManager storageManager,
|
@NotNull StorageManager storageManager,
|
||||||
@NotNull ClassDescriptor enumClass,
|
@NotNull ClassDescriptor enumClass,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull NotNullLazyValue<Collection<Name>> enumMemberNames
|
@NotNull NotNullLazyValue<Collection<Name>> enumMemberNames,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
JetType enumType = enumClass.getDefaultType();
|
JetType enumType = enumClass.getDefaultType();
|
||||||
|
|
||||||
return new EnumEntrySyntheticClassDescriptor(storageManager, enumClass, enumType, name, ClassKind.ENUM_ENTRY, enumMemberNames);
|
return new EnumEntrySyntheticClassDescriptor(storageManager, enumClass, enumType, name, ClassKind.ENUM_ENTRY, enumMemberNames, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnumEntrySyntheticClassDescriptor(
|
private EnumEntrySyntheticClassDescriptor(
|
||||||
@@ -71,9 +72,10 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
|||||||
@NotNull JetType supertype,
|
@NotNull JetType supertype,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull ClassKind kind,
|
@NotNull ClassKind kind,
|
||||||
@NotNull NotNullLazyValue<Collection<Name>> enumMemberNames
|
@NotNull NotNullLazyValue<Collection<Name>> enumMemberNames,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(storageManager, containingClass, name);
|
super(storageManager, containingClass, name, source);
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
|
|
||||||
this.typeConstructor =
|
this.typeConstructor =
|
||||||
@@ -83,7 +85,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
|||||||
this.scope = new EnumEntryScope(storageManager);
|
this.scope = new EnumEntryScope(storageManager);
|
||||||
this.enumMemberNames = enumMemberNames;
|
this.enumMemberNames = enumMemberNames;
|
||||||
|
|
||||||
ConstructorDescriptorImpl primaryConstructor = DescriptorFactory.createPrimaryConstructorForObject(this);
|
ConstructorDescriptorImpl primaryConstructor = DescriptorFactory.createPrimaryConstructorForObject(this, source);
|
||||||
primaryConstructor.setReturnType(getDefaultType());
|
primaryConstructor.setReturnType(getDefaultType());
|
||||||
this.primaryConstructor = primaryConstructor;
|
this.primaryConstructor = primaryConstructor;
|
||||||
|
|
||||||
@@ -91,7 +93,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
|||||||
kind == ClassKind.CLASS_OBJECT
|
kind == ClassKind.CLASS_OBJECT
|
||||||
? null
|
? null
|
||||||
: new EnumEntrySyntheticClassDescriptor(storageManager, this, getDefaultType(), SpecialNames.getClassObjectName(name),
|
: new EnumEntrySyntheticClassDescriptor(storageManager, this, getDefaultType(), SpecialNames.getClassObjectName(name),
|
||||||
ClassKind.CLASS_OBJECT, enumMemberNames);
|
ClassKind.CLASS_OBJECT, enumMemberNames, SourceElement.NO_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+8
-4
@@ -41,8 +41,8 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
protected JetType unsubstitutedReturnType;
|
protected JetType unsubstitutedReturnType;
|
||||||
private ReceiverParameterDescriptor receiverParameter;
|
private ReceiverParameterDescriptor receiverParameter;
|
||||||
protected ReceiverParameterDescriptor expectedThisObject;
|
protected ReceiverParameterDescriptor expectedThisObject;
|
||||||
|
|
||||||
protected Modality modality;
|
protected Modality modality;
|
||||||
|
|
||||||
protected Visibility visibility;
|
protected Visibility visibility;
|
||||||
protected final Set<FunctionDescriptor> overriddenFunctions = Sets.newLinkedHashSet(); // LinkedHashSet is essential here
|
protected final Set<FunctionDescriptor> overriddenFunctions = Sets.newLinkedHashSet(); // LinkedHashSet is essential here
|
||||||
private final FunctionDescriptor original;
|
private final FunctionDescriptor original;
|
||||||
@@ -53,8 +53,10 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
@Nullable FunctionDescriptor original,
|
@Nullable FunctionDescriptor original,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Kind kind) {
|
@NotNull Kind kind,
|
||||||
super(containingDeclaration, annotations, name);
|
@NotNull SourceElement source
|
||||||
|
) {
|
||||||
|
super(containingDeclaration, annotations, name, source);
|
||||||
this.original = original == null ? this : original;
|
this.original = original == null ? this : original;
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
}
|
}
|
||||||
@@ -276,7 +278,9 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
unsubstitutedValueParameter.getName(),
|
unsubstitutedValueParameter.getName(),
|
||||||
substitutedType,
|
substitutedType,
|
||||||
unsubstitutedValueParameter.declaresDefaultValue(),
|
unsubstitutedValueParameter.declaresDefaultValue(),
|
||||||
substituteVarargElementType)
|
substituteVarargElementType,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
+6
@@ -202,4 +202,10 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
|||||||
public ConstructorDescriptor getUnsubstitutedPrimaryConstructor() {
|
public ConstructorDescriptor getUnsubstitutedPrimaryConstructor() {
|
||||||
return original.getUnsubstitutedPrimaryConstructor();
|
return original.getUnsubstitutedPrimaryConstructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public SourceElement getSource() {
|
||||||
|
return SourceElement.NO_SOURCE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -24,7 +24,8 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor
|
|||||||
public abstract class PackageFragmentDescriptorImpl(
|
public abstract class PackageFragmentDescriptorImpl(
|
||||||
module: ModuleDescriptor,
|
module: ModuleDescriptor,
|
||||||
override val fqName: FqName
|
override val fqName: FqName
|
||||||
) : DeclarationDescriptorNonRootImpl(module, Annotations.EMPTY, fqName.shortNameOrSpecial()), PackageFragmentDescriptor {
|
) : DeclarationDescriptorNonRootImpl(module, Annotations.EMPTY, fqName.shortNameOrSpecial(), SourceElement.NO_SOURCE),
|
||||||
|
PackageFragmentDescriptor {
|
||||||
override fun substitute(substitutor: TypeSubstitutor): DeclarationDescriptor? = this
|
override fun substitute(substitutor: TypeSubstitutor): DeclarationDescriptor? = this
|
||||||
|
|
||||||
override fun <R, D> accept(visitor: DeclarationDescriptorVisitor<R, D>, data: D): R =
|
override fun <R, D> accept(visitor: DeclarationDescriptorVisitor<R, D>, data: D): R =
|
||||||
@@ -33,4 +34,8 @@ public abstract class PackageFragmentDescriptorImpl(
|
|||||||
override fun getContainingDeclaration(): ModuleDescriptor {
|
override fun getContainingDeclaration(): ModuleDescriptor {
|
||||||
return super<DeclarationDescriptorNonRootImpl>.getContainingDeclaration() as ModuleDescriptor
|
return super<DeclarationDescriptorNonRootImpl>.getContainingDeclaration() as ModuleDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getSource(): SourceElement {
|
||||||
|
return SourceElement.NO_SOURCE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -45,9 +45,10 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
|||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
boolean hasBody,
|
boolean hasBody,
|
||||||
boolean isDefault,
|
boolean isDefault,
|
||||||
Kind kind
|
Kind kind,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(correspondingProperty.getContainingDeclaration(), annotations, name);
|
super(correspondingProperty.getContainingDeclaration(), annotations, name, source);
|
||||||
this.modality = modality;
|
this.modality = modality;
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
this.correspondingProperty = correspondingProperty;
|
this.correspondingProperty = correspondingProperty;
|
||||||
|
|||||||
+9
-7
@@ -59,9 +59,10 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
@NotNull Visibility visibility,
|
@NotNull Visibility visibility,
|
||||||
boolean isVar,
|
boolean isVar,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Kind kind
|
@NotNull Kind kind,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, annotations, name, null);
|
super(containingDeclaration, annotations, name, null, source);
|
||||||
this.isVar = isVar;
|
this.isVar = isVar;
|
||||||
this.modality = modality;
|
this.modality = modality;
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
@@ -77,9 +78,10 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
@NotNull Visibility visibility,
|
@NotNull Visibility visibility,
|
||||||
boolean isVar,
|
boolean isVar,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Kind kind
|
@NotNull Kind kind,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
return new PropertyDescriptorImpl(containingDeclaration, null, annotations, modality, visibility, isVar, name, kind);
|
return new PropertyDescriptorImpl(containingDeclaration, null, annotations, modality, visibility, isVar, name, kind, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(
|
public void setType(
|
||||||
@@ -243,7 +245,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
|
|
||||||
PropertyGetterDescriptorImpl newGetter = getter == null ? null : new PropertyGetterDescriptorImpl(
|
PropertyGetterDescriptorImpl newGetter = getter == null ? null : new PropertyGetterDescriptorImpl(
|
||||||
substitutedDescriptor, getter.getAnnotations(), newModality, convertVisibility(getter.getVisibility(), newVisibility),
|
substitutedDescriptor, getter.getAnnotations(), newModality, convertVisibility(getter.getVisibility(), newVisibility),
|
||||||
getter.hasBody(), getter.isDefault(), kind, getter.getOriginal()
|
getter.hasBody(), getter.isDefault(), kind, getter.getOriginal(), SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
if (newGetter != null) {
|
if (newGetter != null) {
|
||||||
JetType returnType = getter.getReturnType();
|
JetType returnType = getter.getReturnType();
|
||||||
@@ -251,7 +253,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
}
|
}
|
||||||
PropertySetterDescriptorImpl newSetter = setter == null ? null : new PropertySetterDescriptorImpl(
|
PropertySetterDescriptorImpl newSetter = setter == null ? null : new PropertySetterDescriptorImpl(
|
||||||
substitutedDescriptor, setter.getAnnotations(), newModality, convertVisibility(setter.getVisibility(), newVisibility),
|
substitutedDescriptor, setter.getAnnotations(), newModality, convertVisibility(setter.getVisibility(), newVisibility),
|
||||||
setter.hasBody(), setter.isDefault(), kind, setter.getOriginal()
|
setter.hasBody(), setter.isDefault(), kind, setter.getOriginal(), SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
if (newSetter != null) {
|
if (newSetter != null) {
|
||||||
List<ValueParameterDescriptor> substitutedValueParameters = FunctionDescriptorImpl.getSubstitutedValueParameters(newSetter, setter, substitutor);
|
List<ValueParameterDescriptor> substitutedValueParameters = FunctionDescriptorImpl.getSubstitutedValueParameters(newSetter, setter, substitutor);
|
||||||
@@ -292,7 +294,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorImpl implements Pr
|
|||||||
@NotNull Kind kind
|
@NotNull Kind kind
|
||||||
) {
|
) {
|
||||||
return new PropertyDescriptorImpl(newOwner, original,
|
return new PropertyDescriptorImpl(newOwner, original,
|
||||||
getAnnotations(), newModality, newVisibility, isVar(), getName(), kind);
|
getAnnotations(), newModality, newVisibility, isVar(), getName(), kind, SourceElement.NO_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+4
-2
@@ -41,10 +41,12 @@ public class PropertyGetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
|||||||
boolean hasBody,
|
boolean hasBody,
|
||||||
boolean isDefault,
|
boolean isDefault,
|
||||||
@NotNull Kind kind,
|
@NotNull Kind kind,
|
||||||
@Nullable PropertyGetterDescriptor original
|
@Nullable PropertyGetterDescriptor original,
|
||||||
|
@NotNull SourceElement source
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
super(modality, visibility, correspondingProperty, annotations, Name.special("<get-" + correspondingProperty.getName() + ">"), hasBody, isDefault, kind);
|
super(modality, visibility, correspondingProperty, annotations, Name.special("<get-" + correspondingProperty.getName() + ">"),
|
||||||
|
hasBody, isDefault, kind, source);
|
||||||
this.original = original != null ? original : this;
|
this.original = original != null ? original : this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -19,7 +19,6 @@ package org.jetbrains.jet.lang.descriptors.impl;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
@@ -43,9 +42,11 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
|||||||
boolean hasBody,
|
boolean hasBody,
|
||||||
boolean isDefault,
|
boolean isDefault,
|
||||||
@NotNull Kind kind,
|
@NotNull Kind kind,
|
||||||
@Nullable PropertySetterDescriptor original
|
@Nullable PropertySetterDescriptor original,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(modality, visibility, correspondingProperty, annotations, Name.special("<set-" + correspondingProperty.getName() + ">"), hasBody, isDefault, kind);
|
super(modality, visibility, correspondingProperty, annotations, Name.special("<set-" + correspondingProperty.getName() + ">"),
|
||||||
|
hasBody, isDefault, kind, source);
|
||||||
this.original = original != null ? original : this;
|
this.original = original != null ? original : this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ public class PropertySetterDescriptorImpl extends PropertyAccessorDescriptorImpl
|
|||||||
@NotNull JetType type
|
@NotNull JetType type
|
||||||
) {
|
) {
|
||||||
return new ValueParameterDescriptorImpl(
|
return new ValueParameterDescriptorImpl(
|
||||||
setterDescriptor, null, 0, Annotations.EMPTY, Name.special("<set-?>"), type, false, null
|
setterDescriptor, null, 0, Annotations.EMPTY, Name.special("<set-?>"), type, false, null, SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
public class ScriptCodeDescriptor extends FunctionDescriptorImpl {
|
public class ScriptCodeDescriptor extends FunctionDescriptorImpl {
|
||||||
|
|
||||||
public ScriptCodeDescriptor(@NotNull ScriptDescriptor containingDeclaration) {
|
public ScriptCodeDescriptor(@NotNull ScriptDescriptor containingDeclaration) {
|
||||||
super(containingDeclaration, null, Annotations.EMPTY, Name.special("<script-code>"), Kind.DECLARATION);
|
super(containingDeclaration, null, Annotations.EMPTY, Name.special("<script-code>"), Kind.DECLARATION, SourceElement.NO_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(
|
public void initialize(
|
||||||
|
|||||||
+10
-5
@@ -37,8 +37,10 @@ public class SimpleFunctionDescriptorImpl extends FunctionDescriptorImpl impleme
|
|||||||
@Nullable SimpleFunctionDescriptor original,
|
@Nullable SimpleFunctionDescriptor original,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Kind kind) {
|
@NotNull Kind kind,
|
||||||
super(containingDeclaration, original, annotations, name, kind);
|
@NotNull SourceElement source
|
||||||
|
) {
|
||||||
|
super(containingDeclaration, original, annotations, name, kind, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -46,9 +48,10 @@ public class SimpleFunctionDescriptorImpl extends FunctionDescriptorImpl impleme
|
|||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull Kind kind
|
@NotNull Kind kind,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
return new SimpleFunctionDescriptorImpl(containingDeclaration, null, annotations, name, kind);
|
return new SimpleFunctionDescriptorImpl(containingDeclaration, null, annotations, name, kind, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -88,7 +91,9 @@ public class SimpleFunctionDescriptorImpl extends FunctionDescriptorImpl impleme
|
|||||||
// TODO : safeSubstitute
|
// TODO : safeSubstitute
|
||||||
getAnnotations(),
|
getAnnotations(),
|
||||||
getName(),
|
getName(),
|
||||||
kind);
|
kind,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+9
-5
@@ -19,6 +19,7 @@ package org.jetbrains.jet.lang.descriptors.impl;
|
|||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
@@ -42,7 +43,8 @@ public class TypeParameterDescriptorImpl extends AbstractTypeParameterDescriptor
|
|||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
int index
|
int index
|
||||||
) {
|
) {
|
||||||
TypeParameterDescriptorImpl typeParameterDescriptor = createForFurtherModification(containingDeclaration, annotations, reified, variance, name, index);
|
TypeParameterDescriptorImpl typeParameterDescriptor =
|
||||||
|
createForFurtherModification(containingDeclaration, annotations, reified, variance, name, index, SourceElement.NO_SOURCE);
|
||||||
typeParameterDescriptor.addUpperBound(KotlinBuiltIns.getInstance().getDefaultBound());
|
typeParameterDescriptor.addUpperBound(KotlinBuiltIns.getInstance().getDefaultBound());
|
||||||
typeParameterDescriptor.setInitialized();
|
typeParameterDescriptor.setInitialized();
|
||||||
return typeParameterDescriptor;
|
return typeParameterDescriptor;
|
||||||
@@ -54,9 +56,10 @@ public class TypeParameterDescriptorImpl extends AbstractTypeParameterDescriptor
|
|||||||
boolean reified,
|
boolean reified,
|
||||||
@NotNull Variance variance,
|
@NotNull Variance variance,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
int index
|
int index,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
return new TypeParameterDescriptorImpl(containingDeclaration, annotations, reified, variance, name, index);
|
return new TypeParameterDescriptorImpl(containingDeclaration, annotations, reified, variance, name, index, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Set<JetType> upperBounds = Sets.newLinkedHashSet();
|
private final Set<JetType> upperBounds = Sets.newLinkedHashSet();
|
||||||
@@ -68,9 +71,10 @@ public class TypeParameterDescriptorImpl extends AbstractTypeParameterDescriptor
|
|||||||
boolean reified,
|
boolean reified,
|
||||||
@NotNull Variance variance,
|
@NotNull Variance variance,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
int index
|
int index,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, annotations, name, variance, reified, index);
|
super(LockBasedStorageManager.NO_LOCKS, containingDeclaration, annotations, name, variance, reified, index, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+4
-3
@@ -48,9 +48,10 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
|||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@NotNull JetType outType,
|
@NotNull JetType outType,
|
||||||
boolean declaresDefaultValue,
|
boolean declaresDefaultValue,
|
||||||
@Nullable JetType varargElementType
|
@Nullable JetType varargElementType,
|
||||||
|
@NotNull SourceElement source
|
||||||
) {
|
) {
|
||||||
super(containingDeclaration, annotations, name, outType);
|
super(containingDeclaration, annotations, name, outType, source);
|
||||||
this.original = original == null ? this : original;
|
this.original = original == null ? this : original;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.declaresDefaultValue = declaresDefaultValue;
|
this.declaresDefaultValue = declaresDefaultValue;
|
||||||
@@ -125,7 +126,7 @@ public class ValueParameterDescriptorImpl extends VariableDescriptorImpl impleme
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public ValueParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner, @NotNull Name newName) {
|
public ValueParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner, @NotNull Name newName) {
|
||||||
return new ValueParameterDescriptorImpl(newOwner, null, index, getAnnotations(), newName, getType(), declaresDefaultValue(), varargElementType);
|
return new ValueParameterDescriptorImpl(newOwner, null, index, getAnnotations(), newName, getType(), declaresDefaultValue(), varargElementType, SourceElement.NO_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+4
-2
@@ -37,8 +37,10 @@ public abstract class VariableDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
@NotNull DeclarationDescriptor containingDeclaration,
|
@NotNull DeclarationDescriptor containingDeclaration,
|
||||||
@NotNull Annotations annotations,
|
@NotNull Annotations annotations,
|
||||||
@NotNull Name name,
|
@NotNull Name name,
|
||||||
@Nullable JetType outType) {
|
@Nullable JetType outType,
|
||||||
super(containingDeclaration, annotations, name);
|
@NotNull SourceElement source
|
||||||
|
) {
|
||||||
|
super(containingDeclaration, annotations, name, source);
|
||||||
|
|
||||||
this.outType = outType;
|
this.outType = outType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getDefaultConstruct
|
|||||||
|
|
||||||
public class DescriptorFactory {
|
public class DescriptorFactory {
|
||||||
private static class DefaultConstructorDescriptor extends ConstructorDescriptorImpl {
|
private static class DefaultConstructorDescriptor extends ConstructorDescriptorImpl {
|
||||||
public DefaultConstructorDescriptor(@NotNull ClassDescriptor containingClass) {
|
public DefaultConstructorDescriptor(@NotNull ClassDescriptor containingClass, @NotNull SourceElement source) {
|
||||||
super(containingClass, null, Annotations.EMPTY, true, Kind.DECLARATION);
|
super(containingClass, null, Annotations.EMPTY, true, Kind.DECLARATION, source);
|
||||||
initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
|
initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
|
||||||
getDefaultConstructorVisibility(containingClass), true);
|
getDefaultConstructorVisibility(containingClass), true);
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public class DescriptorFactory {
|
|||||||
PropertySetterDescriptorImpl setterDescriptor =
|
PropertySetterDescriptorImpl setterDescriptor =
|
||||||
new PropertySetterDescriptorImpl(propertyDescriptor, Annotations.EMPTY, propertyDescriptor.getModality(),
|
new PropertySetterDescriptorImpl(propertyDescriptor, Annotations.EMPTY, propertyDescriptor.getModality(),
|
||||||
propertyDescriptor.getVisibility(), !isDefault, isDefault,
|
propertyDescriptor.getVisibility(), !isDefault, isDefault,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION, null);
|
CallableMemberDescriptor.Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||||
setterDescriptor.initializeDefault();
|
setterDescriptor.initializeDefault();
|
||||||
return setterDescriptor;
|
return setterDescriptor;
|
||||||
}
|
}
|
||||||
@@ -68,12 +68,15 @@ public class DescriptorFactory {
|
|||||||
public static PropertyGetterDescriptorImpl createGetter(@NotNull PropertyDescriptor propertyDescriptor, boolean isDefault) {
|
public static PropertyGetterDescriptorImpl createGetter(@NotNull PropertyDescriptor propertyDescriptor, boolean isDefault) {
|
||||||
return new PropertyGetterDescriptorImpl(propertyDescriptor, Annotations.EMPTY, propertyDescriptor.getModality(),
|
return new PropertyGetterDescriptorImpl(propertyDescriptor, Annotations.EMPTY, propertyDescriptor.getModality(),
|
||||||
propertyDescriptor.getVisibility(), !isDefault, isDefault,
|
propertyDescriptor.getVisibility(), !isDefault, isDefault,
|
||||||
CallableMemberDescriptor.Kind.DECLARATION, null);
|
CallableMemberDescriptor.Kind.DECLARATION, null, SourceElement.NO_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static ConstructorDescriptorImpl createPrimaryConstructorForObject(@NotNull ClassDescriptor containingClass) {
|
public static ConstructorDescriptorImpl createPrimaryConstructorForObject(
|
||||||
return new DefaultConstructorDescriptor(containingClass);
|
@NotNull ClassDescriptor containingClass,
|
||||||
|
@NotNull SourceElement source
|
||||||
|
) {
|
||||||
|
return new DefaultConstructorDescriptor(containingClass, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDefaultPrimaryConstructor(@NotNull ConstructorDescriptor constructor) {
|
public static boolean isDefaultPrimaryConstructor(@NotNull ConstructorDescriptor constructor) {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.types;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||||
|
|
||||||
@@ -66,7 +67,8 @@ public class DescriptorSubstitutor {
|
|||||||
descriptor.isReified(),
|
descriptor.isReified(),
|
||||||
descriptor.getVariance(),
|
descriptor.getVariance(),
|
||||||
descriptor.getName(),
|
descriptor.getName(),
|
||||||
descriptor.getIndex()
|
descriptor.getIndex(),
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
substituted.setInitialized();
|
substituted.setInitialized();
|
||||||
|
|
||||||
|
|||||||
@@ -229,9 +229,9 @@ public class ErrorUtils {
|
|||||||
private static class ErrorClassDescriptor extends ClassDescriptorImpl {
|
private static class ErrorClassDescriptor extends ClassDescriptorImpl {
|
||||||
public ErrorClassDescriptor(@Nullable String name) {
|
public ErrorClassDescriptor(@Nullable String name) {
|
||||||
super(getErrorModule(), Name.special(name == null ? "<ERROR CLASS>" : "<ERROR CLASS: " + name + ">"),
|
super(getErrorModule(), Name.special(name == null ? "<ERROR CLASS>" : "<ERROR CLASS: " + name + ">"),
|
||||||
Modality.OPEN, Collections.<JetType>emptyList());
|
Modality.OPEN, Collections.<JetType>emptyList(), SourceElement.NO_SOURCE);
|
||||||
|
|
||||||
ConstructorDescriptorImpl errorConstructor = ConstructorDescriptorImpl.create(this, Annotations.EMPTY, true);
|
ConstructorDescriptorImpl errorConstructor = ConstructorDescriptorImpl.create(this, Annotations.EMPTY, true, SourceElement.NO_SOURCE);
|
||||||
errorConstructor.initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
|
errorConstructor.initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
|
||||||
Visibilities.INTERNAL, false);
|
Visibilities.INTERNAL, false);
|
||||||
JetScope memberScope = createErrorScope(getName().asString());
|
JetScope memberScope = createErrorScope(getName().asString());
|
||||||
@@ -300,7 +300,8 @@ public class ErrorUtils {
|
|||||||
Visibilities.INTERNAL,
|
Visibilities.INTERNAL,
|
||||||
true,
|
true,
|
||||||
Name.special("<ERROR PROPERTY>"),
|
Name.special("<ERROR PROPERTY>"),
|
||||||
CallableMemberDescriptor.Kind.DECLARATION
|
CallableMemberDescriptor.Kind.DECLARATION,
|
||||||
|
SourceElement.NO_SOURCE
|
||||||
);
|
);
|
||||||
descriptor.setType(ERROR_PROPERTY_TYPE,
|
descriptor.setType(ERROR_PROPERTY_TYPE,
|
||||||
Collections.<TypeParameterDescriptor>emptyList(),
|
Collections.<TypeParameterDescriptor>emptyList(),
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ public class ErrorSimpleFunctionDescriptorImpl extends SimpleFunctionDescriptorI
|
|||||||
private final ErrorUtils.ErrorScope ownerScope;
|
private final ErrorUtils.ErrorScope ownerScope;
|
||||||
|
|
||||||
public ErrorSimpleFunctionDescriptorImpl(@NotNull ClassDescriptor containingDeclaration, @NotNull ErrorUtils.ErrorScope ownerScope) {
|
public ErrorSimpleFunctionDescriptorImpl(@NotNull ClassDescriptor containingDeclaration, @NotNull ErrorUtils.ErrorScope ownerScope) {
|
||||||
super(containingDeclaration, null, Annotations.EMPTY, Name.special("<ERROR FUNCTION>"), Kind.DECLARATION);
|
super(containingDeclaration, null, Annotations.EMPTY, Name.special("<ERROR FUNCTION>"), Kind.DECLARATION, SourceElement.NO_SOURCE);
|
||||||
this.ownerScope = ownerScope;
|
this.ownerScope = ownerScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -766,7 +766,7 @@ public class KotlinBuiltIns {
|
|||||||
TypeProjection parameterType = parameterTypes.get(i);
|
TypeProjection parameterType = parameterTypes.get(i);
|
||||||
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
ValueParameterDescriptorImpl valueParameterDescriptor = new ValueParameterDescriptorImpl(
|
||||||
functionDescriptor, null, i, Annotations.EMPTY,
|
functionDescriptor, null, i, Annotations.EMPTY,
|
||||||
Name.identifier("p" + (i + 1)), parameterType.getType(), false, null);
|
Name.identifier("p" + (i + 1)), parameterType.getType(), false, null, SourceElement.NO_SOURCE);
|
||||||
valueParameters.add(valueParameterDescriptor);
|
valueParameters.add(valueParameterDescriptor);
|
||||||
}
|
}
|
||||||
return valueParameters;
|
return valueParameters;
|
||||||
|
|||||||
+5
-4
@@ -100,7 +100,7 @@ public class MemberDeserializer {
|
|||||||
modality(Flags.MODALITY.get(getterFlags)),
|
modality(Flags.MODALITY.get(getterFlags)),
|
||||||
visibility(Flags.VISIBILITY.get(getterFlags)),
|
visibility(Flags.VISIBILITY.get(getterFlags)),
|
||||||
isNotDefault, !isNotDefault,
|
isNotDefault, !isNotDefault,
|
||||||
property.getKind(), null);
|
property.getKind(), null, SourceElement.NO_SOURCE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
getter = DescriptorFactory.createDefaultGetter(property);
|
getter = DescriptorFactory.createDefaultGetter(property);
|
||||||
@@ -117,7 +117,7 @@ public class MemberDeserializer {
|
|||||||
modality(Flags.MODALITY.get(setterFlags)),
|
modality(Flags.MODALITY.get(setterFlags)),
|
||||||
visibility(Flags.VISIBILITY.get(setterFlags)), isNotDefault,
|
visibility(Flags.VISIBILITY.get(setterFlags)), isNotDefault,
|
||||||
!isNotDefault,
|
!isNotDefault,
|
||||||
property.getKind(), null);
|
property.getKind(), null, SourceElement.NO_SOURCE);
|
||||||
DeserializationContextWithTypes setterLocal = local.childContext(setter, Collections.<TypeParameter>emptyList(),
|
DeserializationContextWithTypes setterLocal = local.childContext(setter, Collections.<TypeParameter>emptyList(),
|
||||||
Collections.<TypeParameterDescriptor>emptyList());
|
Collections.<TypeParameterDescriptor>emptyList());
|
||||||
List<ValueParameterDescriptor> valueParameters
|
List<ValueParameterDescriptor> valueParameters
|
||||||
@@ -186,7 +186,7 @@ public class MemberDeserializer {
|
|||||||
classDescriptor,
|
classDescriptor,
|
||||||
getAnnotations(proto, proto.getFlags(), AnnotatedCallableKind.FUNCTION),
|
getAnnotations(proto, proto.getFlags(), AnnotatedCallableKind.FUNCTION),
|
||||||
// TODO: primary
|
// TODO: primary
|
||||||
true);
|
true, SourceElement.NO_SOURCE);
|
||||||
List<TypeParameterDescriptor> typeParameters = new ArrayList<TypeParameterDescriptor>(proto.getTypeParameterCount());
|
List<TypeParameterDescriptor> typeParameters = new ArrayList<TypeParameterDescriptor>(proto.getTypeParameterCount());
|
||||||
DeserializationContextWithTypes local = context.childContext(descriptor, Collections.<TypeParameter>emptyList(), typeParameters);
|
DeserializationContextWithTypes local = context.childContext(descriptor, Collections.<TypeParameter>emptyList(), typeParameters);
|
||||||
descriptor.initialize(
|
descriptor.initialize(
|
||||||
@@ -260,7 +260,8 @@ public class MemberDeserializer {
|
|||||||
context.getNameResolver().getName(proto.getName()),
|
context.getNameResolver().getName(proto.getName()),
|
||||||
context.getTypeDeserializer().type(proto.getType()),
|
context.getTypeDeserializer().type(proto.getType()),
|
||||||
Flags.DECLARES_DEFAULT_VALUE.get(proto.getFlags()),
|
Flags.DECLARES_DEFAULT_VALUE.get(proto.getFlags()),
|
||||||
context.getTypeDeserializer().typeOrNull(proto.hasVarargElementType() ? proto.getVarargElementType() : null))
|
context.getTypeDeserializer().typeOrNull(proto.hasVarargElementType() ? proto.getVarargElementType() : null),
|
||||||
|
SourceElement.NO_SOURCE)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
+8
-2
@@ -200,7 +200,7 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
|
|||||||
|
|
||||||
ProtoBuf.Class.PrimaryConstructor constructorProto = classProto.getPrimaryConstructor();
|
ProtoBuf.Class.PrimaryConstructor constructorProto = classProto.getPrimaryConstructor();
|
||||||
if (!constructorProto.hasData()) {
|
if (!constructorProto.hasData()) {
|
||||||
ConstructorDescriptorImpl descriptor = DescriptorFactory.createPrimaryConstructorForObject(this);
|
ConstructorDescriptorImpl descriptor = DescriptorFactory.createPrimaryConstructorForObject(this, SourceElement.NO_SOURCE);
|
||||||
descriptor.setReturnType(getDefaultType());
|
descriptor.setReturnType(getDefaultType());
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
@@ -267,6 +267,12 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
|
|||||||
return "deserialized class " + getName().toString();
|
return "deserialized class " + getName().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public SourceElement getSource() {
|
||||||
|
return SourceElement.NO_SOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
private class DeserializedClassTypeConstructor extends AbstractClassTypeConstructor {
|
private class DeserializedClassTypeConstructor extends AbstractClassTypeConstructor {
|
||||||
private final Collection<JetType> supertypes = computeSuperTypes();
|
private final Collection<JetType> supertypes = computeSuperTypes();
|
||||||
private final List<TypeParameterDescriptor> parameters;
|
private final List<TypeParameterDescriptor> parameters;
|
||||||
@@ -441,7 +447,7 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme
|
|||||||
public ClassDescriptor invoke(Name name) {
|
public ClassDescriptor invoke(Name name) {
|
||||||
if (enumEntryNames.contains(name)) {
|
if (enumEntryNames.contains(name)) {
|
||||||
return EnumEntrySyntheticClassDescriptor
|
return EnumEntrySyntheticClassDescriptor
|
||||||
.create(storageManager, DeserializedClassDescriptor.this, name, enumMemberNames);
|
.create(storageManager, DeserializedClassDescriptor.this, name, enumMemberNames, SourceElement.NO_SOURCE);
|
||||||
}
|
}
|
||||||
if (nestedClassNames.contains(name)) {
|
if (nestedClassNames.contains(name)) {
|
||||||
return ContextPackage.deserializeClass(context, classId.createNestedClassId(name));
|
return ContextPackage.deserializeClass(context, classId.createNestedClassId(name));
|
||||||
|
|||||||
+2
-1
@@ -26,6 +26,7 @@ import org.jetbrains.jet.descriptors.serialization.NameResolver
|
|||||||
import org.jetbrains.jet.lang.descriptors.impl.PropertyDescriptorImpl
|
import org.jetbrains.jet.lang.descriptors.impl.PropertyDescriptorImpl
|
||||||
import org.jetbrains.jet.descriptors.serialization.ProtoBuf
|
import org.jetbrains.jet.descriptors.serialization.ProtoBuf
|
||||||
import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor.Kind
|
import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor.Kind
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement
|
||||||
|
|
||||||
public class DeserializedPropertyDescriptor(
|
public class DeserializedPropertyDescriptor(
|
||||||
containingDeclaration: DeclarationDescriptor,
|
containingDeclaration: DeclarationDescriptor,
|
||||||
@@ -39,7 +40,7 @@ public class DeserializedPropertyDescriptor(
|
|||||||
override public val proto: ProtoBuf.Callable,
|
override public val proto: ProtoBuf.Callable,
|
||||||
override public val nameResolver: NameResolver
|
override public val nameResolver: NameResolver
|
||||||
) : DeserializedCallableMemberDescriptor,
|
) : DeserializedCallableMemberDescriptor,
|
||||||
PropertyDescriptorImpl(containingDeclaration, original, annotations, modality, visibility, isVar, name, kind) {
|
PropertyDescriptorImpl(containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE) {
|
||||||
|
|
||||||
override fun createSubstitutedCopy(
|
override fun createSubstitutedCopy(
|
||||||
newOwner: DeclarationDescriptor,
|
newOwner: DeclarationDescriptor,
|
||||||
|
|||||||
+2
-1
@@ -22,6 +22,7 @@ import org.jetbrains.jet.descriptors.serialization.*;
|
|||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.FunctionDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.FunctionDescriptorImpl;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.SimpleFunctionDescriptorImpl;
|
||||||
@@ -40,7 +41,7 @@ public class DeserializedSimpleFunctionDescriptor extends SimpleFunctionDescript
|
|||||||
@NotNull Kind kind,
|
@NotNull Kind kind,
|
||||||
@NotNull ProtoBuf.Callable proto,
|
@NotNull ProtoBuf.Callable proto,
|
||||||
@NotNull NameResolver nameResolver) {
|
@NotNull NameResolver nameResolver) {
|
||||||
super(containingDeclaration, original, annotations, name, kind);
|
super(containingDeclaration, original, annotations, name, kind, SourceElement.NO_SOURCE);
|
||||||
this.proto = proto;
|
this.proto = proto;
|
||||||
this.nameResolver = nameResolver;
|
this.nameResolver = nameResolver;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -20,12 +20,13 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.jet.descriptors.serialization.ProtoBuf;
|
import org.jetbrains.jet.descriptors.serialization.ProtoBuf;
|
||||||
import org.jetbrains.jet.descriptors.serialization.TypeDeserializer;
|
import org.jetbrains.jet.descriptors.serialization.TypeDeserializer;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.SourceElement;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.AbstractLazyTypeParameterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.impl.AbstractLazyTypeParameterDescriptor;
|
||||||
import org.jetbrains.jet.storage.StorageManager;
|
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.jetbrains.jet.lang.types.Variance;
|
import org.jetbrains.jet.lang.types.Variance;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
|
import org.jetbrains.jet.storage.StorageManager;
|
||||||
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -45,7 +46,7 @@ public class DeserializedTypeParameterDescriptor extends AbstractLazyTypeParamet
|
|||||||
boolean isReified,
|
boolean isReified,
|
||||||
int index
|
int index
|
||||||
) {
|
) {
|
||||||
super(storageManager, containingDeclaration, name, variance, isReified, index);
|
super(storageManager, containingDeclaration, name, variance, isReified, index, SourceElement.NO_SOURCE);
|
||||||
this.proto = proto;
|
this.proto = proto;
|
||||||
this.typeDeserializer = typeDeserializer;
|
this.typeDeserializer = typeDeserializer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ private fun generatorForTopDownAnalyzerForJvm() =
|
|||||||
javaClass<PsiBasedMethodSignatureChecker>(),
|
javaClass<PsiBasedMethodSignatureChecker>(),
|
||||||
javaClass<PsiBasedExternalAnnotationResolver>(),
|
javaClass<PsiBasedExternalAnnotationResolver>(),
|
||||||
javaClass<MutablePackageFragmentProvider>(),
|
javaClass<MutablePackageFragmentProvider>(),
|
||||||
javaClass<JavaPropertyInitializerEvaluatorImpl>()
|
javaClass<JavaPropertyInitializerEvaluatorImpl>(),
|
||||||
|
javaClass<JavaSourceElementFactoryImpl>()
|
||||||
)
|
)
|
||||||
field(javaClass<VirtualFileFinder>(), init = GivenExpression(javaClass<VirtualFileFinder>().getName() + ".SERVICE.getInstance(project)"))
|
field(javaClass<VirtualFileFinder>(), init = GivenExpression(javaClass<VirtualFileFinder>().getName() + ".SERVICE.getInstance(project)"))
|
||||||
}
|
}
|
||||||
@@ -128,7 +129,8 @@ private fun generatorForJavaDescriptorResolver() =
|
|||||||
javaClass<TraceBasedErrorReporter>(),
|
javaClass<TraceBasedErrorReporter>(),
|
||||||
javaClass<PsiBasedMethodSignatureChecker>(),
|
javaClass<PsiBasedMethodSignatureChecker>(),
|
||||||
javaClass<PsiBasedExternalAnnotationResolver>(),
|
javaClass<PsiBasedExternalAnnotationResolver>(),
|
||||||
javaClass<JavaPropertyInitializerEvaluatorImpl>()
|
javaClass<JavaPropertyInitializerEvaluatorImpl>(),
|
||||||
|
javaClass<JavaSourceElementFactoryImpl>()
|
||||||
)
|
)
|
||||||
field(javaClass<VirtualFileFinder>(),
|
field(javaClass<VirtualFileFinder>(),
|
||||||
init = GivenExpression(javaClass<VirtualFileFinder>().getName() + ".SERVICE.getInstance(project)"))
|
init = GivenExpression(javaClass<VirtualFileFinder>().getName() + ".SERVICE.getInstance(project)"))
|
||||||
@@ -159,7 +161,8 @@ private fun generatorForLazyResolveWithJava() =
|
|||||||
javaClass<TraceBasedErrorReporter>(),
|
javaClass<TraceBasedErrorReporter>(),
|
||||||
javaClass<PsiBasedMethodSignatureChecker>(),
|
javaClass<PsiBasedMethodSignatureChecker>(),
|
||||||
javaClass<PsiBasedExternalAnnotationResolver>(),
|
javaClass<PsiBasedExternalAnnotationResolver>(),
|
||||||
javaClass<JavaPropertyInitializerEvaluatorImpl>()
|
javaClass<JavaPropertyInitializerEvaluatorImpl>(),
|
||||||
|
javaClass<JavaSourceElementFactoryImpl>()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ private class PackageFragmentProviderForMissingDependencies(val moduleDescriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class MissingDependencyErrorClassDescriptor(containing: DeclarationDescriptor, override val fullFqName: FqName)
|
private class MissingDependencyErrorClassDescriptor(containing: DeclarationDescriptor, override val fullFqName: FqName)
|
||||||
: MissingDependencyErrorClass, ClassDescriptorImpl(containing, fullFqName.shortName(), Modality.OPEN, listOf()) {
|
: MissingDependencyErrorClass, ClassDescriptorImpl(containing, fullFqName.shortName(), Modality.OPEN, listOf(), SourceElement.NO_SOURCE) {
|
||||||
|
|
||||||
private val scope = ScopeWithMissingDependencies(fullFqName, this)
|
private val scope = ScopeWithMissingDependencies(fullFqName, this)
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ private class MissingDependencyErrorClassDescriptor(containing: DeclarationDescr
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
val emptyConstructor = ConstructorDescriptorImpl.create(this, Annotations.EMPTY, true)
|
val emptyConstructor = ConstructorDescriptorImpl.create(this, Annotations.EMPTY, true, SourceElement.NO_SOURCE)
|
||||||
emptyConstructor.initialize(listOf(), listOf(), Visibilities.INTERNAL, false)
|
emptyConstructor.initialize(listOf(), listOf(), Visibilities.INTERNAL, false)
|
||||||
emptyConstructor.setReturnType(createErrorType("<ERROR RETURN TYPE>"))
|
emptyConstructor.setReturnType(createErrorType("<ERROR RETURN TYPE>"))
|
||||||
initialize(JetScope.EMPTY, setOf(emptyConstructor), emptyConstructor)
|
initialize(JetScope.EMPTY, setOf(emptyConstructor), emptyConstructor)
|
||||||
|
|||||||
@@ -166,4 +166,4 @@ public abstract class JetMultiReference<T : JetElement>(expression: T) : Abstrac
|
|||||||
}
|
}
|
||||||
return multiResolve(false).map { it.getElement() }.filterNotNull().any { checkElementMatch(it, element) }
|
return multiResolve(false).map { it.getElement() }.filterNotNull().any { checkElementMatch(it, element) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user