Merge remote-tracking branch 'origin/master'
This commit is contained in:
+10
-33
@@ -5,7 +5,6 @@ import com.google.common.collect.Sets;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ExtensionReceiver;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.TransientReceiver;
|
||||
@@ -22,20 +21,20 @@ import static org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements FunctionDescriptor {
|
||||
public abstract class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements FunctionDescriptor {
|
||||
|
||||
private List<TypeParameterDescriptor> typeParameters;
|
||||
private List<ValueParameterDescriptor> unsubstitutedValueParameters;
|
||||
private JetType unsubstitutedReturnType;
|
||||
protected List<TypeParameterDescriptor> typeParameters;
|
||||
protected List<ValueParameterDescriptor> unsubstitutedValueParameters;
|
||||
protected JetType unsubstitutedReturnType;
|
||||
private ReceiverDescriptor receiver;
|
||||
private ReceiverDescriptor expectedThisObject;
|
||||
protected ReceiverDescriptor expectedThisObject;
|
||||
|
||||
private Modality modality;
|
||||
private Visibility visibility;
|
||||
protected Modality modality;
|
||||
protected Visibility visibility;
|
||||
private final Set<FunctionDescriptor> overriddenFunctions = Sets.newLinkedHashSet();
|
||||
private final FunctionDescriptor original;
|
||||
|
||||
public FunctionDescriptorImpl(
|
||||
protected FunctionDescriptorImpl(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull List<AnnotationDescriptor> annotations,
|
||||
@NotNull String name) {
|
||||
@@ -43,7 +42,7 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements
|
||||
this.original = this;
|
||||
}
|
||||
|
||||
public FunctionDescriptorImpl(
|
||||
protected FunctionDescriptorImpl(
|
||||
@NotNull FunctionDescriptor original,
|
||||
@NotNull List<AnnotationDescriptor> annotations,
|
||||
@NotNull String name) {
|
||||
@@ -182,32 +181,10 @@ public class FunctionDescriptorImpl extends DeclarationDescriptorImpl implements
|
||||
return substitutedDescriptor;
|
||||
}
|
||||
|
||||
protected FunctionDescriptorImpl createSubstitutedCopy() {
|
||||
return new FunctionDescriptorImpl(
|
||||
this,
|
||||
// TODO : safeSubstitute
|
||||
getAnnotations(),
|
||||
getName());
|
||||
}
|
||||
protected abstract FunctionDescriptorImpl createSubstitutedCopy();
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(DeclarationDescriptorVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitFunctionDescriptor(this, data);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract) {
|
||||
FunctionDescriptorImpl copy = new FunctionDescriptorImpl(newOwner, Lists.newArrayList(getAnnotations()), getName());
|
||||
copy.initialize(
|
||||
getReceiverParameter().exists() ? getReceiverParameter().getType() : null,
|
||||
expectedThisObject,
|
||||
DescriptorUtils.copyTypeParameters(copy, typeParameters),
|
||||
DescriptorUtils.copyValueParameters(copy, unsubstitutedValueParameters),
|
||||
unsubstitutedReturnType,
|
||||
DescriptorUtils.convertModality(modality, makeNonAbstract),
|
||||
visibility
|
||||
);
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ public class MutableClassDescriptor extends MutableDeclarationDescriptor impleme
|
||||
private final Set<ConstructorDescriptor> constructors = Sets.newLinkedHashSet();
|
||||
private final Set<CallableMemberDescriptor> callableMembers = Sets.newHashSet();
|
||||
private final Set<PropertyDescriptor> properties = Sets.newHashSet();
|
||||
private final Set<FunctionDescriptor> functions = Sets.newHashSet();
|
||||
private final Set<NamedFunctionDescriptor> functions = Sets.newHashSet();
|
||||
private List<TypeParameterDescriptor> typeParameters = Lists.newArrayList();
|
||||
private Collection<JetType> supertypes = Lists.newArrayList();
|
||||
private Map<String, ClassDescriptor> innerClassesAndObjects = Maps.newHashMap();
|
||||
@@ -153,7 +153,7 @@ public class MutableClassDescriptor extends MutableDeclarationDescriptor impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
functions.add(functionDescriptor);
|
||||
callableMembers.add(functionDescriptor);
|
||||
scopeForMemberLookup.addFunctionDescriptor(functionDescriptor);
|
||||
@@ -161,7 +161,7 @@ public class MutableClassDescriptor extends MutableDeclarationDescriptor impleme
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<FunctionDescriptor> getFunctions() {
|
||||
public Set<NamedFunctionDescriptor> getFunctions() {
|
||||
return functions;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.jetbrains.jet.lang.descriptors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public interface NamedFunctionDescriptor extends FunctionDescriptor {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
NamedFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract);
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package org.jetbrains.jet.lang.descriptors;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public class NamedFunctionDescriptorImpl extends FunctionDescriptorImpl implements NamedFunctionDescriptor {
|
||||
|
||||
public NamedFunctionDescriptorImpl(@NotNull DeclarationDescriptor containingDeclaration, @NotNull List<AnnotationDescriptor> annotations, @NotNull String name) {
|
||||
super(containingDeclaration, annotations, name);
|
||||
}
|
||||
|
||||
private NamedFunctionDescriptorImpl(@NotNull NamedFunctionDescriptor original, @NotNull List<AnnotationDescriptor> annotations, @NotNull String name) {
|
||||
super(original, annotations, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FunctionDescriptorImpl createSubstitutedCopy() {
|
||||
return new NamedFunctionDescriptorImpl(
|
||||
this,
|
||||
// TODO : safeSubstitute
|
||||
getAnnotations(),
|
||||
getName());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public NamedFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract) {
|
||||
NamedFunctionDescriptorImpl copy = new NamedFunctionDescriptorImpl(newOwner, Lists.newArrayList(getAnnotations()), getName());
|
||||
copy.initialize(
|
||||
getReceiverParameter().exists() ? getReceiverParameter().getType() : null,
|
||||
expectedThisObject,
|
||||
DescriptorUtils.copyTypeParameters(copy, typeParameters),
|
||||
DescriptorUtils.copyValueParameters(copy, unsubstitutedValueParameters),
|
||||
unsubstitutedReturnType,
|
||||
DescriptorUtils.convertModality(modality, makeNonAbstract),
|
||||
visibility
|
||||
);
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class NamespaceDescriptorImpl extends AbstractNamespaceDescriptorImpl imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
memberScope.addFunctionDescriptor(functionDescriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public interface NamespaceLike extends DeclarationDescriptor {
|
||||
|
||||
void addObjectDescriptor(@NotNull MutableClassDescriptor objectDescriptor);
|
||||
|
||||
void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor);
|
||||
void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor);
|
||||
|
||||
void addPropertyDescriptor(@NotNull PropertyDescriptor propertyDescriptor);
|
||||
|
||||
|
||||
@@ -235,10 +235,8 @@ public class PropertyDescriptor extends VariableDescriptorImpl implements Callab
|
||||
newGetter.initialize(getter.getReturnType());
|
||||
}
|
||||
PropertySetterDescriptor newSetter = setter == null ? null : new PropertySetterDescriptor(
|
||||
DescriptorUtils.convertModality(setter.getModality(), makeNonAbstract), setter.getVisibility(),
|
||||
propertyDescriptor,
|
||||
Lists.newArrayList(setter.getAnnotations()),
|
||||
setter.hasBody(), setter.isDefault());
|
||||
propertyDescriptor, Lists.newArrayList(setter.getAnnotations()), DescriptorUtils.convertModality(setter.getModality(), makeNonAbstract), setter.getVisibility(),
|
||||
setter.hasBody(), setter.isDefault());
|
||||
if (newSetter != null) {
|
||||
newSetter.initialize(setter.getValueParameters().get(0).copy(newSetter));
|
||||
}
|
||||
|
||||
+7
-6
@@ -16,12 +16,13 @@ public class PropertySetterDescriptor extends PropertyAccessorDescriptor {
|
||||
|
||||
private ValueParameterDescriptor parameter;
|
||||
|
||||
public PropertySetterDescriptor(@NotNull Modality modality,
|
||||
@NotNull Visibility visibility,
|
||||
@NotNull PropertyDescriptor correspondingProperty,
|
||||
@NotNull List<AnnotationDescriptor> annotations,
|
||||
boolean hasBody,
|
||||
boolean isDefault) {
|
||||
public PropertySetterDescriptor(
|
||||
@NotNull PropertyDescriptor correspondingProperty,
|
||||
@NotNull List<AnnotationDescriptor> annotations,
|
||||
@NotNull Modality modality,
|
||||
@NotNull Visibility visibility,
|
||||
boolean hasBody,
|
||||
boolean isDefault) {
|
||||
super(modality, visibility, correspondingProperty, annotations, "set-" + correspondingProperty.getName(), hasBody, isDefault);
|
||||
if (isDefault) {
|
||||
initializeDefault();
|
||||
|
||||
@@ -42,6 +42,7 @@ public class TypeParameterDescriptor extends DeclarationDescriptorImpl implement
|
||||
return new TypeParameterDescriptor(containingDeclaration, annotations, reified, variance, name, index);
|
||||
}
|
||||
|
||||
// 0-based
|
||||
private final int index;
|
||||
private final Variance variance;
|
||||
private final Set<JetType> upperBounds;
|
||||
|
||||
+5
@@ -34,4 +34,9 @@ public class VariableAsFunctionDescriptor extends FunctionDescriptorImpl {
|
||||
public VariableAsFunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract) {
|
||||
throw new UnsupportedOperationException("Should not be copied for overriding");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FunctionDescriptorImpl createSubstitutedCopy() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
@@ -129,11 +129,11 @@ public interface Errors {
|
||||
return super.on(elementToBlame, nodeToMark, s, classDescriptor, modifierListOwner).add(DiagnosticParameters.CLASS, modifierListOwner);
|
||||
}
|
||||
};
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, FunctionDescriptor> ABSTRACT_FUNCTION_WITH_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "A function {0} with body cannot be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, FunctionDescriptor> NON_ABSTRACT_FUNCTION_WITH_NO_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Method {0} without a body must be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetModifierListOwner, FunctionDescriptor> NON_MEMBER_ABSTRACT_FUNCTION = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Function {0} is not a class or trait member and cannot be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, NamedFunctionDescriptor> ABSTRACT_FUNCTION_WITH_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "A function {0} with body cannot be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, NamedFunctionDescriptor> NON_ABSTRACT_FUNCTION_WITH_NO_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Method {0} without a body must be abstract");
|
||||
PsiElementOnlyDiagnosticFactory1<JetModifierListOwner, NamedFunctionDescriptor> NON_MEMBER_ABSTRACT_FUNCTION = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Function {0} is not a class or trait member and cannot be abstract");
|
||||
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, FunctionDescriptor> NON_MEMBER_FUNCTION_NO_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Function {0} must have a body");
|
||||
PsiElementOnlyDiagnosticFactory1<JetFunction, NamedFunctionDescriptor> NON_MEMBER_FUNCTION_NO_BODY = PsiElementOnlyDiagnosticFactory1.create(ERROR, "Function {0} must have a body");
|
||||
|
||||
DiagnosticWithParameterFactory<JetNamedDeclaration, JetClass> NON_FINAL_MEMBER_IN_FINAL_CLASS = DiagnosticWithParameterFactory.create(ERROR, "Non final member in a final class", DiagnosticParameters.CLASS);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
|
||||
private static final TokenSet TYPE_ARGUMENT_LIST_STOPPERS = TokenSet.create(
|
||||
INTEGER_LITERAL, FLOAT_LITERAL, CHARACTER_LITERAL, OPEN_QUOTE, RAW_STRING_LITERAL,
|
||||
NAMESPACE_KEYWORD, AS_KEYWORD, TYPE_KEYWORD, TRAIT_KEYWORD, CLASS_KEYWORD, THIS_KEYWORD, VAL_KEYWORD, VAR_KEYWORD,
|
||||
PACKAGE_KEYWORD, AS_KEYWORD, TYPE_KEYWORD, TRAIT_KEYWORD, CLASS_KEYWORD, THIS_KEYWORD, VAL_KEYWORD, VAR_KEYWORD,
|
||||
FUN_KEYWORD, FOR_KEYWORD, NULL_KEYWORD,
|
||||
TRUE_KEYWORD, FALSE_KEYWORD, IS_KEYWORD, THROW_KEYWORD, RETURN_KEYWORD, BREAK_KEYWORD,
|
||||
CONTINUE_KEYWORD, OBJECT_KEYWORD, IF_KEYWORD, TRY_KEYWORD, ELSE_KEYWORD, WHILE_KEYWORD, DO_KEYWORD,
|
||||
@@ -83,7 +83,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
IDENTIFIER, // SimpleName
|
||||
FIELD_IDENTIFIER, // Field reference
|
||||
|
||||
NAMESPACE_KEYWORD // for absolute qualified names
|
||||
PACKAGE_KEYWORD // for absolute qualified names
|
||||
);
|
||||
|
||||
private static final TokenSet STATEMENT_FIRST = TokenSet.orSet(
|
||||
@@ -509,7 +509,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
else if (at(HASH)) {
|
||||
parseTupleExpression();
|
||||
}
|
||||
else if (at(NAMESPACE_KEYWORD)) {
|
||||
else if (at(PACKAGE_KEYWORD)) {
|
||||
parseOneTokenExpression(ROOT_NAMESPACE);
|
||||
}
|
||||
else if (at(THIS_KEYWORD)) {
|
||||
@@ -865,7 +865,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
||||
|
||||
myJetParsing.parseAnnotations(false);
|
||||
|
||||
if (at(NAMESPACE_KEYWORD) || at(IDENTIFIER) || at(FUN_KEYWORD) || at(THIS_KEYWORD)) {
|
||||
if (at(PACKAGE_KEYWORD) || at(IDENTIFIER) || at(FUN_KEYWORD) || at(THIS_KEYWORD)) {
|
||||
PsiBuilder.Marker rollbackMarker = mark();
|
||||
parseBinaryExpression(Precedence.ELVIS);
|
||||
if (at(HASH)) {
|
||||
|
||||
@@ -29,7 +29,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
}
|
||||
|
||||
private static final TokenSet TOPLEVEL_OBJECT_FIRST = TokenSet.create(TYPE_KEYWORD, TRAIT_KEYWORD, CLASS_KEYWORD,
|
||||
FUN_KEYWORD, VAL_KEYWORD, NAMESPACE_KEYWORD);
|
||||
FUN_KEYWORD, VAL_KEYWORD, PACKAGE_KEYWORD);
|
||||
private static final TokenSet ENUM_MEMBER_FIRST = TokenSet.create(TYPE_KEYWORD, TRAIT_KEYWORD, CLASS_KEYWORD,
|
||||
FUN_KEYWORD, VAL_KEYWORD, IDENTIFIER);
|
||||
|
||||
@@ -117,8 +117,8 @@ public class JetParsing extends AbstractJetParsing {
|
||||
PsiBuilder.Marker firstEntry = mark();
|
||||
parseModifierList(MODIFIER_LIST, true);
|
||||
|
||||
if (at(NAMESPACE_KEYWORD)) {
|
||||
advance(); // NAMESPACE_KEYWORD
|
||||
if (at(PACKAGE_KEYWORD)) {
|
||||
advance(); // PACKAGE_KEYWORD
|
||||
parseNamespaceName();
|
||||
|
||||
if (at(LBRACE)) {
|
||||
@@ -170,8 +170,8 @@ public class JetParsing extends AbstractJetParsing {
|
||||
advance(); // IMPORT_KEYWORD
|
||||
|
||||
PsiBuilder.Marker qualifiedName = mark();
|
||||
if (at(NAMESPACE_KEYWORD)) {
|
||||
advance(); // NAMESPACE_KEYWORD
|
||||
if (at(PACKAGE_KEYWORD)) {
|
||||
advance(); // PACKAGE_KEYWORD
|
||||
expect(DOT, "Expecting '.'", TokenSet.create(IDENTIFIER, MUL, SEMICOLON));
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
IElementType keywordToken = tt();
|
||||
JetNodeType declType = null;
|
||||
// if (keywordToken == NAMESPACE_KEYWORD) {
|
||||
// if (keywordToken == PACKAGE_KEYWORD) {
|
||||
// declType = parseNamespaceBlock();
|
||||
// }
|
||||
// else
|
||||
@@ -640,7 +640,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
parseClassBody();
|
||||
}
|
||||
else {
|
||||
expect(COLON, "Expecting ':'", TokenSet.create(IDENTIFIER, NAMESPACE_KEYWORD));
|
||||
expect(COLON, "Expecting ':'", TokenSet.create(IDENTIFIER, PACKAGE_KEYWORD));
|
||||
parseDelegationSpecifierList();
|
||||
parseClassBody();
|
||||
}
|
||||
@@ -1253,7 +1253,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
PsiBuilder.Marker typeRefMarker = mark();
|
||||
parseAnnotations(false);
|
||||
|
||||
if (at(IDENTIFIER) || at(NAMESPACE_KEYWORD)) {
|
||||
if (at(IDENTIFIER) || at(PACKAGE_KEYWORD)) {
|
||||
parseUserType();
|
||||
}
|
||||
else if (at(HASH)) {
|
||||
@@ -1340,8 +1340,8 @@ public class JetParsing extends AbstractJetParsing {
|
||||
private void parseUserType() {
|
||||
PsiBuilder.Marker userType = mark();
|
||||
|
||||
if (at(NAMESPACE_KEYWORD)) {
|
||||
advance(); // NAMESPACE_KEYWORD
|
||||
if (at(PACKAGE_KEYWORD)) {
|
||||
advance(); // PACKAGE_KEYWORD
|
||||
expect(DOT, "Expecting '.'", TokenSet.create(IDENTIFIER));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class JetImportDirective extends JetElement {
|
||||
}
|
||||
|
||||
public boolean isAbsoluteInRootNamespace() {
|
||||
return findChildByType(JetTokens.NAMESPACE_KEYWORD) != null;
|
||||
return findChildByType(JetTokens.PACKAGE_KEYWORD) != null;
|
||||
}
|
||||
|
||||
@Nullable @IfNotParsed
|
||||
|
||||
@@ -19,7 +19,7 @@ public class JetUserType extends JetTypeElement {
|
||||
}
|
||||
|
||||
public boolean isAbsoluteInRootNamespace() {
|
||||
return findChildByType(JetTokens.NAMESPACE_KEYWORD) != null;
|
||||
return findChildByType(JetTokens.PACKAGE_KEYWORD) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -122,7 +122,7 @@ public class AnalyzingUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
scope.addFunctionDescriptor(functionDescriptor);
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public interface BindingContext {
|
||||
WritableSlice<PsiElement, NamespaceDescriptor> NAMESPACE = Slices.<PsiElement, NamespaceDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, ClassDescriptor> CLASS = Slices.<PsiElement, ClassDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<JetTypeParameter, TypeParameterDescriptor> TYPE_PARAMETER = Slices.<JetTypeParameter, TypeParameterDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, FunctionDescriptor> FUNCTION = Slices.<PsiElement, FunctionDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, NamedFunctionDescriptor> FUNCTION = Slices.<PsiElement, NamedFunctionDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, ConstructorDescriptor> CONSTRUCTOR = Slices.<PsiElement, ConstructorDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<PsiElement, VariableDescriptor> VARIABLE = Slices.<PsiElement, VariableDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
WritableSlice<JetParameter, VariableDescriptor> VALUE_PARAMETER = Slices.<JetParameter, VariableDescriptor>sliceBuilder().setOpposite((WritableSlice) DESCRIPTOR_TO_DECLARATION).build();
|
||||
|
||||
@@ -467,9 +467,9 @@ public class BodyResolver {
|
||||
}
|
||||
|
||||
private void resolveFunctionBodies() {
|
||||
for (Map.Entry<JetNamedFunction, FunctionDescriptorImpl> entry : this.context.getFunctions().entrySet()) {
|
||||
for (Map.Entry<JetNamedFunction, NamedFunctionDescriptor> entry : this.context.getFunctions().entrySet()) {
|
||||
JetNamedFunction declaration = entry.getKey();
|
||||
FunctionDescriptor descriptor = entry.getValue();
|
||||
NamedFunctionDescriptor descriptor = entry.getValue();
|
||||
|
||||
computeDeferredType(descriptor.getReturnType());
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ public class ControlFlowAnalyzer {
|
||||
if (!context.completeAnalysisNeeded(objectDeclaration)) continue;
|
||||
checkClassOrObject(objectDeclaration);
|
||||
}
|
||||
for (Map.Entry<JetNamedFunction, FunctionDescriptorImpl> entry : context.getFunctions().entrySet()) {
|
||||
for (Map.Entry<JetNamedFunction, NamedFunctionDescriptor> entry : context.getFunctions().entrySet()) {
|
||||
JetNamedFunction function = entry.getKey();
|
||||
FunctionDescriptorImpl functionDescriptor = entry.getValue();
|
||||
NamedFunctionDescriptor functionDescriptor = entry.getValue();
|
||||
if (!context.completeAnalysisNeeded(function)) continue;
|
||||
final JetType expectedReturnType = !function.hasBlockBody() && !function.hasDeclaredReturnType()
|
||||
? NO_EXPECTED_TYPE
|
||||
|
||||
@@ -103,7 +103,7 @@ public class DeclarationResolver {
|
||||
declaration.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitNamedFunction(JetNamedFunction function) {
|
||||
FunctionDescriptorImpl functionDescriptor = context.getDescriptorResolver().resolveFunctionDescriptor(namespaceLike, scopeForFunctions, function);
|
||||
NamedFunctionDescriptor functionDescriptor = context.getDescriptorResolver().resolveFunctionDescriptor(namespaceLike, scopeForFunctions, function);
|
||||
namespaceLike.addFunctionDescriptor(functionDescriptor);
|
||||
context.getFunctions().put(function, functionDescriptor);
|
||||
context.getDeclaringScopes().put(function, scopeForFunctions);
|
||||
|
||||
@@ -55,10 +55,10 @@ public class DeclarationsChecker {
|
||||
checkObject(objectDeclaration, objectDescriptor);
|
||||
}
|
||||
|
||||
Map<JetNamedFunction, FunctionDescriptorImpl> functions = context.getFunctions();
|
||||
for (Map.Entry<JetNamedFunction, FunctionDescriptorImpl> entry : functions.entrySet()) {
|
||||
Map<JetNamedFunction, NamedFunctionDescriptor> functions = context.getFunctions();
|
||||
for (Map.Entry<JetNamedFunction, NamedFunctionDescriptor> entry : functions.entrySet()) {
|
||||
JetNamedFunction function = entry.getKey();
|
||||
FunctionDescriptorImpl functionDescriptor = entry.getValue();
|
||||
NamedFunctionDescriptor functionDescriptor = entry.getValue();
|
||||
|
||||
if (!context.completeAnalysisNeeded(function)) continue;
|
||||
checkFunction(function, functionDescriptor);
|
||||
@@ -254,7 +254,7 @@ public class DeclarationsChecker {
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkFunction(JetNamedFunction function, FunctionDescriptor functionDescriptor) {
|
||||
protected void checkFunction(JetNamedFunction function, NamedFunctionDescriptor functionDescriptor) {
|
||||
DeclarationDescriptor containingDescriptor = functionDescriptor.getContainingDeclaration();
|
||||
PsiElement nameIdentifier = function.getNameIdentifier();
|
||||
JetModifierList modifierList = function.getModifierList();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.jet.lang.resolve;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.MutableClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamedFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
@@ -49,10 +50,10 @@ public class DelegationResolver {
|
||||
context.getTrace().record(DELEGATED, copy);
|
||||
}
|
||||
}
|
||||
else if (declarationDescriptor instanceof FunctionDescriptor) {
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) declarationDescriptor;
|
||||
else if (declarationDescriptor instanceof NamedFunctionDescriptor) {
|
||||
NamedFunctionDescriptor functionDescriptor = (NamedFunctionDescriptor) declarationDescriptor;
|
||||
if (functionDescriptor.getModality().isOverridable()) {
|
||||
FunctionDescriptor copy = functionDescriptor.copy(classDescriptor, true);
|
||||
NamedFunctionDescriptor copy = functionDescriptor.copy(classDescriptor, true);
|
||||
classDescriptor.addFunctionDescriptor(copy);
|
||||
context.getTrace().record(DELEGATED, copy);
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ public class DescriptorResolver {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FunctionDescriptorImpl resolveFunctionDescriptor(DeclarationDescriptor containingDescriptor, final JetScope scope, final JetNamedFunction function) {
|
||||
final FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(
|
||||
public NamedFunctionDescriptor resolveFunctionDescriptor(DeclarationDescriptor containingDescriptor, final JetScope scope, final JetNamedFunction function) {
|
||||
final NamedFunctionDescriptorImpl functionDescriptor = new NamedFunctionDescriptorImpl(
|
||||
containingDescriptor,
|
||||
annotationResolver.resolveAnnotations(scope, function.getModifierList()),
|
||||
JetPsiUtil.safeName(function.getName())
|
||||
@@ -276,31 +276,12 @@ public class DescriptorResolver {
|
||||
|
||||
private JetType getVarargParameterType(JetType type) {
|
||||
JetStandardLibrary standardLibrary = semanticServices.getStandardLibrary();
|
||||
if (type.equals(standardLibrary.getByteType())) {
|
||||
return standardLibrary.getByteArrayType();
|
||||
JetType arrayType = standardLibrary.getPrimitiveArrayJetTypeByPrimitiveJetType(type);
|
||||
if (arrayType != null) {
|
||||
return arrayType;
|
||||
} else {
|
||||
return standardLibrary.getArrayType(type);
|
||||
}
|
||||
if (type.equals(standardLibrary.getCharType())) {
|
||||
return standardLibrary.getCharArrayType();
|
||||
}
|
||||
if (type.equals(standardLibrary.getShortType())) {
|
||||
return standardLibrary.getShortArrayType();
|
||||
}
|
||||
if (type.equals(standardLibrary.getIntType())) {
|
||||
return standardLibrary.getIntArrayType();
|
||||
}
|
||||
if (type.equals(standardLibrary.getLongType())) {
|
||||
return standardLibrary.getLongArrayType();
|
||||
}
|
||||
if (type.equals(standardLibrary.getFloatType())) {
|
||||
return standardLibrary.getFloatArrayType();
|
||||
}
|
||||
if (type.equals(standardLibrary.getDoubleType())) {
|
||||
return standardLibrary.getDoubleArrayType();
|
||||
}
|
||||
if (type.equals(standardLibrary.getBooleanType())) {
|
||||
return standardLibrary.getBooleanArrayType();
|
||||
}
|
||||
return standardLibrary.getArrayType(type);
|
||||
}
|
||||
|
||||
public List<TypeParameterDescriptor> resolveTypeParameters(DeclarationDescriptor containingDescriptor, WritableScope extensibleScope, List<JetTypeParameter> typeParameters) {
|
||||
@@ -668,9 +649,9 @@ public class DescriptorResolver {
|
||||
JetParameter parameter = setter.getParameter();
|
||||
|
||||
setterDescriptor = new PropertySetterDescriptor(
|
||||
resolveModalityFromModifiers(setter.getModifierList(), propertyDescriptor.getModality()),
|
||||
propertyDescriptor, annotations, resolveModalityFromModifiers(setter.getModifierList(), propertyDescriptor.getModality()),
|
||||
resolveVisibilityFromModifiers(setter.getModifierList(), propertyDescriptor.getVisibility()),
|
||||
propertyDescriptor, annotations, setter.getBodyExpression() != null, false);
|
||||
setter.getBodyExpression() != null, false);
|
||||
if (parameter != null) {
|
||||
if (parameter.isRef()) {
|
||||
// trace.getErrorHandler().genericError(parameter.getRefNode(), "Setter parameters can not be 'ref'");
|
||||
@@ -728,9 +709,9 @@ public class DescriptorResolver {
|
||||
private PropertySetterDescriptor createDefaultSetter(PropertyDescriptor propertyDescriptor) {
|
||||
PropertySetterDescriptor setterDescriptor;
|
||||
setterDescriptor = new PropertySetterDescriptor(
|
||||
propertyDescriptor.getModality(),
|
||||
propertyDescriptor, Collections.<AnnotationDescriptor>emptyList(), propertyDescriptor.getModality(),
|
||||
propertyDescriptor.getVisibility(),
|
||||
propertyDescriptor, Collections.<AnnotationDescriptor>emptyList(), false, true);
|
||||
false, true);
|
||||
return setterDescriptor;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class OverloadResolver {
|
||||
|
||||
MultiMap<Key, FunctionDescriptor> functionsByName = MultiMap.create();
|
||||
|
||||
for (FunctionDescriptorImpl function : context.getFunctions().values()) {
|
||||
for (NamedFunctionDescriptor function : context.getFunctions().values()) {
|
||||
DeclarationDescriptor containingDeclaration = function.getContainingDeclaration();
|
||||
if (containingDeclaration instanceof NamespaceDescriptor) {
|
||||
NamespaceDescriptor namespaceDescriptor = (NamespaceDescriptor) containingDeclaration;
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Set;
|
||||
protected final Map<JetFile, NamespaceDescriptorImpl> namespaceDescriptors = Maps.newHashMap();
|
||||
|
||||
private final Map<JetDeclaration, JetScope> declaringScopes = Maps.newHashMap();
|
||||
private final Map<JetNamedFunction, FunctionDescriptorImpl> functions = Maps.newLinkedHashMap();
|
||||
private final Map<JetNamedFunction, NamedFunctionDescriptor> functions = Maps.newLinkedHashMap();
|
||||
private final Map<JetSecondaryConstructor, ConstructorDescriptor> constructors = Maps.newLinkedHashMap();
|
||||
private final Map<JetProperty, PropertyDescriptor> properties = Maps.newLinkedHashMap();
|
||||
private final Set<PropertyDescriptor> primaryConstructorParameterProperties = Sets.newHashSet();
|
||||
@@ -138,7 +138,7 @@ import java.util.Set;
|
||||
return declaringScopes;
|
||||
}
|
||||
|
||||
public Map<JetNamedFunction, FunctionDescriptorImpl> getFunctions() {
|
||||
public Map<JetNamedFunction, NamedFunctionDescriptor> getFunctions() {
|
||||
return functions;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ public class TopDownAnalyzer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFunctionDescriptor(@NotNull FunctionDescriptor functionDescriptor) {
|
||||
public void addFunctionDescriptor(@NotNull NamedFunctionDescriptor functionDescriptor) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
+11
@@ -18,4 +18,15 @@ public class ExpressionAsFunctionDescriptor extends FunctionDescriptorImpl {
|
||||
public ExpressionAsFunctionDescriptor(DeclarationDescriptor containingDeclaration, String name) {
|
||||
super(containingDeclaration, Collections.<AnnotationDescriptor>emptyList(), name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FunctionDescriptorImpl createSubstitutedCopy() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FunctionDescriptor copy(DeclarationDescriptor newOwner, boolean makeNonAbstract) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ErrorUtils {
|
||||
private static final Set<VariableDescriptor> ERROR_PROPERTY_GROUP = Collections.singleton(ERROR_PROPERTY);
|
||||
|
||||
private static FunctionDescriptor createErrorFunction(List<TypeParameterDescriptor> typeParameters, List<JetType> positionedValueArgumentTypes) {
|
||||
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), "<ERROR FUNCTION>");
|
||||
FunctionDescriptorImpl functionDescriptor = new NamedFunctionDescriptorImpl(ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), "<ERROR FUNCTION>");
|
||||
return functionDescriptor.initialize(
|
||||
null,
|
||||
ReceiverDescriptor.NO_RECEIVER,
|
||||
@@ -139,7 +139,7 @@ public class ErrorUtils {
|
||||
}
|
||||
|
||||
public static FunctionDescriptor createErrorFunction(int typeParameterCount, List<JetType> positionedValueParameterTypes) {
|
||||
return new FunctionDescriptorImpl(ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), "<ERROR FUNCTION>").initialize(
|
||||
return new NamedFunctionDescriptorImpl(ERROR_CLASS, Collections.<AnnotationDescriptor>emptyList(), "<ERROR FUNCTION>").initialize(
|
||||
null,
|
||||
ReceiverDescriptor.NO_RECEIVER,
|
||||
Collections.<TypeParameterDescriptor>emptyList(), // TODO
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.JetSemanticServices;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
@@ -50,14 +51,6 @@ public class JetStandardLibrary {
|
||||
private JetScope libraryScope;
|
||||
|
||||
private ClassDescriptor numberClass;
|
||||
private ClassDescriptor byteClass;
|
||||
private ClassDescriptor charClass;
|
||||
private ClassDescriptor shortClass;
|
||||
private ClassDescriptor intClass;
|
||||
private ClassDescriptor longClass;
|
||||
private ClassDescriptor floatClass;
|
||||
private ClassDescriptor doubleClass;
|
||||
private ClassDescriptor booleanClass;
|
||||
|
||||
private ClassDescriptor stringClass;
|
||||
private ClassDescriptor arrayClass;
|
||||
@@ -65,54 +58,10 @@ public class JetStandardLibrary {
|
||||
private ClassDescriptor typeInfoClass;
|
||||
private ClassDescriptor comparableClass;
|
||||
|
||||
private JetType byteType;
|
||||
private JetType charType;
|
||||
private JetType shortType;
|
||||
private JetType intType;
|
||||
private JetType longType;
|
||||
private JetType floatType;
|
||||
private JetType doubleType;
|
||||
private JetType booleanType;
|
||||
|
||||
private JetType stringType;
|
||||
|
||||
private JetType nullableByteType;
|
||||
private JetType nullableCharType;
|
||||
private JetType nullableShortType;
|
||||
private JetType nullableIntType;
|
||||
private JetType nullableLongType;
|
||||
private JetType nullableFloatType;
|
||||
private JetType nullableDoubleType;
|
||||
private JetType nullableBooleanType;
|
||||
private JetType nullableTuple0Type;
|
||||
|
||||
private ClassDescriptor byteArrayClass;
|
||||
private ClassDescriptor charArrayClass;
|
||||
private ClassDescriptor shortArrayClass;
|
||||
private ClassDescriptor intArrayClass;
|
||||
private ClassDescriptor longArrayClass;
|
||||
private ClassDescriptor floatArrayClass;
|
||||
private ClassDescriptor doubleArrayClass;
|
||||
private ClassDescriptor booleanArrayClass;
|
||||
|
||||
private JetType byteArrayType;
|
||||
private JetType charArrayType;
|
||||
private JetType shortArrayType;
|
||||
private JetType intArrayType;
|
||||
private JetType longArrayType;
|
||||
private JetType floatArrayType;
|
||||
private JetType doubleArrayType;
|
||||
private JetType booleanArrayType;
|
||||
|
||||
private JetType nullableByteArrayType;
|
||||
private JetType nullableCharArrayType;
|
||||
private JetType nullableShortArrayType;
|
||||
private JetType nullableIntArrayType;
|
||||
private JetType nullableLongArrayType;
|
||||
private JetType nullableFloatArrayType;
|
||||
private JetType nullableDoubleArrayType;
|
||||
private JetType nullableBooleanArrayType;
|
||||
|
||||
public JetType getTuple0Type() {
|
||||
return tuple0Type;
|
||||
}
|
||||
@@ -122,6 +71,14 @@ public class JetStandardLibrary {
|
||||
|
||||
private Set<FunctionDescriptor> typeInfoFunction;
|
||||
|
||||
private EnumMap<PrimitiveType, ClassDescriptor> primitiveTypeToClass;
|
||||
private EnumMap<PrimitiveType, ClassDescriptor> primitiveTypeToArrayClass;
|
||||
private EnumMap<PrimitiveType, JetType> primitiveTypeToJetType;
|
||||
private EnumMap<PrimitiveType, JetType> primitiveTypeToNullableJetType;
|
||||
private EnumMap<PrimitiveType, JetType> primitiveTypeToArrayJetType;
|
||||
private EnumMap<PrimitiveType, JetType> primitiveTypeToNullableArrayJetType;
|
||||
private Map<JetType, JetType> primitiveJetTypeToJetArrayType;
|
||||
|
||||
private JetStandardLibrary(@NotNull Project project) {
|
||||
// TODO : review
|
||||
List<String> libraryFiles = Arrays.asList(
|
||||
@@ -168,14 +125,6 @@ public class JetStandardLibrary {
|
||||
if(libraryScope == null) {
|
||||
this.libraryScope = JetStandardClasses.STANDARD_CLASSES_NAMESPACE.getMemberScope();
|
||||
this.numberClass = (ClassDescriptor) libraryScope.getClassifier("Number");
|
||||
this.byteClass = (ClassDescriptor) libraryScope.getClassifier("Byte");
|
||||
this.charClass = (ClassDescriptor) libraryScope.getClassifier("Char");
|
||||
this.shortClass = (ClassDescriptor) libraryScope.getClassifier("Short");
|
||||
this.intClass = (ClassDescriptor) libraryScope.getClassifier("Int");
|
||||
this.longClass = (ClassDescriptor) libraryScope.getClassifier("Long");
|
||||
this.floatClass = (ClassDescriptor) libraryScope.getClassifier("Float");
|
||||
this.doubleClass = (ClassDescriptor) libraryScope.getClassifier("Double");
|
||||
this.booleanClass = (ClassDescriptor) libraryScope.getClassifier("Boolean");
|
||||
this.stringClass = (ClassDescriptor) libraryScope.getClassifier("String");
|
||||
this.arrayClass = (ClassDescriptor) libraryScope.getClassifier("Array");
|
||||
|
||||
@@ -185,59 +134,41 @@ public class JetStandardLibrary {
|
||||
this.typeInfoClass = (ClassDescriptor) libraryScope.getClassifier("TypeInfo");
|
||||
this.typeInfoFunction = libraryScope.getFunctions("typeinfo");
|
||||
|
||||
this.byteType = new JetTypeImpl(getByte());
|
||||
this.charType = new JetTypeImpl(getChar());
|
||||
this.shortType = new JetTypeImpl(getShort());
|
||||
this.intType = new JetTypeImpl(getInt());
|
||||
this.longType = new JetTypeImpl(getLong());
|
||||
this.floatType = new JetTypeImpl(getFloat());
|
||||
this.doubleType = new JetTypeImpl(getDouble());
|
||||
this.booleanType = new JetTypeImpl(getBoolean());
|
||||
|
||||
this.stringType = new JetTypeImpl(getString());
|
||||
this.nullableStringType = TypeUtils.makeNullable(stringType);
|
||||
|
||||
this.tuple0Type = new JetTypeImpl(JetStandardClasses.getTuple(0));
|
||||
this.nullableTuple0Type = TypeUtils.makeNullable(tuple0Type);
|
||||
|
||||
primitiveTypeToClass = new EnumMap<PrimitiveType, ClassDescriptor>(PrimitiveType.class);
|
||||
primitiveTypeToJetType = new EnumMap<PrimitiveType, JetType>(PrimitiveType.class);
|
||||
primitiveTypeToNullableJetType = new EnumMap<PrimitiveType, JetType>(PrimitiveType.class);
|
||||
primitiveTypeToArrayClass = new EnumMap<PrimitiveType, ClassDescriptor>(PrimitiveType.class);
|
||||
primitiveTypeToArrayJetType = new EnumMap<PrimitiveType, JetType>(PrimitiveType.class);
|
||||
primitiveTypeToNullableArrayJetType = new EnumMap<PrimitiveType, JetType>(PrimitiveType.class);
|
||||
primitiveJetTypeToJetArrayType = new HashMap<JetType, JetType>();
|
||||
|
||||
this.nullableByteType = TypeUtils.makeNullable(byteType);
|
||||
this.nullableCharType = TypeUtils.makeNullable(charType);
|
||||
this.nullableShortType = TypeUtils.makeNullable(shortType);
|
||||
this.nullableIntType = TypeUtils.makeNullable(intType);
|
||||
this.nullableLongType = TypeUtils.makeNullable(longType);
|
||||
this.nullableFloatType = TypeUtils.makeNullable(floatType);
|
||||
this.nullableDoubleType = TypeUtils.makeNullable(doubleType);
|
||||
this.nullableBooleanType = TypeUtils.makeNullable(booleanType);
|
||||
|
||||
this.byteArrayClass = (ClassDescriptor) libraryScope.getClassifier("ByteArray");
|
||||
this.charArrayClass = (ClassDescriptor) libraryScope.getClassifier("CharArray");
|
||||
this.shortArrayClass = (ClassDescriptor) libraryScope.getClassifier("ShortArray");
|
||||
this.intArrayClass = (ClassDescriptor) libraryScope.getClassifier("IntArray");
|
||||
this.longArrayClass = (ClassDescriptor) libraryScope.getClassifier("LongArray");
|
||||
this.floatArrayClass = (ClassDescriptor) libraryScope.getClassifier("FloatArray");
|
||||
this.doubleArrayClass = (ClassDescriptor) libraryScope.getClassifier("DoubleArray");
|
||||
this.booleanArrayClass = (ClassDescriptor) libraryScope.getClassifier("BooleanArray");
|
||||
|
||||
this.byteArrayType = new JetTypeImpl(byteArrayClass);
|
||||
this.charArrayType = new JetTypeImpl(charArrayClass);
|
||||
this.shortArrayType = new JetTypeImpl(shortArrayClass);
|
||||
this.intArrayType = new JetTypeImpl(intArrayClass);
|
||||
this.longArrayType = new JetTypeImpl(longArrayClass);
|
||||
this.floatArrayType = new JetTypeImpl(floatArrayClass);
|
||||
this.doubleArrayType = new JetTypeImpl(doubleArrayClass);
|
||||
this.booleanArrayType = new JetTypeImpl(booleanArrayClass);
|
||||
|
||||
this.nullableByteArrayType = TypeUtils.makeNullable(byteArrayType);
|
||||
this.nullableCharArrayType = TypeUtils.makeNullable(charArrayType);
|
||||
this.nullableShortArrayType = TypeUtils.makeNullable(shortArrayType);
|
||||
this.nullableIntArrayType = TypeUtils.makeNullable(intArrayType);
|
||||
this.nullableLongArrayType = TypeUtils.makeNullable(longArrayType);
|
||||
this.nullableFloatArrayType = TypeUtils.makeNullable(floatArrayType);
|
||||
this.nullableDoubleArrayType = TypeUtils.makeNullable(doubleArrayType);
|
||||
this.nullableBooleanArrayType = TypeUtils.makeNullable(booleanArrayType);
|
||||
for (PrimitiveType primitive : PrimitiveType.values()) {
|
||||
makePrimitive(primitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void makePrimitive(PrimitiveType primitiveType) {
|
||||
ClassDescriptor clazz = (ClassDescriptor) libraryScope.getClassifier(primitiveType.getTypeName());
|
||||
ClassDescriptor arrayClazz = (ClassDescriptor) libraryScope.getClassifier(primitiveType.getTypeName() + "Array");
|
||||
JetTypeImpl type = new JetTypeImpl(clazz);
|
||||
JetTypeImpl arrayType = new JetTypeImpl(arrayClazz);
|
||||
|
||||
primitiveTypeToClass.put(primitiveType, clazz);
|
||||
primitiveTypeToJetType.put(primitiveType, type);
|
||||
primitiveTypeToNullableJetType.put(primitiveType, TypeUtils.makeNullable(type));
|
||||
primitiveTypeToArrayClass.put(primitiveType, arrayClazz);
|
||||
primitiveTypeToArrayJetType.put(primitiveType, arrayType);
|
||||
primitiveTypeToNullableArrayJetType.put(primitiveType, TypeUtils.makeNullable(arrayType));
|
||||
primitiveJetTypeToJetArrayType.put(type, arrayType);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getNumber() {
|
||||
initStdClasses();
|
||||
@@ -245,51 +176,49 @@ public class JetStandardLibrary {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getByte() {
|
||||
public ClassDescriptor getPrimitiveClassDescriptor(PrimitiveType primitiveType) {
|
||||
initStdClasses();
|
||||
return byteClass;
|
||||
return primitiveTypeToClass.get(primitiveType);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getByte() {
|
||||
return getPrimitiveClassDescriptor(PrimitiveType.BYTE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getChar() {
|
||||
initStdClasses();
|
||||
return charClass;
|
||||
return getPrimitiveClassDescriptor(PrimitiveType.CHAR);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getShort() {
|
||||
initStdClasses();
|
||||
return shortClass;
|
||||
return getPrimitiveClassDescriptor(PrimitiveType.SHORT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getInt() {
|
||||
initStdClasses();
|
||||
return intClass;
|
||||
return getPrimitiveClassDescriptor(PrimitiveType.INT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getLong() {
|
||||
initStdClasses();
|
||||
return longClass;
|
||||
return getPrimitiveClassDescriptor(PrimitiveType.LONG);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getFloat() {
|
||||
initStdClasses();
|
||||
return floatClass;
|
||||
return getPrimitiveClassDescriptor(PrimitiveType.FLOAT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getDouble() {
|
||||
initStdClasses();
|
||||
return doubleClass;
|
||||
return getPrimitiveClassDescriptor(PrimitiveType.DOUBLE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getBoolean() {
|
||||
initStdClasses();
|
||||
return booleanClass;
|
||||
return getPrimitiveClassDescriptor(PrimitiveType.BOOLEAN);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -338,40 +267,39 @@ public class JetStandardLibrary {
|
||||
return new JetTypeImpl(Collections.<AnnotationDescriptor>emptyList(), getTypeInfo().getTypeConstructor(), false, arguments, getTypeInfo().getMemberScope(arguments));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetType getPrimitiveJetType(PrimitiveType primitiveType) {
|
||||
return primitiveTypeToJetType.get(primitiveType);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetType getIntType() {
|
||||
initStdClasses();
|
||||
return intType;
|
||||
return getPrimitiveJetType(PrimitiveType.INT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetType getLongType() {
|
||||
initStdClasses();
|
||||
return longType;
|
||||
return getPrimitiveJetType(PrimitiveType.LONG);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetType getDoubleType() {
|
||||
initStdClasses();
|
||||
return doubleType;
|
||||
return getPrimitiveJetType(PrimitiveType.DOUBLE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetType getFloatType() {
|
||||
initStdClasses();
|
||||
return floatType;
|
||||
return getPrimitiveJetType(PrimitiveType.FLOAT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetType getCharType() {
|
||||
initStdClasses();
|
||||
return charType;
|
||||
return getPrimitiveJetType(PrimitiveType.CHAR);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetType getBooleanType() {
|
||||
initStdClasses();
|
||||
return booleanType;
|
||||
return getPrimitiveJetType(PrimitiveType.BOOLEAN);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -382,14 +310,12 @@ public class JetStandardLibrary {
|
||||
|
||||
@NotNull
|
||||
public JetType getByteType() {
|
||||
initStdClasses();
|
||||
return byteType;
|
||||
return getPrimitiveJetType(PrimitiveType.BYTE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetType getShortType() {
|
||||
initStdClasses();
|
||||
return shortType;
|
||||
return getPrimitiveJetType(PrimitiveType.SHORT);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -431,168 +357,42 @@ public class JetStandardLibrary {
|
||||
return nullableStringType;
|
||||
}
|
||||
|
||||
public JetType getNullableByteType() {
|
||||
@NotNull
|
||||
public JetType getNullablePrimitiveJetType(PrimitiveType primitiveType) {
|
||||
initStdClasses();
|
||||
return nullableByteType;
|
||||
}
|
||||
|
||||
public JetType getNullableCharType() {
|
||||
initStdClasses();
|
||||
return nullableCharType;
|
||||
}
|
||||
|
||||
public JetType getNullableShortType() {
|
||||
initStdClasses();
|
||||
return nullableShortType;
|
||||
}
|
||||
|
||||
public JetType getNullableIntType() {
|
||||
initStdClasses();
|
||||
return nullableIntType;
|
||||
}
|
||||
|
||||
public JetType getNullableLongType() {
|
||||
initStdClasses();
|
||||
return nullableLongType;
|
||||
}
|
||||
|
||||
public JetType getNullableFloatType() {
|
||||
initStdClasses();
|
||||
return nullableFloatType;
|
||||
}
|
||||
|
||||
public JetType getNullableDoubleType() {
|
||||
initStdClasses();
|
||||
return nullableDoubleType;
|
||||
}
|
||||
|
||||
public JetType getNullableBooleanType() {
|
||||
initStdClasses();
|
||||
return nullableBooleanType;
|
||||
return primitiveTypeToNullableJetType.get(primitiveType);
|
||||
}
|
||||
|
||||
public JetType getNullableTuple0Type() {
|
||||
initStdClasses();
|
||||
return nullableTuple0Type;
|
||||
}
|
||||
|
||||
public JetType getBooleanArrayType() {
|
||||
initStdClasses();
|
||||
return booleanArrayType;
|
||||
}
|
||||
|
||||
public JetType getByteArrayType() {
|
||||
initStdClasses();
|
||||
return byteArrayType;
|
||||
}
|
||||
|
||||
public JetType getCharArrayType() {
|
||||
initStdClasses();
|
||||
return charArrayType;
|
||||
}
|
||||
|
||||
public JetType getShortArrayType() {
|
||||
initStdClasses();
|
||||
return shortArrayType;
|
||||
}
|
||||
|
||||
public JetType getIntArrayType() {
|
||||
initStdClasses();
|
||||
return intArrayType;
|
||||
}
|
||||
|
||||
public JetType getLongArrayType() {
|
||||
initStdClasses();
|
||||
return longArrayType;
|
||||
}
|
||||
|
||||
public JetType getFloatArrayType() {
|
||||
initStdClasses();
|
||||
return floatArrayType;
|
||||
}
|
||||
|
||||
public JetType getDoubleArrayType() {
|
||||
initStdClasses();
|
||||
return doubleArrayType;
|
||||
}
|
||||
|
||||
public JetType getPrimitiveArrayType(JetType jetType) {
|
||||
if (jetType.equals(getIntType())) {
|
||||
return getIntArrayType();
|
||||
} else {
|
||||
throw new IllegalStateException("not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
public ClassDescriptor getByteArrayClass() {
|
||||
@NotNull
|
||||
public JetType getPrimitiveArrayJetType(PrimitiveType primitiveType) {
|
||||
initStdClasses();
|
||||
return byteArrayClass;
|
||||
return primitiveTypeToArrayJetType.get(primitiveType);
|
||||
}
|
||||
|
||||
public ClassDescriptor getCharArrayClass() {
|
||||
/**
|
||||
* @return <code>null</code> if not primitive
|
||||
*/
|
||||
@Nullable
|
||||
public JetType getPrimitiveArrayJetTypeByPrimitiveJetType(JetType jetType) {
|
||||
return primitiveJetTypeToJetArrayType.get(jetType);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ClassDescriptor getPrimitiveArrayClassDescriptor(PrimitiveType primitiveType) {
|
||||
initStdClasses();
|
||||
return charArrayClass;
|
||||
return primitiveTypeToArrayClass.get(primitiveType);
|
||||
}
|
||||
|
||||
public ClassDescriptor getShortArrayClass() {
|
||||
|
||||
@NotNull
|
||||
public JetType getNullablePrimitiveArrayJetType(PrimitiveType primitiveType) {
|
||||
initStdClasses();
|
||||
return shortArrayClass;
|
||||
return primitiveTypeToNullableArrayJetType.get(primitiveType);
|
||||
}
|
||||
|
||||
public ClassDescriptor getIntArrayClass() {
|
||||
initStdClasses();
|
||||
return intArrayClass;
|
||||
}
|
||||
|
||||
public ClassDescriptor getLongArrayClass() {
|
||||
initStdClasses();
|
||||
return longArrayClass;
|
||||
}
|
||||
|
||||
public ClassDescriptor getFloatArrayClass() {
|
||||
initStdClasses();
|
||||
return floatArrayClass;
|
||||
}
|
||||
|
||||
public ClassDescriptor getDoubleArrayClass() {
|
||||
initStdClasses();
|
||||
return doubleArrayClass;
|
||||
}
|
||||
|
||||
public ClassDescriptor getBooleanArrayClass() {
|
||||
initStdClasses();
|
||||
return booleanArrayClass;
|
||||
}
|
||||
|
||||
public JetType getNullableByteArrayType() {
|
||||
return nullableByteArrayType;
|
||||
}
|
||||
|
||||
public JetType getNullableCharArrayType() {
|
||||
return nullableCharArrayType;
|
||||
}
|
||||
|
||||
public JetType getNullableShortArrayType() {
|
||||
return nullableShortArrayType;
|
||||
}
|
||||
|
||||
public JetType getNullableIntArrayType() {
|
||||
return nullableIntArrayType;
|
||||
}
|
||||
|
||||
public JetType getNullableLongArrayType() {
|
||||
return nullableLongArrayType;
|
||||
}
|
||||
|
||||
public JetType getNullableFloatArrayType() {
|
||||
return nullableFloatArrayType;
|
||||
}
|
||||
|
||||
public JetType getNullableDoubleArrayType() {
|
||||
return nullableDoubleArrayType;
|
||||
}
|
||||
|
||||
public JetType getNullableBooleanArrayType() {
|
||||
return nullableBooleanArrayType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.jetbrains.jet.lang.types;
|
||||
|
||||
/**
|
||||
* @author Stepan Koltsov
|
||||
*/
|
||||
public enum PrimitiveType {
|
||||
|
||||
BOOLEAN("Boolean"),
|
||||
CHAR("Char"),
|
||||
BYTE("Byte"),
|
||||
SHORT("Short"),
|
||||
INT("Int"),
|
||||
FLOAT("Float"),
|
||||
LONG("Long"),
|
||||
DOUBLE("Double"),
|
||||
;
|
||||
|
||||
private final String typeName;
|
||||
private final String arrayTypeName;
|
||||
|
||||
private PrimitiveType(String typeName) {
|
||||
this.typeName = typeName;
|
||||
this.arrayTypeName = typeName + "Array";
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public String getArrayTypeName() {
|
||||
return arrayTypeName;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -68,7 +68,7 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
JetType expectedType = context.expectedType;
|
||||
boolean functionTypeExpected = expectedType != TypeUtils.NO_EXPECTED_TYPE && JetStandardClasses.isFunctionType(expectedType);
|
||||
|
||||
FunctionDescriptorImpl functionDescriptor = createFunctionDescriptor(expression, context, functionTypeExpected);
|
||||
NamedFunctionDescriptorImpl functionDescriptor = createFunctionDescriptor(expression, context, functionTypeExpected);
|
||||
|
||||
List<JetType> parameterTypes = Lists.newArrayList();
|
||||
List<ValueParameterDescriptor> valueParameters = functionDescriptor.getValueParameters();
|
||||
@@ -108,10 +108,10 @@ public class ClosureExpressionsTypingVisitor extends ExpressionTypingVisitor {
|
||||
return DataFlowUtils.checkType(JetStandardClasses.getFunctionType(Collections.<AnnotationDescriptor>emptyList(), receiver, parameterTypes, safeReturnType), expression, context);
|
||||
}
|
||||
|
||||
private FunctionDescriptorImpl createFunctionDescriptor(JetFunctionLiteralExpression expression, ExpressionTypingContext context, boolean functionTypeExpected) {
|
||||
private NamedFunctionDescriptorImpl createFunctionDescriptor(JetFunctionLiteralExpression expression, ExpressionTypingContext context, boolean functionTypeExpected) {
|
||||
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||
JetTypeReference receiverTypeRef = functionLiteral.getReceiverTypeRef();
|
||||
FunctionDescriptorImpl functionDescriptor = new FunctionDescriptorImpl(
|
||||
NamedFunctionDescriptorImpl functionDescriptor = new NamedFunctionDescriptorImpl(
|
||||
context.scope.getContainingDeclaration(), Collections.<AnnotationDescriptor>emptyList(), "<anonymous>");
|
||||
|
||||
List<ValueParameterDescriptor> valueParameterDescriptors = createValueParameterDescriptors(context, functionLiteral, functionDescriptor, functionTypeExpected);
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
|
||||
@Override
|
||||
public JetType visitNamedFunction(JetNamedFunction function, ExpressionTypingContext context) {
|
||||
FunctionDescriptorImpl functionDescriptor = context.getDescriptorResolver().resolveFunctionDescriptor(scope.getContainingDeclaration(), scope, function);
|
||||
NamedFunctionDescriptor functionDescriptor = context.getDescriptorResolver().resolveFunctionDescriptor(scope.getContainingDeclaration(), scope, function);
|
||||
scope.addFunctionDescriptor(functionDescriptor);
|
||||
JetScope functionInnerScope = FunctionDescriptorUtil.getFunctionInnerScope(context.scope, functionDescriptor, context.trace);
|
||||
context.getServices().checkFunctionReturnType(functionInnerScope, function, functionDescriptor, context.dataFlowInfo);
|
||||
|
||||
@@ -162,7 +162,7 @@ LONG_TEMPLATE_ENTRY_END=\}
|
||||
{RAW_STRING_LITERAL} { return JetTokens.RAW_STRING_LITERAL; }
|
||||
|
||||
"continue" { return JetTokens.CONTINUE_KEYWORD ;}
|
||||
"package" { return JetTokens.NAMESPACE_KEYWORD ;}
|
||||
"package" { return JetTokens.PACKAGE_KEYWORD ;}
|
||||
"return" { return JetTokens.RETURN_KEYWORD ;}
|
||||
"object" { return JetTokens.OBJECT_KEYWORD ;}
|
||||
"while" { return JetTokens.WHILE_KEYWORD ;}
|
||||
|
||||
@@ -31,7 +31,7 @@ public interface JetTokens {
|
||||
|
||||
JetToken RAW_STRING_LITERAL = new JetToken("RAW_STRING_LITERAL");
|
||||
|
||||
JetKeywordToken NAMESPACE_KEYWORD = JetKeywordToken.keyword("namespace");
|
||||
JetKeywordToken PACKAGE_KEYWORD = JetKeywordToken.keyword("package");
|
||||
JetKeywordToken AS_KEYWORD = JetKeywordToken.keyword("as");
|
||||
JetKeywordToken TYPE_KEYWORD = JetKeywordToken.keyword("type");
|
||||
JetKeywordToken CLASS_KEYWORD = JetKeywordToken.keyword("class");
|
||||
@@ -145,7 +145,7 @@ public interface JetTokens {
|
||||
// TODO: support this as an annotation on arguments. Then, they it probably can not be a soft keyword
|
||||
JetKeywordToken REF_KEYWORD = JetKeywordToken.softKeyword("ref");
|
||||
|
||||
TokenSet KEYWORDS = TokenSet.create(NAMESPACE_KEYWORD, AS_KEYWORD, TYPE_KEYWORD, CLASS_KEYWORD, TRAIT_KEYWORD,
|
||||
TokenSet KEYWORDS = TokenSet.create(PACKAGE_KEYWORD, AS_KEYWORD, TYPE_KEYWORD, CLASS_KEYWORD, TRAIT_KEYWORD,
|
||||
THIS_KEYWORD, SUPER_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, FUN_KEYWORD, FOR_KEYWORD,
|
||||
NULL_KEYWORD,
|
||||
TRUE_KEYWORD, FALSE_KEYWORD, IS_KEYWORD,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* The following code was generated by JFlex 1.4.3 on 12/25/11 2:36 PM */
|
||||
/* The following code was generated by JFlex 1.4.3 on 1/12/12 7:11 PM */
|
||||
|
||||
package org.jetbrains.jet.lexer;
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.jet.lexer.JetTokens;
|
||||
/**
|
||||
* This class is a scanner generated by
|
||||
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
|
||||
* on 12/25/11 2:36 PM from the specification file
|
||||
* on 1/12/12 7:11 PM from the specification file
|
||||
* <tt>/Users/abreslav/work/jet/compiler/frontend/src/org/jetbrains/jet/lexer/Jet.flex</tt>
|
||||
*/
|
||||
class _JetLexer implements FlexLexer {
|
||||
@@ -1006,77 +1006,77 @@ class _JetLexer implements FlexLexer {
|
||||
{ return JetTokens.MINUSEQ ;
|
||||
}
|
||||
case 138: break;
|
||||
case 96:
|
||||
{ return JetTokens.PACKAGE_KEYWORD ;
|
||||
}
|
||||
case 139: break;
|
||||
case 87:
|
||||
{ return JetTokens.THROW_KEYWORD ;
|
||||
}
|
||||
case 139: break;
|
||||
case 140: break;
|
||||
case 89:
|
||||
{ return JetTokens.SUPER_KEYWORD ;
|
||||
}
|
||||
case 140: break;
|
||||
case 141: break;
|
||||
case 92:
|
||||
{ return JetTokens.WHILE_KEYWORD ;
|
||||
}
|
||||
case 141: break;
|
||||
case 142: break;
|
||||
case 44:
|
||||
{ return JetTokens.MINUSMINUS;
|
||||
}
|
||||
case 142: break;
|
||||
case 143: break;
|
||||
case 97:
|
||||
{ return JetTokens.CONTINUE_KEYWORD ;
|
||||
}
|
||||
case 143: break;
|
||||
case 144: break;
|
||||
case 75:
|
||||
{ return JetTokens.NOT_IN;
|
||||
}
|
||||
case 144: break;
|
||||
case 145: break;
|
||||
case 38:
|
||||
{ return JetTokens.ATAT ;
|
||||
}
|
||||
case 145: break;
|
||||
case 146: break;
|
||||
case 6:
|
||||
{ return JetTokens.DIV ;
|
||||
}
|
||||
case 146: break;
|
||||
case 147: break;
|
||||
case 37:
|
||||
{ return JetTokens.LABEL_IDENTIFIER;
|
||||
}
|
||||
case 147: break;
|
||||
case 148: break;
|
||||
case 29:
|
||||
{ return JetTokens.REGULAR_STRING_PART;
|
||||
}
|
||||
case 148: break;
|
||||
case 149: break;
|
||||
case 16:
|
||||
{ return JetTokens.QUEST ;
|
||||
}
|
||||
case 149: break;
|
||||
case 150: break;
|
||||
case 60:
|
||||
{ return JetTokens.OROR ;
|
||||
}
|
||||
case 150: break;
|
||||
case 151: break;
|
||||
case 20:
|
||||
{ return JetTokens.PERC ;
|
||||
}
|
||||
case 151: break;
|
||||
case 152: break;
|
||||
case 76:
|
||||
{ return JetTokens.EXCLEQEQEQ;
|
||||
}
|
||||
case 152: break;
|
||||
case 153: break;
|
||||
case 61:
|
||||
{ return JetTokens.PERCEQ ;
|
||||
}
|
||||
case 153: break;
|
||||
case 154: break;
|
||||
case 43:
|
||||
{ return JetTokens.RANGE ;
|
||||
}
|
||||
case 154: break;
|
||||
case 155: break;
|
||||
case 1:
|
||||
{ return TokenType.BAD_CHARACTER;
|
||||
}
|
||||
case 155: break;
|
||||
case 96:
|
||||
{ return JetTokens.NAMESPACE_KEYWORD ;
|
||||
}
|
||||
case 156: break;
|
||||
case 74:
|
||||
{ return JetTokens.NOT_IS;
|
||||
|
||||
@@ -258,7 +258,7 @@ public class DescriptorRenderer implements Renderer {
|
||||
|
||||
@Override
|
||||
public Void visitNamespaceDescriptor(NamespaceDescriptor namespaceDescriptor, StringBuilder builder) {
|
||||
builder.append(renderKeyword(JetTokens.NAMESPACE_KEYWORD.getValue())).append(" ");
|
||||
builder.append(renderKeyword(JetTokens.PACKAGE_KEYWORD.getValue())).append(" ");
|
||||
renderName(namespaceDescriptor, builder);
|
||||
return super.visitNamespaceDescriptor(namespaceDescriptor, builder);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user