Basic completion within secondary constructors

body and delegation call
This commit is contained in:
Denis Zharkov
2015-02-13 13:05:20 +03:00
parent 7d963e8e07
commit 50c8c6f68b
9 changed files with 130 additions and 8 deletions
@@ -125,7 +125,9 @@ public class BodyResolver {
private void resolveSecondaryConstructors(@NotNull BodiesResolveContext c) {
for (Map.Entry<JetSecondaryConstructor, ConstructorDescriptor> entry : c.getSecondaryConstructors().entrySet()) {
resolveSecondaryConstructorBody(c, entry.getKey(), entry.getValue());
JetScope declaringScope = c.getDeclaringScopes().apply(entry.getKey());
assert declaringScope != null : "Declaring scope should be registered before body resolve";
resolveSecondaryConstructorBody(c, trace, entry.getKey(), entry.getValue(), declaringScope);
}
if (c.getSecondaryConstructors().isEmpty()) return;
Set<ConstructorDescriptor> visitedConstructors = Sets.newHashSet();
@@ -134,14 +136,13 @@ public class BodyResolver {
}
}
private void resolveSecondaryConstructorBody(
public void resolveSecondaryConstructorBody(
@NotNull final BodiesResolveContext c,
@NotNull final BindingTrace trace,
@NotNull final JetSecondaryConstructor constructor,
@NotNull final ConstructorDescriptor descriptor
@NotNull final ConstructorDescriptor descriptor,
@NotNull JetScope bodyDeclaringScope
) {
JetScope bodyDeclaringScope = c.getDeclaringScopes().apply(constructor);
assert bodyDeclaringScope != null : "Declaring scope should be registered before body resolve";
assert descriptor.getContainingDeclaration() instanceof ClassDescriptorWithResolutionScopes
: "When resolving body it should be class descriptor with resolution scopes";
@@ -152,7 +153,7 @@ public class BodyResolver {
new Function1<JetScope, Void>() {
@Override
public Void invoke(@NotNull JetScope headerInnerScope) {
resolveSecondaryConstructorDelegationCall(c, headerInnerScope, constructor, descriptor);
resolveSecondaryConstructorDelegationCall(c, trace, headerInnerScope, constructor, descriptor);
return null;
}
});
@@ -160,6 +161,7 @@ public class BodyResolver {
private void resolveSecondaryConstructorDelegationCall(
@NotNull BodiesResolveContext c,
@NotNull BindingTrace trace,
@NotNull JetScope scope,
@NotNull JetSecondaryConstructor constructor,
@NotNull ConstructorDescriptor descriptor