Removed LabelName class, used Name instead
This commit is contained in:
@@ -29,7 +29,6 @@ import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetImportDirective;
|
||||
import org.jetbrains.jet.lang.psi.JetImportList;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.*;
|
||||
import org.jetbrains.jet.storage.MemoizedFunctionToNotNull;
|
||||
@@ -311,7 +310,7 @@ public class LazyImportScope implements JetScope, LazyEntity {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -33,7 +33,6 @@ import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.data.JetClassLikeInfo;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.data.JetScriptInfo;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.declarations.DeclarationProvider;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.storage.MemoizedFunctionToNotNull;
|
||||
@@ -209,7 +208,7 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
// A member scope has no labels
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
|
||||
@@ -47,7 +46,7 @@ public class WriteThroughScope extends WritableScopeWithImports {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
checkMayRead();
|
||||
|
||||
return writableWorker.getDeclarationsByLabel(labelName);
|
||||
|
||||
+2
-3
@@ -53,7 +53,6 @@ import org.jetbrains.jet.lang.resolve.calls.util.CallMaker;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstantChecker;
|
||||
import org.jetbrains.jet.lang.resolve.constants.IntegerValueTypeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl;
|
||||
@@ -378,7 +377,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
String labelName = expression.getLabelName();
|
||||
if (labelName != null) {
|
||||
LabelResolver.LabeledReceiverResolutionResult resolutionResult = context.labelResolver.resolveThisLabel(
|
||||
expression.getInstanceReference(), expression.getTargetLabel(), context, new LabelName(labelName));
|
||||
expression.getInstanceReference(), expression.getTargetLabel(), context, Name.identifierForLabel(labelName));
|
||||
if (onlyClassReceivers && resolutionResult.success()) {
|
||||
if (!isDeclaredInClass(resolutionResult.getReceiverParameterDescriptor())) {
|
||||
return LabelResolver.LabeledReceiverResolutionResult.labelResolutionSuccess(NO_RECEIVER_PARAMETER);
|
||||
@@ -750,7 +749,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
assert JetTokens.LABELS.contains(operationSign.getReferencedNameElementType());
|
||||
|
||||
String referencedName = operationSign.getReferencedName();
|
||||
context.labelResolver.enterLabeledElement(new LabelName(referencedName.substring(1)), baseExpression);
|
||||
context.labelResolver.enterLabeledElement(Name.identifierForLabel(referencedName.substring(1)), baseExpression);
|
||||
// TODO : Some processing for the label?
|
||||
JetTypeInfo typeInfo = facade.getTypeInfo(baseExpression, context, isStatement);
|
||||
context.labelResolver.exitLabeledElement(baseExpression);
|
||||
|
||||
+1
-2
@@ -28,7 +28,6 @@ import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
@@ -106,7 +105,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
|
||||
Name callerName = getCallerName(expression);
|
||||
if (callerName != null) {
|
||||
context.labelResolver.enterLabeledElement(new LabelName(callerName.asString()), expression);
|
||||
context.labelResolver.enterLabeledElement(callerName, expression);
|
||||
}
|
||||
|
||||
JetType expectedType = context.expectedType;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorResolver;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -44,11 +44,11 @@ public class LabelResolver {
|
||||
return new LabelResolver();
|
||||
}
|
||||
|
||||
private final Map<LabelName, Stack<JetElement>> labeledElements = new HashMap<LabelName, Stack<JetElement>>();
|
||||
private final Map<Name, Stack<JetElement>> labeledElements = new HashMap<Name, Stack<JetElement>>();
|
||||
|
||||
private LabelResolver() {}
|
||||
|
||||
public void enterLabeledElement(@NotNull LabelName labelName, @NotNull JetExpression labeledExpression) {
|
||||
public void enterLabeledElement(@NotNull Name labelName, @NotNull JetExpression labeledExpression) {
|
||||
JetExpression cacheExpression = getCachingExpression(labeledExpression);
|
||||
if (cacheExpression != null) {
|
||||
Stack<JetElement> stack = labeledElements.get(labelName);
|
||||
@@ -64,8 +64,8 @@ public class LabelResolver {
|
||||
JetExpression cacheExpression = getCachingExpression(expression);
|
||||
|
||||
// TODO : really suboptimal
|
||||
for (Iterator<Map.Entry<LabelName,Stack<JetElement>>> mapIter = labeledElements.entrySet().iterator(); mapIter.hasNext(); ) {
|
||||
Map.Entry<LabelName, Stack<JetElement>> entry = mapIter.next();
|
||||
for (Iterator<Map.Entry<Name,Stack<JetElement>>> mapIter = labeledElements.entrySet().iterator(); mapIter.hasNext(); ) {
|
||||
Map.Entry<Name, Stack<JetElement>> entry = mapIter.next();
|
||||
Stack<JetElement> stack = entry.getValue();
|
||||
for (Iterator<JetElement> stackIter = stack.iterator(); stackIter.hasNext(); ) {
|
||||
JetElement recorded = stackIter.next();
|
||||
@@ -89,7 +89,7 @@ public class LabelResolver {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private JetElement resolveControlLabel(@NotNull LabelName labelName, @NotNull JetSimpleNameExpression labelExpression, boolean reportUnresolved, ExpressionTypingContext context) {
|
||||
private JetElement resolveControlLabel(@NotNull Name labelName, @NotNull JetSimpleNameExpression labelExpression, boolean reportUnresolved, ExpressionTypingContext context) {
|
||||
Collection<DeclarationDescriptor> declarationsByLabel = context.scope.getDeclarationsByLabel(labelName);
|
||||
int size = declarationsByLabel.size();
|
||||
|
||||
@@ -116,13 +116,13 @@ public class LabelResolver {
|
||||
public JetElement resolveLabel(JetLabelQualifiedExpression expression, ExpressionTypingContext context) {
|
||||
JetSimpleNameExpression labelElement = expression.getTargetLabel();
|
||||
if (labelElement != null) {
|
||||
LabelName labelName = new LabelName(expression.getLabelName());
|
||||
Name labelName = Name.identifierForLabel(expression.getLabelName());
|
||||
return resolveControlLabel(labelName, labelElement, true, context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private JetElement resolveNamedLabel(@NotNull LabelName labelName, @NotNull JetSimpleNameExpression labelExpression, boolean reportUnresolved, ExpressionTypingContext context) {
|
||||
private JetElement resolveNamedLabel(@NotNull Name labelName, @NotNull JetSimpleNameExpression labelExpression, boolean reportUnresolved, ExpressionTypingContext context) {
|
||||
Stack<JetElement> stack = labeledElements.get(labelName);
|
||||
if (stack == null || stack.isEmpty()) {
|
||||
if (reportUnresolved) {
|
||||
@@ -140,7 +140,7 @@ public class LabelResolver {
|
||||
}
|
||||
|
||||
public LabeledReceiverResolutionResult resolveThisLabel(JetReferenceExpression thisReference, JetSimpleNameExpression targetLabel,
|
||||
ExpressionTypingContext context, LabelName labelName) {
|
||||
ExpressionTypingContext context, Name labelName) {
|
||||
Collection<DeclarationDescriptor> declarationsByLabel = context.scope.getDeclarationsByLabel(labelName);
|
||||
int size = declarationsByLabel.size();
|
||||
assert targetLabel != null;
|
||||
|
||||
+1
-2
@@ -18,7 +18,6 @@ package org.jetbrains.jet.lang.resolve.java.lazy.descriptors
|
||||
|
||||
import org.jetbrains.jet.lang.descriptors.*
|
||||
import org.jetbrains.jet.storage.NotNullLazyValue
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName
|
||||
import org.jetbrains.jet.lang.resolve.name.Name
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod
|
||||
@@ -333,7 +332,7 @@ public abstract class LazyJavaMemberScope(
|
||||
protected open fun getAllPropertyNames(): Collection<Name> = memberIndex().getAllFieldNames()
|
||||
|
||||
override fun getLocalVariable(name: Name): VariableDescriptor? = null
|
||||
override fun getDeclarationsByLabel(labelName: LabelName) = listOf<DeclarationDescriptor>()
|
||||
override fun getDeclarationsByLabel(labelName: Name) = listOf<DeclarationDescriptor>()
|
||||
|
||||
override fun getOwnDeclaredDescriptors() = getAllDescriptors()
|
||||
override fun getAllDescriptors() = _allDescriptors()
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 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.name;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class LabelName {
|
||||
|
||||
@NotNull
|
||||
private final String name;
|
||||
|
||||
public LabelName(@NotNull String name) {
|
||||
if (name.startsWith("@")) {
|
||||
// label may contain @, and may not contain
|
||||
//throw new IllegalArgumentException("@ must be chopped: " + name);
|
||||
}
|
||||
|
||||
if (name.length() == 0) {
|
||||
// label can be empty
|
||||
//throw new IllegalStateException("label cannot be empty");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
LabelName name1 = (LabelName) o;
|
||||
|
||||
if (!name.equals(name1.name)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return name.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,13 @@ public final class Name implements Comparable<Name> {
|
||||
return new Name(name, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Name identifierForLabel(@NotNull String name) {
|
||||
// might be empty ('@' label)
|
||||
if (name.isEmpty()) return identifierNoValidate(name);
|
||||
return identifier(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Name special(@NotNull String name) {
|
||||
if (!name.startsWith("<")) {
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ package org.jetbrains.jet.lang.resolve.scopes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
|
||||
@@ -74,7 +73,7 @@ public abstract class AbstractScopeAdapter implements JetScope {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
return getWorkerScope().getDeclarationsByLabel(labelName);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.google.common.collect.Sets;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
|
||||
@@ -90,7 +89,7 @@ public class ChainedScope implements JetScope {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
ArrayList<DeclarationDescriptor> result = new ArrayList<DeclarationDescriptor>();
|
||||
for (JetScope jetScope : scopeChain) {
|
||||
result.addAll(jetScope.getDeclarationsByLabel(labelName));
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
|
||||
@@ -91,7 +90,7 @@ public class FilteringScope implements JetScope {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
return Collections2.filter(workerScope.getDeclarationsByLabel(labelName), predicate);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -54,7 +53,7 @@ public class InnerClassesScopeWrapper extends AbstractScopeAdapter {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
return Collections2.filter(actualScope.getDeclarationsByLabel(labelName), IS_CLASS);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
|
||||
@@ -72,7 +71,7 @@ public interface JetScope {
|
||||
|
||||
@NotNull
|
||||
@ReadOnly
|
||||
Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName);
|
||||
Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName);
|
||||
|
||||
/**
|
||||
* All visible descriptors from current scope.
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
|
||||
@@ -59,7 +58,7 @@ public abstract class JetScopeImpl implements JetScope {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
@@ -123,7 +122,7 @@ public class SubstitutingScope implements JetScope {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
throw new UnsupportedOperationException(); // TODO
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.checker.JetTypeChecker;
|
||||
import org.jetbrains.jet.utils.Printer;
|
||||
@@ -57,7 +56,7 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
private Map<Name, PackageViewDescriptor> packageAliases;
|
||||
|
||||
@Nullable
|
||||
private Map<LabelName, List<DeclarationDescriptor>> labelsToDescriptors;
|
||||
private Map<Name, List<DeclarationDescriptor>> labelsToDescriptors;
|
||||
|
||||
@Nullable
|
||||
private ReceiverParameterDescriptor implicitReceiver;
|
||||
@@ -140,20 +139,20 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Map<LabelName, List<DeclarationDescriptor>> getLabelsToDescriptors() {
|
||||
private Map<Name, List<DeclarationDescriptor>> getLabelsToDescriptors() {
|
||||
if (labelsToDescriptors == null) {
|
||||
labelsToDescriptors = new HashMap<LabelName, List<DeclarationDescriptor>>();
|
||||
labelsToDescriptors = new HashMap<Name, List<DeclarationDescriptor>>();
|
||||
}
|
||||
return labelsToDescriptors;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
checkMayRead();
|
||||
|
||||
Collection<DeclarationDescriptor> superResult = super.getDeclarationsByLabel(labelName);
|
||||
Map<LabelName, List<DeclarationDescriptor>> labelsToDescriptors = getLabelsToDescriptors();
|
||||
Map<Name, List<DeclarationDescriptor>> labelsToDescriptors = getLabelsToDescriptors();
|
||||
List<DeclarationDescriptor> declarationDescriptors = labelsToDescriptors.get(labelName);
|
||||
if (declarationDescriptors == null) {
|
||||
return superResult;
|
||||
@@ -168,8 +167,8 @@ public class WritableScopeImpl extends WritableScopeWithImports {
|
||||
public void addLabeledDeclaration(@NotNull DeclarationDescriptor descriptor) {
|
||||
checkMayWrite();
|
||||
|
||||
Map<LabelName, List<DeclarationDescriptor>> labelsToDescriptors = getLabelsToDescriptors();
|
||||
LabelName name = new LabelName(descriptor.getName().asString());
|
||||
Map<Name, List<DeclarationDescriptor>> labelsToDescriptors = getLabelsToDescriptors();
|
||||
Name name = descriptor.getName();
|
||||
List<DeclarationDescriptor> declarationDescriptors = labelsToDescriptors.get(name);
|
||||
if (declarationDescriptors == null) {
|
||||
declarationDescriptors = new ArrayList<DeclarationDescriptor>();
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.PropertyDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||
import org.jetbrains.jet.lang.resolve.ImportPath;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.types.error.ErrorClassDescriptor;
|
||||
@@ -122,7 +121,7 @@ public class ErrorUtils {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -194,7 +193,7 @@ public class ErrorUtils {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ import org.jetbrains.jet.descriptors.serialization.DescriptorDeserializer;
|
||||
import org.jetbrains.jet.descriptors.serialization.Flags;
|
||||
import org.jetbrains.jet.descriptors.serialization.ProtoBuf;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.LabelName;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.storage.MemoizedFunctionToNotNull;
|
||||
@@ -185,7 +184,7 @@ public abstract class DeserializedMemberScope implements JetScope {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
|
||||
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull Name labelName) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user