Refactor stubs:
Convert all interface classes to kotlin and move them into one file Convert some of Impl classes Fix typo: hasValOrValNode Extract ModifierMaskUtils Minors
This commit is contained in:
@@ -107,7 +107,7 @@ public class JetParameter extends JetNamedDeclarationStub<KotlinParameterStub> i
|
||||
public boolean hasValOrVarNode() {
|
||||
KotlinParameterStub stub = getStub();
|
||||
if (stub != null) {
|
||||
return stub.hasValOrValNode();
|
||||
return stub.hasValOrVarNode();
|
||||
}
|
||||
return getValOrVarNode() != null;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class JetParameter extends JetNamedDeclarationStub<KotlinParameterStub> i
|
||||
@Nullable
|
||||
public ASTNode getValOrVarNode() {
|
||||
KotlinParameterStub stub = getStub();
|
||||
if (stub != null && !stub.hasValOrValNode()) {
|
||||
if (stub != null && !stub.hasValOrVarNode()) {
|
||||
return null;
|
||||
}
|
||||
ASTNode val = getNode().findChildByType(JetTokens.VAL_KEYWORD);
|
||||
|
||||
@@ -1,28 +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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetAnnotationEntry;
|
||||
|
||||
public interface KotlinAnnotationEntryStub extends StubElement<JetAnnotationEntry> {
|
||||
@NotNull
|
||||
String getShortName();
|
||||
|
||||
boolean hasValueArguments();
|
||||
}
|
||||
@@ -1,31 +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.psi.stubs;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface KotlinClassOrObjectStub<T extends JetClassOrObject> extends KotlinStubWithFqName<T> {
|
||||
boolean isLocal();
|
||||
|
||||
@NotNull
|
||||
List<String> getSuperNames();
|
||||
|
||||
boolean isTopLevel();
|
||||
}
|
||||
@@ -1,25 +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.psi.stubs;
|
||||
|
||||
import org.jetbrains.jet.lang.psi.JetClass;
|
||||
|
||||
public interface KotlinClassStub extends KotlinClassOrObjectStub<JetClass> {
|
||||
boolean isTrait();
|
||||
|
||||
boolean isEnumEntry();
|
||||
}
|
||||
@@ -1,28 +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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.PsiFileStub;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
public interface KotlinFileStub extends PsiFileStub<JetFile> {
|
||||
@NotNull
|
||||
FqName getPackageFqName();
|
||||
boolean isScript();
|
||||
}
|
||||
@@ -1,33 +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.psi.stubs;
|
||||
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
|
||||
public interface KotlinFunctionStub extends KotlinStubWithFqName<JetNamedFunction> {
|
||||
boolean isTopLevel();
|
||||
|
||||
boolean isExtension();
|
||||
|
||||
boolean hasBlockBody();
|
||||
|
||||
boolean hasBody();
|
||||
|
||||
boolean hasTypeParameterListBeforeFunctionName();
|
||||
|
||||
boolean isProbablyNothingType();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetModifierList;
|
||||
import org.jetbrains.jet.lexer.JetModifierKeywordToken;
|
||||
|
||||
public interface KotlinModifierListStub extends StubElement<JetModifierList> {
|
||||
boolean hasModifier(@NotNull JetModifierKeywordToken modifierToken);
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetNameReferenceExpression;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
public interface KotlinNameReferenceExpressionStub extends StubElement<JetNameReferenceExpression> {
|
||||
@NotNull
|
||||
String getReferencedName();
|
||||
}
|
||||
@@ -1,24 +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.psi.stubs;
|
||||
|
||||
import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
|
||||
|
||||
public interface KotlinObjectStub extends KotlinClassOrObjectStub<JetObjectDeclaration> {
|
||||
boolean isClassObject();
|
||||
boolean isObjectLiteral();
|
||||
}
|
||||
@@ -1,25 +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.psi.stubs;
|
||||
|
||||
import org.jetbrains.jet.lang.psi.JetParameter;
|
||||
|
||||
public interface KotlinParameterStub extends KotlinStubWithFqName<JetParameter> {
|
||||
boolean isMutable();
|
||||
boolean hasValOrValNode();
|
||||
boolean hasDefaultValue();
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.jet.lang.psi.JetElement;
|
||||
|
||||
public interface KotlinPlaceHolderStub<T extends JetElement> extends StubElement<T> {
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.jet.lang.psi.JetPropertyAccessor;
|
||||
|
||||
public interface KotlinPropertyAccessorStub extends StubElement<JetPropertyAccessor> {
|
||||
boolean isGetter();
|
||||
boolean hasBody();
|
||||
boolean hasBlockBody();
|
||||
}
|
||||
@@ -1,31 +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.psi.stubs;
|
||||
|
||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
|
||||
public interface KotlinPropertyStub extends KotlinStubWithFqName<JetProperty> {
|
||||
boolean isVar();
|
||||
boolean isTopLevel();
|
||||
boolean hasDelegate();
|
||||
boolean hasDelegateExpression();
|
||||
boolean hasInitializer();
|
||||
boolean hasReceiverTypeRef();
|
||||
boolean hasReturnTypeRef();
|
||||
|
||||
boolean isProbablyNothingType();
|
||||
}
|
||||
@@ -1,27 +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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.psi.stubs.NamedStub;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
public interface KotlinStubWithFqName<T extends PsiNamedElement> extends NamedStub<T> {
|
||||
@Nullable
|
||||
FqName getFqName();
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.jet.lang.psi.JetTypeConstraint;
|
||||
|
||||
public interface KotlinTypeConstraintStub extends StubElement<JetTypeConstraint> {
|
||||
boolean isClassObjectConstraint();
|
||||
}
|
||||
@@ -1,24 +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.psi.stubs;
|
||||
|
||||
import org.jetbrains.jet.lang.psi.JetTypeParameter;
|
||||
|
||||
public interface KotlinTypeParameterStub extends KotlinStubWithFqName<JetTypeParameter> {
|
||||
boolean isInVariance();
|
||||
boolean isOutVariance();
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.jet.lang.psi.JetProjectionKind;
|
||||
import org.jetbrains.jet.lang.psi.JetTypeProjection;
|
||||
|
||||
public interface KotlinTypeProjectionStub extends StubElement<JetTypeProjection> {
|
||||
JetProjectionKind getProjectionKind();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetUserType;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
public interface KotlinUserTypeStub extends StubElement<JetUserType> {
|
||||
boolean isAbsoluteInRootPackage();
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs
|
||||
|
||||
import com.intellij.psi.PsiNamedElement
|
||||
import com.intellij.psi.stubs.NamedStub
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.psi.stubs.PsiFileStub
|
||||
import org.jetbrains.jet.lexer.JetModifierKeywordToken
|
||||
import org.jetbrains.jet.lang.psi.*
|
||||
|
||||
public trait KotlinFileStub : PsiFileStub<JetFile> {
|
||||
public fun getPackageFqName(): FqName
|
||||
public fun isScript(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinPlaceHolderStub<T : JetElement> : StubElement<T>
|
||||
|
||||
public trait KotlinStubWithFqName<T : PsiNamedElement> : NamedStub<T> {
|
||||
public fun getFqName(): FqName?
|
||||
}
|
||||
|
||||
public trait KotlinClassOrObjectStub<T : JetClassOrObject> : KotlinStubWithFqName<T> {
|
||||
public fun isLocal(): Boolean
|
||||
public fun getSuperNames(): List<String>
|
||||
public fun isTopLevel(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinClassStub : KotlinClassOrObjectStub<JetClass> {
|
||||
public fun isTrait(): Boolean
|
||||
public fun isEnumEntry(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinObjectStub : KotlinClassOrObjectStub<JetObjectDeclaration> {
|
||||
public fun isClassObject(): Boolean
|
||||
public fun isObjectLiteral(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinAnnotationEntryStub : StubElement<JetAnnotationEntry> {
|
||||
public fun getShortName(): String
|
||||
public fun hasValueArguments(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinFunctionStub : KotlinStubWithFqName<JetNamedFunction> {
|
||||
public fun isTopLevel(): Boolean
|
||||
public fun isExtension(): Boolean
|
||||
public fun hasBlockBody(): Boolean
|
||||
public fun hasBody(): Boolean
|
||||
public fun hasTypeParameterListBeforeFunctionName(): Boolean
|
||||
public fun isProbablyNothingType(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinImportDirectiveStub : StubElement<JetImportDirective> {
|
||||
public fun isAbsoluteInRootPackage(): Boolean
|
||||
public fun isAllUnder(): Boolean
|
||||
public fun getAliasName(): String?
|
||||
public fun isValid(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinModifierListStub : StubElement<JetModifierList> {
|
||||
public fun hasModifier(modifierToken: JetModifierKeywordToken): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinNameReferenceExpressionStub : StubElement<JetNameReferenceExpression> {
|
||||
public fun getReferencedName(): String
|
||||
}
|
||||
|
||||
public trait KotlinParameterStub : KotlinStubWithFqName<JetParameter> {
|
||||
public fun isMutable(): Boolean
|
||||
public fun hasValOrVarNode(): Boolean
|
||||
public fun hasDefaultValue(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinPropertyAccessorStub : StubElement<JetPropertyAccessor> {
|
||||
public fun isGetter(): Boolean
|
||||
public fun hasBody(): Boolean
|
||||
public fun hasBlockBody(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinPropertyStub : KotlinStubWithFqName<JetProperty> {
|
||||
public fun isVar(): Boolean
|
||||
public fun isTopLevel(): Boolean
|
||||
public fun hasDelegate(): Boolean
|
||||
public fun hasDelegateExpression(): Boolean
|
||||
public fun hasInitializer(): Boolean
|
||||
public fun hasReceiverTypeRef(): Boolean
|
||||
public fun hasReturnTypeRef(): Boolean
|
||||
public fun isProbablyNothingType(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinTypeConstraintStub : StubElement<JetTypeConstraint> {
|
||||
public fun isClassObjectConstraint(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinTypeParameterStub : KotlinStubWithFqName<JetTypeParameter> {
|
||||
public fun isInVariance(): Boolean
|
||||
public fun isOutVariance(): Boolean
|
||||
}
|
||||
|
||||
public trait KotlinTypeProjectionStub : StubElement<JetTypeProjection> {
|
||||
public fun getProjectionKind(): JetProjectionKind
|
||||
}
|
||||
|
||||
public trait KotlinUserTypeStub : StubElement<JetUserType> {
|
||||
public fun isAbsoluteInRootPackage(): Boolean
|
||||
}
|
||||
+2
-2
@@ -27,7 +27,7 @@ import org.jetbrains.jet.lang.psi.stubs.impl.KotlinModifierListStubImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.jetbrains.jet.lang.psi.stubs.impl.KotlinModifierListStubImpl.computeMaskFromPsi;
|
||||
import static org.jetbrains.jet.lang.psi.stubs.impl.ModifierMaskUtils.computeMaskFromModifierList;
|
||||
|
||||
public class JetModifierListElementType<T extends JetModifierList> extends JetStubElementType<KotlinModifierListStub, T> {
|
||||
public JetModifierListElementType(@NotNull @NonNls String debugName, @NotNull Class<T> psiClass) {
|
||||
@@ -36,7 +36,7 @@ public class JetModifierListElementType<T extends JetModifierList> extends JetSt
|
||||
|
||||
@Override
|
||||
public KotlinModifierListStub createStub(@NotNull T psi, StubElement parentStub) {
|
||||
return new KotlinModifierListStubImpl(parentStub, computeMaskFromPsi(psi), this);
|
||||
return new KotlinModifierListStubImpl(parentStub, computeMaskFromModifierList(psi), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class JetParameterElementType extends JetStubElementType<KotlinParameterS
|
||||
public void serialize(@NotNull KotlinParameterStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
dataStream.writeName(stub.getName());
|
||||
dataStream.writeBoolean(stub.isMutable());
|
||||
dataStream.writeBoolean(stub.hasValOrValNode());
|
||||
dataStream.writeBoolean(stub.hasValOrVarNode());
|
||||
dataStream.writeBoolean(stub.hasDefaultValue());
|
||||
FqName name = stub.getFqName();
|
||||
dataStream.writeName(name != null ? name.asString() : null);
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetTypeConstraint;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinTypeConstraintStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.impl.KotlinTypeConstraintImpl;
|
||||
import org.jetbrains.jet.lang.psi.stubs.impl.KotlinTypeConstraintStubImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class JetTypeConstraintElementType extends JetStubElementType<KotlinTypeC
|
||||
|
||||
@Override
|
||||
public KotlinTypeConstraintStub createStub(@NotNull JetTypeConstraint psi, StubElement parentStub) {
|
||||
return new KotlinTypeConstraintImpl(parentStub, psi.isClassObjectConstraint());
|
||||
return new KotlinTypeConstraintStubImpl(parentStub, psi.isClassObjectConstraint());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,6 +46,6 @@ public class JetTypeConstraintElementType extends JetStubElementType<KotlinTypeC
|
||||
@Override
|
||||
public KotlinTypeConstraintStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
boolean isClassObjectConstraint = dataStream.readBoolean();
|
||||
return new KotlinTypeConstraintImpl(parentStub, isClassObjectConstraint);
|
||||
return new KotlinTypeConstraintStubImpl(parentStub, isClassObjectConstraint);
|
||||
}
|
||||
}
|
||||
|
||||
-46
@@ -1,46 +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.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetAnnotationEntry;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinAnnotationEntryStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
|
||||
public class KotlinAnnotationEntryStubImpl extends KotlinStubBaseImpl<JetAnnotationEntry> implements KotlinAnnotationEntryStub {
|
||||
private final StringRef shortName;
|
||||
private final boolean hasValueArguments;
|
||||
|
||||
public KotlinAnnotationEntryStubImpl(StubElement parent, @NotNull StringRef shortName, boolean hasValueArguments) {
|
||||
super(parent, JetStubElementTypes.ANNOTATION_ENTRY);
|
||||
this.shortName = shortName;
|
||||
this.hasValueArguments = hasValueArguments;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getShortName() {
|
||||
return shortName.getString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValueArguments() {
|
||||
return hasValueArguments;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.jet.lang.psi.JetAnnotationEntry
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinAnnotationEntryStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinAnnotationEntryStubImpl(
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val shortName: StringRef,
|
||||
private val hasValueArguments: Boolean
|
||||
) : KotlinStubBaseImpl<JetAnnotationEntry>(parent, JetStubElementTypes.ANNOTATION_ENTRY), KotlinAnnotationEntryStub {
|
||||
|
||||
override fun getShortName() = shortName.getString()
|
||||
|
||||
override fun hasValueArguments() = hasValueArguments
|
||||
}
|
||||
@@ -1,103 +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.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetClass;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinClassStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetClassElementType;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class KotlinClassStubImpl extends KotlinStubBaseImpl<JetClass> implements KotlinClassStub {
|
||||
private final StringRef qualifiedName;
|
||||
private final StringRef name;
|
||||
private final StringRef[] superNames;
|
||||
private final boolean isTrait;
|
||||
private final boolean isEnumEntry;
|
||||
private final boolean isLocal;
|
||||
private final boolean isTopLevel;
|
||||
|
||||
public KotlinClassStubImpl(
|
||||
JetClassElementType type,
|
||||
StubElement parent,
|
||||
StringRef qualifiedName,
|
||||
StringRef name,
|
||||
StringRef[] superNames,
|
||||
boolean isTrait,
|
||||
boolean isEnumEntry,
|
||||
boolean isLocal,
|
||||
boolean isTopLevel
|
||||
) {
|
||||
super(parent, type);
|
||||
this.qualifiedName = qualifiedName;
|
||||
this.name = name;
|
||||
this.superNames = superNames;
|
||||
this.isTrait = isTrait;
|
||||
this.isEnumEntry = isEnumEntry;
|
||||
this.isLocal = isLocal;
|
||||
this.isTopLevel = isTopLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FqName getFqName() {
|
||||
String stringRef = StringRef.toString(qualifiedName);
|
||||
if (stringRef == null) {
|
||||
return null;
|
||||
}
|
||||
return new FqName(stringRef);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTrait() {
|
||||
return isTrait;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnumEntry() {
|
||||
return isEnumEntry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return isLocal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringRef.toString(name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getSuperNames() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (StringRef ref : superNames) {
|
||||
result.add(ref.toString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopLevel() {
|
||||
return isTopLevel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.jet.lang.psi.JetClass
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinClassStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetClassElementType
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||
|
||||
import java.util.ArrayList
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinClassStubImpl(
|
||||
type: JetClassElementType,
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val qualifiedName: StringRef?,
|
||||
private val name: StringRef?,
|
||||
private val superNames: Array<StringRef>,
|
||||
private val isTrait: Boolean,
|
||||
private val isEnumEntry: Boolean,
|
||||
private val isLocal: Boolean,
|
||||
private val isTopLevel: Boolean
|
||||
) : KotlinStubBaseImpl<JetClass>(parent, type), KotlinClassStub {
|
||||
|
||||
override fun getFqName(): FqName? {
|
||||
val stringRef = StringRef.toString(qualifiedName)
|
||||
if (stringRef == null) {
|
||||
return null
|
||||
}
|
||||
return FqName(stringRef)
|
||||
}
|
||||
|
||||
override fun isTrait() = isTrait
|
||||
override fun isEnumEntry() = isEnumEntry
|
||||
override fun isLocal() = isLocal
|
||||
override fun getName() = StringRef.toString(name)
|
||||
|
||||
override fun getSuperNames(): List<String> {
|
||||
val result = ArrayList<String>()
|
||||
for (ref in superNames) {
|
||||
result.add(ref.toString())
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun isTopLevel() = isTopLevel
|
||||
}
|
||||
-106
@@ -1,106 +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.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinFunctionStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
public class KotlinFunctionStubImpl extends KotlinStubBaseImpl<JetNamedFunction> implements KotlinFunctionStub {
|
||||
|
||||
private final StringRef nameRef;
|
||||
private final boolean isTopLevel;
|
||||
private final boolean isExtension;
|
||||
private final FqName fqName;
|
||||
private final boolean hasBlockBody;
|
||||
private final boolean hasBody;
|
||||
private final boolean hasTypeParameterListBeforeFunctionName;
|
||||
private final boolean probablyNothingType;
|
||||
|
||||
public KotlinFunctionStubImpl(
|
||||
@NotNull StubElement parent,
|
||||
@Nullable StringRef nameRef,
|
||||
boolean isTopLevel,
|
||||
@Nullable FqName fqName,
|
||||
boolean isExtension,
|
||||
boolean hasBlockBody,
|
||||
boolean hasBody,
|
||||
boolean hasTypeParameterListBeforeFunctionName,
|
||||
boolean probablyNothingType
|
||||
) {
|
||||
super(parent, JetStubElementTypes.FUNCTION);
|
||||
|
||||
if (isTopLevel && fqName == null) {
|
||||
throw new IllegalArgumentException("fqName shouldn't be null for top level functions");
|
||||
}
|
||||
|
||||
this.nameRef = nameRef;
|
||||
this.fqName = fqName;
|
||||
this.isTopLevel = isTopLevel;
|
||||
this.isExtension = isExtension;
|
||||
this.hasBlockBody = hasBlockBody;
|
||||
this.hasBody = hasBody;
|
||||
this.hasTypeParameterListBeforeFunctionName = hasTypeParameterListBeforeFunctionName;
|
||||
this.probablyNothingType = probablyNothingType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringRef.toString(nameRef);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopLevel() {
|
||||
return isTopLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExtension() {
|
||||
return isExtension;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBlockBody() {
|
||||
return hasBlockBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBody() {
|
||||
return hasBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeParameterListBeforeFunctionName() {
|
||||
return hasTypeParameterListBeforeFunctionName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FqName getFqName() {
|
||||
return fqName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProbablyNothingType() {
|
||||
return probablyNothingType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinFunctionStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinFunctionStubImpl(
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val nameRef: StringRef?,
|
||||
private val isTopLevel: Boolean,
|
||||
private val fqName: FqName?,
|
||||
private val isExtension: Boolean,
|
||||
private val hasBlockBody: Boolean,
|
||||
private val hasBody: Boolean,
|
||||
private val hasTypeParameterListBeforeFunctionName: Boolean,
|
||||
private val isProbablyNothingType: Boolean
|
||||
) : KotlinStubBaseImpl<JetNamedFunction>(parent, JetStubElementTypes.FUNCTION), KotlinFunctionStub {
|
||||
{
|
||||
if (isTopLevel && fqName == null) {
|
||||
throw IllegalArgumentException("fqName shouldn't be null for top level functions")
|
||||
}
|
||||
}
|
||||
override fun getFqName() = fqName
|
||||
|
||||
override fun getName() = StringRef.toString(nameRef)
|
||||
override fun isTopLevel() = isTopLevel
|
||||
override fun isExtension() = isExtension
|
||||
override fun hasBlockBody() = hasBlockBody
|
||||
override fun hasBody() = hasBody
|
||||
override fun hasTypeParameterListBeforeFunctionName() = hasTypeParameterListBeforeFunctionName
|
||||
override fun isProbablyNothingType() = isProbablyNothingType
|
||||
}
|
||||
+7
-41
@@ -17,33 +17,14 @@
|
||||
package org.jetbrains.jet.lang.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetModifierList;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinModifierListStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetModifierListElementType;
|
||||
import org.jetbrains.jet.lexer.JetModifierKeywordToken;
|
||||
|
||||
import static org.jetbrains.jet.lexer.JetTokens.MODIFIER_KEYWORDS_ARRAY;
|
||||
|
||||
public class KotlinModifierListStubImpl extends KotlinStubBaseImpl<JetModifierList> implements KotlinModifierListStub {
|
||||
|
||||
static {
|
||||
assert MODIFIER_KEYWORDS_ARRAY.length <= 32 : "Current implementation depends on the ability to represent modifier list as bit mask";
|
||||
}
|
||||
|
||||
public static int computeMaskFromPsi(@NotNull JetModifierList modifierList) {
|
||||
int mask = 0;
|
||||
JetModifierKeywordToken[] orderedKeywords = MODIFIER_KEYWORDS_ARRAY;
|
||||
for (int i = 0; i < orderedKeywords.length; i++) {
|
||||
JetModifierKeywordToken modifierKeywordToken = orderedKeywords[i];
|
||||
if (modifierList.hasModifier(modifierKeywordToken)) {
|
||||
mask |= 1 << i;
|
||||
}
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
private final int mask;
|
||||
|
||||
public KotlinModifierListStubImpl(StubElement parent, int mask, @NotNull JetModifierListElementType<?> elementType) {
|
||||
@@ -51,33 +32,18 @@ public class KotlinModifierListStubImpl extends KotlinStubBaseImpl<JetModifierLi
|
||||
this.mask = mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasModifier(@NotNull JetModifierKeywordToken modifierToken) {
|
||||
int index = ArrayUtil.indexOf(MODIFIER_KEYWORDS_ARRAY, modifierToken);
|
||||
assert index >= 0 : "All JetModifierKeywordTokens should present in MODIFIER_KEYWORDS_ARRAY";
|
||||
return (mask & (1 << index)) != 0;
|
||||
}
|
||||
|
||||
public int getMask() {
|
||||
return mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasModifier(@NotNull JetModifierKeywordToken modifierToken) {
|
||||
return ModifierMaskUtils.maskHasModifier(mask, modifierToken);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(super.toString());
|
||||
sb.append("[");
|
||||
boolean first = true;
|
||||
for (JetModifierKeywordToken modifierKeyword : MODIFIER_KEYWORDS_ARRAY) {
|
||||
if (hasModifier(modifierKeyword)) {
|
||||
if (!first) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(modifierKeyword.getValue());
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
return super.toString() + ModifierMaskUtils.maskToString(mask);
|
||||
}
|
||||
}
|
||||
|
||||
-100
@@ -1,100 +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.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinObjectStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class KotlinObjectStubImpl extends KotlinStubBaseImpl<JetObjectDeclaration> implements KotlinObjectStub {
|
||||
private final StringRef name;
|
||||
private final FqName fqName;
|
||||
private final StringRef[] superNames;
|
||||
private final boolean isTopLevel;
|
||||
private final boolean isClassObject;
|
||||
private final boolean isLocal;
|
||||
private final boolean isObjectLiteral;
|
||||
|
||||
public KotlinObjectStubImpl(
|
||||
@NotNull StubElement parent,
|
||||
@Nullable StringRef name,
|
||||
@Nullable FqName fqName,
|
||||
@NotNull StringRef[] superNames,
|
||||
boolean isTopLevel,
|
||||
boolean isClassObject,
|
||||
boolean isLocal,
|
||||
boolean isObjectLiteral
|
||||
) {
|
||||
super(parent, JetStubElementTypes.OBJECT_DECLARATION);
|
||||
this.name = name;
|
||||
this.fqName = fqName;
|
||||
this.superNames = superNames;
|
||||
this.isTopLevel = isTopLevel;
|
||||
this.isClassObject = isClassObject;
|
||||
this.isLocal = isLocal;
|
||||
this.isObjectLiteral = isObjectLiteral;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringRef.toString(name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FqName getFqName() {
|
||||
return fqName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<String> getSuperNames() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (StringRef ref : superNames) {
|
||||
result.add(ref.toString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopLevel() {
|
||||
return isTopLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClassObject() {
|
||||
return isClassObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isObjectLiteral() {
|
||||
return isObjectLiteral;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return isLocal;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.jet.lang.psi.JetObjectDeclaration
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinObjectStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinObjectStubImpl(
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val name: StringRef?,
|
||||
private val fqName: FqName?,
|
||||
private val superNames: Array<StringRef>,
|
||||
private val isTopLevel: Boolean,
|
||||
private val isClassObject: Boolean,
|
||||
private val isLocal: Boolean,
|
||||
private val isObjectLiteral: Boolean
|
||||
) : KotlinStubBaseImpl<JetObjectDeclaration>(parent, JetStubElementTypes.OBJECT_DECLARATION), KotlinObjectStub {
|
||||
override fun getFqName() = fqName
|
||||
override fun getName() = StringRef.toString(name)
|
||||
override fun getSuperNames() = superNames map { it.toString() }
|
||||
override fun isTopLevel() = isTopLevel
|
||||
override fun isClassObject() = isClassObject
|
||||
override fun isObjectLiteral() = isObjectLiteral
|
||||
override fun isLocal() = isLocal
|
||||
}
|
||||
-74
@@ -1,74 +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.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.JetParameter;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinParameterStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
public class KotlinParameterStubImpl extends KotlinStubBaseImpl<JetParameter> implements KotlinParameterStub {
|
||||
private final StringRef name;
|
||||
private final boolean isMutable;
|
||||
private final StringRef fqName;
|
||||
private final boolean hasValOrValNode;
|
||||
private final boolean hasDefaultValue;
|
||||
|
||||
public KotlinParameterStubImpl(
|
||||
StubElement parent,
|
||||
StringRef fqName, StringRef name,
|
||||
boolean isMutable,
|
||||
boolean hasValOrValNode,
|
||||
boolean hasDefaultValue
|
||||
) {
|
||||
super(parent, JetStubElementTypes.VALUE_PARAMETER);
|
||||
this.name = name;
|
||||
this.isMutable = isMutable;
|
||||
this.fqName = fqName;
|
||||
this.hasValOrValNode = hasValOrValNode;
|
||||
this.hasDefaultValue = hasDefaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringRef.toString(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return isMutable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValOrValNode() {
|
||||
return hasValOrValNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDefaultValue() {
|
||||
return hasDefaultValue;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FqName getFqName() {
|
||||
return fqName != null ? new FqName(fqName.getString()) : null;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.jet.lang.psi.JetParameter
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinParameterStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinParameterStubImpl(
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val fqName: StringRef?,
|
||||
private val name: StringRef?,
|
||||
private val isMutable: Boolean,
|
||||
private val hasValOrVarNode: Boolean,
|
||||
private val hasDefaultValue: Boolean
|
||||
) : KotlinStubBaseImpl<JetParameter>(parent, JetStubElementTypes.VALUE_PARAMETER), KotlinParameterStub {
|
||||
override fun getName(): String? {
|
||||
return StringRef.toString(name)
|
||||
}
|
||||
|
||||
override fun getFqName(): FqName? {
|
||||
return if (fqName != null) FqName(fqName.getString()) else null
|
||||
}
|
||||
|
||||
override fun isMutable() = isMutable
|
||||
override fun hasValOrVarNode() = hasValOrVarNode
|
||||
override fun hasDefaultValue() = hasDefaultValue
|
||||
}
|
||||
-123
@@ -1,123 +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.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinPropertyStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
public class KotlinPropertyStubImpl extends KotlinStubBaseImpl<JetProperty> implements KotlinPropertyStub {
|
||||
private final StringRef name;
|
||||
private final boolean isVar;
|
||||
private final boolean isTopLevel;
|
||||
private final boolean hasDelegate;
|
||||
private final boolean hasDelegateExpression;
|
||||
private final boolean hasInitializer;
|
||||
private final boolean hasReceiverTypeRef;
|
||||
private final boolean hasReturnTypeRef;
|
||||
private final boolean probablyNothingType;
|
||||
private final FqName fqName;
|
||||
|
||||
public KotlinPropertyStubImpl(
|
||||
StubElement parent,
|
||||
StringRef name,
|
||||
boolean isVar,
|
||||
boolean isTopLevel,
|
||||
boolean hasDelegate,
|
||||
boolean hasDelegateExpression,
|
||||
boolean hasInitializer,
|
||||
boolean hasReceiverTypeRef,
|
||||
boolean hasReturnTypeRef,
|
||||
boolean probablyNothingType,
|
||||
@Nullable FqName fqName
|
||||
) {
|
||||
super(parent, JetStubElementTypes.PROPERTY);
|
||||
|
||||
if (isTopLevel && fqName == null) {
|
||||
throw new IllegalArgumentException("fqName shouldn't be null for top level properties");
|
||||
}
|
||||
if (hasDelegateExpression && !hasDelegate) {
|
||||
throw new IllegalArgumentException("Can't have delegate expression without delegate");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.isVar = isVar;
|
||||
this.isTopLevel = isTopLevel;
|
||||
this.hasDelegate = hasDelegate;
|
||||
this.hasDelegateExpression = hasDelegateExpression;
|
||||
this.hasInitializer = hasInitializer;
|
||||
this.hasReceiverTypeRef = hasReceiverTypeRef;
|
||||
this.hasReturnTypeRef = hasReturnTypeRef;
|
||||
this.probablyNothingType = probablyNothingType;
|
||||
this.fqName = fqName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVar() {
|
||||
return isVar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopLevel() {
|
||||
return isTopLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDelegate() {
|
||||
return hasDelegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDelegateExpression() {
|
||||
return hasDelegateExpression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasInitializer() {
|
||||
return hasInitializer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasReceiverTypeRef() {
|
||||
return hasReceiverTypeRef;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasReturnTypeRef() {
|
||||
return hasReturnTypeRef;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProbablyNothingType() {
|
||||
return probablyNothingType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FqName getFqName() {
|
||||
return fqName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringRef.toString(name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.jet.lang.psi.JetProperty
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinPropertyStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinPropertyStubImpl(
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val name: StringRef?,
|
||||
private val isVar: Boolean,
|
||||
private val isTopLevel: Boolean,
|
||||
private val hasDelegate: Boolean,
|
||||
private val hasDelegateExpression: Boolean,
|
||||
private val hasInitializer: Boolean,
|
||||
private val hasReceiverTypeRef: Boolean,
|
||||
private val hasReturnTypeRef: Boolean,
|
||||
private val isProbablyNothingType: Boolean,
|
||||
private val fqName: FqName?
|
||||
) : KotlinStubBaseImpl<JetProperty>(parent, JetStubElementTypes.PROPERTY), KotlinPropertyStub {
|
||||
|
||||
{
|
||||
if (isTopLevel && fqName == null) {
|
||||
throw IllegalArgumentException("fqName shouldn't be null for top level properties")
|
||||
}
|
||||
if (hasDelegateExpression && !hasDelegate) {
|
||||
throw IllegalArgumentException("Can't have delegate expression without delegate")
|
||||
}
|
||||
}
|
||||
|
||||
override fun getFqName() = fqName
|
||||
override fun isVar() = isVar
|
||||
override fun isTopLevel() = isTopLevel
|
||||
override fun hasDelegate() = hasDelegate
|
||||
override fun hasDelegateExpression() = hasDelegateExpression
|
||||
override fun hasInitializer() = hasInitializer
|
||||
override fun hasReceiverTypeRef() = hasReceiverTypeRef
|
||||
override fun hasReturnTypeRef() = hasReturnTypeRef
|
||||
override fun getName() = StringRef.toString(name)
|
||||
override fun isProbablyNothingType() = isProbablyNothingType
|
||||
}
|
||||
@@ -30,7 +30,7 @@ import java.util.ArrayList
|
||||
public open class KotlinStubBaseImpl<T : JetElementImplStub<*>>(parent: StubElement<*>?, elementType: IStubElementType<*, *>) : StubBase<T>(parent, elementType) {
|
||||
|
||||
override fun toString(): String {
|
||||
val stubInterface = this.javaClass.getInterfaces().first()
|
||||
val stubInterface = this.javaClass.getInterfaces().filter { it.getName().endsWith("Stub") }.single()
|
||||
val propertiesValues = renderPropertyValues(stubInterface)
|
||||
if (propertiesValues.isEmpty()) {
|
||||
return ""
|
||||
|
||||
+11
-16
@@ -14,23 +14,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.psi.stubs.impl;
|
||||
package org.jetbrains.jet.lang.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.jet.lang.psi.JetTypeConstraint;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinTypeConstraintStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import org.jetbrains.jet.lang.psi.JetTypeConstraint
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinTypeConstraintStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinTypeConstraintImpl extends KotlinStubBaseImpl<JetTypeConstraint> implements KotlinTypeConstraintStub {
|
||||
private final boolean isClassObjectConstraint;
|
||||
public class KotlinTypeConstraintStubImpl(
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val isClassObjectConstraint: Boolean
|
||||
) : KotlinStubBaseImpl<JetTypeConstraint>(parent, JetStubElementTypes.TYPE_CONSTRAINT), KotlinTypeConstraintStub {
|
||||
|
||||
public KotlinTypeConstraintImpl(StubElement parent, boolean isClassObjectConstraint) {
|
||||
super(parent, JetStubElementTypes.TYPE_CONSTRAINT);
|
||||
this.isClassObjectConstraint = isClassObjectConstraint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClassObjectConstraint() {
|
||||
return isClassObjectConstraint;
|
||||
}
|
||||
override fun isClassObjectConstraint() = isClassObjectConstraint
|
||||
}
|
||||
-61
@@ -1,61 +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.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.JetTypeParameter;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinTypeParameterStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
public class KotlinTypeParameterStubImpl extends KotlinStubBaseImpl<JetTypeParameter> implements KotlinTypeParameterStub {
|
||||
private final StringRef name;
|
||||
private final boolean isInVariance;
|
||||
private final boolean isOutVariance;
|
||||
|
||||
public KotlinTypeParameterStubImpl(StubElement parent, StringRef name, boolean isInVariance, boolean isOutVariance) {
|
||||
super(parent, JetStubElementTypes.TYPE_PARAMETER);
|
||||
|
||||
this.name = name;
|
||||
this.isInVariance = isInVariance;
|
||||
this.isOutVariance = isOutVariance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInVariance() {
|
||||
return isInVariance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOutVariance() {
|
||||
return isOutVariance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StringRef.toString(name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FqName getFqName() {
|
||||
// type parameters doesn't have FqNames
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import com.intellij.util.io.StringRef
|
||||
import org.jetbrains.jet.lang.psi.JetTypeParameter
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinTypeParameterStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public class KotlinTypeParameterStubImpl(
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val name: StringRef?,
|
||||
private val isInVariance: Boolean,
|
||||
private val isOutVariance: Boolean
|
||||
) : KotlinStubBaseImpl<JetTypeParameter>(parent, JetStubElementTypes.TYPE_PARAMETER), KotlinTypeParameterStub {
|
||||
override fun isInVariance() = isInVariance
|
||||
override fun isOutVariance() = isOutVariance
|
||||
override fun getName() = StringRef.toString(name)
|
||||
// type parameters don't have FqNames
|
||||
override fun getFqName() = null
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.jet.lang.psi.JetUserType;
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinUserTypeStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
|
||||
public class KotlinUserTypeStubImpl extends KotlinStubBaseImpl<JetUserType> implements KotlinUserTypeStub {
|
||||
private final boolean isAbsoluteInRootPackage;
|
||||
|
||||
public KotlinUserTypeStubImpl(StubElement parent, boolean isAbsoluteInRootPackage) {
|
||||
super(parent, JetStubElementTypes.USER_TYPE);
|
||||
this.isAbsoluteInRootPackage = isAbsoluteInRootPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbsoluteInRootPackage() {
|
||||
return isAbsoluteInRootPackage;
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.psi.stubs;
|
||||
package org.jetbrains.jet.lang.psi.stubs.impl
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.JetImportDirective;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import com.intellij.psi.stubs.StubElement
|
||||
import org.jetbrains.jet.lang.psi.JetUserType
|
||||
import org.jetbrains.jet.lang.psi.stubs.KotlinUserTypeStub
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
public interface KotlinImportDirectiveStub extends StubElement<JetImportDirective> {
|
||||
boolean isAbsoluteInRootPackage();
|
||||
boolean isAllUnder();
|
||||
@Nullable
|
||||
String getAliasName();
|
||||
boolean isValid();
|
||||
public class KotlinUserTypeStubImpl(
|
||||
parent: StubElement<out PsiElement>?,
|
||||
private val isAbsoluteInRootPackage: Boolean
|
||||
) : KotlinStubBaseImpl<JetUserType>(parent, JetStubElementTypes.USER_TYPE), KotlinUserTypeStub {
|
||||
override fun isAbsoluteInRootPackage() = isAbsoluteInRootPackage
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2010-2014 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.psi.stubs.impl
|
||||
|
||||
import org.jetbrains.jet.lang.psi.JetModifierList
|
||||
|
||||
import org.jetbrains.jet.lexer.JetTokens.MODIFIER_KEYWORDS_ARRAY
|
||||
import org.jetbrains.jet.lexer.JetModifierKeywordToken
|
||||
import kotlin.platform.platformStatic
|
||||
|
||||
public object ModifierMaskUtils {
|
||||
{
|
||||
assert(MODIFIER_KEYWORDS_ARRAY.size <= 32, "Current implementation depends on the ability to represent modifier list as bit mask")
|
||||
}
|
||||
|
||||
platformStatic public fun computeMaskFromModifierList(modifierList: JetModifierList): Int = computeMask { modifierList.hasModifier(it) }
|
||||
|
||||
platformStatic public fun computeMask(hasModifier: (JetModifierKeywordToken) -> Boolean): Int {
|
||||
var mask = 0
|
||||
for ((index, modifierKeywordToken) in MODIFIER_KEYWORDS_ARRAY.withIndices()) {
|
||||
if (hasModifier(modifierKeywordToken)) {
|
||||
mask = mask or (1 shl index)
|
||||
}
|
||||
}
|
||||
return mask
|
||||
}
|
||||
|
||||
platformStatic public fun maskHasModifier(mask: Int, modifierToken: JetModifierKeywordToken): Boolean {
|
||||
val index = MODIFIER_KEYWORDS_ARRAY.indexOf(modifierToken)
|
||||
assert(index >= 0, "All JetModifierKeywordTokens should be present in MODIFIER_KEYWORDS_ARRAY")
|
||||
return (mask and (1 shl index)) != 0
|
||||
}
|
||||
|
||||
platformStatic public fun maskToString(mask: Int): String {
|
||||
val sb = StringBuilder()
|
||||
sb.append("[")
|
||||
var first = true
|
||||
for (modifierKeyword in MODIFIER_KEYWORDS_ARRAY) {
|
||||
if (maskHasModifier(mask, modifierKeyword)) {
|
||||
if (!first) {
|
||||
sb.append(" ")
|
||||
}
|
||||
sb.append(modifierKeyword.getValue())
|
||||
first = false
|
||||
}
|
||||
}
|
||||
sb.append("]")
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,6 +20,6 @@ import com.intellij.util.io.StringRef
|
||||
|
||||
object Utils {
|
||||
fun wrapStrings(names : List<String>) : Array<StringRef> {
|
||||
return Array<StringRef>(names.size()) { i -> StringRef.fromString(names.get(i))!! }
|
||||
return Array(names.size()) { i -> StringRef.fromString(names.get(i))!! }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ PsiJetFileStubImpl[package=]
|
||||
PACKAGE_DIRECTIVE:
|
||||
FUN:[fqName=some, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isProbablyNothingType=false, isTopLevel=true, name=some]
|
||||
VALUE_PARAMETER_LIST:
|
||||
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrValNode=false, isMutable=false, name=t]
|
||||
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=t]
|
||||
TYPE_REFERENCE:
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
REFERENCE_EXPRESSION:[referencedName=Int]
|
||||
VALUE_PARAMETER:[fqName=null, hasDefaultValue=true, hasValOrValNode=false, isMutable=false, name=other]
|
||||
VALUE_PARAMETER:[fqName=null, hasDefaultValue=true, hasValOrVarNode=false, isMutable=false, name=other]
|
||||
TYPE_REFERENCE:
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
REFERENCE_EXPRESSION:[referencedName=String]
|
||||
|
||||
@@ -3,15 +3,15 @@ PsiJetFileStubImpl[package=test]
|
||||
REFERENCE_EXPRESSION:[referencedName=test]
|
||||
CLASS:[fqName=test.A, isEnumEntry=false, isLocal=false, isTopLevel=true, isTrait=false, name=A, superNames=[]]
|
||||
VALUE_PARAMETER_LIST:
|
||||
VALUE_PARAMETER:[fqName=test.A.b, hasDefaultValue=false, hasValOrValNode=true, isMutable=false, name=b]
|
||||
VALUE_PARAMETER:[fqName=test.A.b, hasDefaultValue=false, hasValOrVarNode=true, isMutable=false, name=b]
|
||||
TYPE_REFERENCE:
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
REFERENCE_EXPRESSION:[referencedName=Int]
|
||||
VALUE_PARAMETER:[fqName=test.A.c, hasDefaultValue=false, hasValOrValNode=true, isMutable=true, name=c]
|
||||
VALUE_PARAMETER:[fqName=test.A.c, hasDefaultValue=false, hasValOrVarNode=true, isMutable=true, name=c]
|
||||
TYPE_REFERENCE:
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
REFERENCE_EXPRESSION:[referencedName=String]
|
||||
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrValNode=false, isMutable=false, name=justParam]
|
||||
VALUE_PARAMETER:[fqName=null, hasDefaultValue=false, hasValOrVarNode=false, isMutable=false, name=justParam]
|
||||
TYPE_REFERENCE:
|
||||
USER_TYPE:[isAbsoluteInRootPackage=false]
|
||||
REFERENCE_EXPRESSION:[referencedName=Int]
|
||||
|
||||
Reference in New Issue
Block a user