Merge declarationsByLabel in chained scopes
This commit is contained in:
@@ -25,10 +25,7 @@ import org.jetbrains.jet.lang.resolve.name.LabelName;
|
|||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.utils.Printer;
|
import org.jetbrains.jet.utils.Printer;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.jetbrains.jet.lang.resolve.scopes.JetScopeSelectorUtil.*;
|
import static org.jetbrains.jet.lang.resolve.scopes.JetScopeSelectorUtil.*;
|
||||||
|
|
||||||
@@ -94,11 +91,12 @@ public class ChainedScope implements JetScope {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||||
|
ArrayList<DeclarationDescriptor> result = new ArrayList<DeclarationDescriptor>();
|
||||||
for (JetScope jetScope : scopeChain) {
|
for (JetScope jetScope : scopeChain) {
|
||||||
Collection<DeclarationDescriptor> declarationsByLabel = jetScope.getDeclarationsByLabel(labelName);
|
result.addAll(jetScope.getDeclarationsByLabel(labelName));
|
||||||
if (!declarationsByLabel.isEmpty()) return declarationsByLabel; // TODO : merge?
|
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
result.trimToSize();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in New Issue
Block a user