Dropped KtTypedef

This commit is contained in:
Valentin Kipyatkov
2016-01-19 15:56:25 +03:00
parent 808c7453a4
commit 59fb90a5ee
11 changed files with 3 additions and 91 deletions
@@ -1,46 +0,0 @@
/*
* Copyright 2010-2015 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.kotlin.psi;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.KtNodeTypes;
import org.jetbrains.kotlin.name.FqName;
public class KtTypedef extends KtTypeParameterListOwnerNotStubbed {
public KtTypedef(@NotNull ASTNode node) {
super(node);
}
@Override
public <R, D> R accept(@NotNull KtVisitor<R, D> visitor, D data) {
return visitor.visitTypedef(this, data);
}
@Nullable @IfNotParsed
public KtTypeReference getTypeReference() {
return (KtTypeReference) findChildByType(KtNodeTypes.TYPE_REFERENCE);
}
@Nullable
@Override
public FqName getFqName() {
//TODO: typedefs are unsupported
return null;
}
}
@@ -65,10 +65,6 @@ public class KtVisitor<R, D> extends PsiElementVisitor {
return visitNamedDeclaration(multiDeclarationEntry, data);
}
public R visitTypedef(@NotNull KtTypedef typedef, D data) {
return visitNamedDeclaration(typedef, data);
}
public R visitKtFile(@NotNull KtFile file, D data) {
visitFile(file);
return null;
@@ -61,10 +61,6 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
super.visitDestructuringDeclarationEntry(multiDeclarationEntry, null);
}
public void visitTypedef(@NotNull KtTypedef typedef) {
super.visitTypedef(typedef, null);
}
public void visitKtFile(@NotNull KtFile file) {
super.visitKtFile(file, null);
}
@@ -494,12 +490,6 @@ public class KtVisitorVoid extends KtVisitor<Void, Void> {
return null;
}
@Override
public final Void visitTypedef(@NotNull KtTypedef typedef, Void data) {
visitTypedef(typedef);
return null;
}
@Override
public final Void visitKtFile(@NotNull KtFile file, Void data) {
visitKtFile(file);
@@ -58,10 +58,6 @@ public class KtVisitorVoidWithParameter<P> extends KtVisitor<Void, P> {
super.visitDestructuringDeclarationEntry(multiDeclarationEntry, data);
}
public void visitTypedefVoid(@NotNull KtTypedef typedef, P data) {
super.visitTypedef(typedef, data);
}
public void visitJetFileVoid(@NotNull KtFile file, P data) {
super.visitKtFile(file, data);
}
@@ -467,12 +463,6 @@ public class KtVisitorVoidWithParameter<P> extends KtVisitor<Void, P> {
return null;
}
@Override
public final Void visitTypedef(@NotNull KtTypedef typedef, P data) {
visitTypedefVoid(typedef, data);
return null;
}
@Override
public final Void visitKtFile(@NotNull KtFile file, P data) {
visitJetFileVoid(file, data);
@@ -158,10 +158,6 @@ class LazyTopDownAnalyzer(
c.anonymousInitializers.put(initializer, containerDescriptor)
}
override fun visitTypedef(typedef: KtTypedef) {
trace.report(UNSUPPORTED.on(typedef, "Typedefs are not supported"))
}
override fun visitDestructuringDeclaration(destructuringDeclaration: KtDestructuringDeclaration) {
// Ignore: multi-declarations are only allowed locally
}
@@ -54,7 +54,7 @@ abstract class AbstractPsiBasedDeclarationProvider(storageManager: StorageManage
val scriptInfo = KtScriptInfo(declaration)
classesAndObjects.put(scriptInfo.script.nameAsName, scriptInfo)
}
else if (declaration is KtParameter || declaration is KtTypedef || declaration is KtDestructuringDeclaration) {
else if (declaration is KtParameter || declaration is KtDestructuringDeclaration) {
// Do nothing, just put it into allDeclarations is enough
}
else {
@@ -159,9 +159,8 @@ protected constructor(
result.addAll(classDescriptors(name))
}
}
else if (declaration is KtTypedef || declaration is KtDestructuringDeclaration) {
// Do nothing for typedefs as they are not supported.
// MultiDeclarations are not supported on global level too.
else if (declaration is KtDestructuringDeclaration) {
// MultiDeclarations are not supported on global level
}
else {
throw IllegalArgumentException("Unsupported declaration kind: " + declaration)
@@ -146,12 +146,6 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(klass, context), context);
}
@Override
public KotlinTypeInfo visitTypedef(@NotNull KtTypedef typedef, ExpressionTypingContext context) {
context.trace.report(UNSUPPORTED.on(typedef, "Typedefs are not supported"));
return super.visitTypedef(typedef, context);
}
@Override
public KotlinTypeInfo visitDeclaration(@NotNull KtDeclaration dcl, ExpressionTypingContext context) {
return TypeInfoFactoryKt.createTypeInfo(components.dataFlowAnalyzer.checkStatementType(dcl, context), context);