Stubs for JetUserType
This commit is contained in:
@@ -64,8 +64,7 @@ public interface JetNodeTypes {
|
||||
JetNodeType VALUE_ARGUMENT_NAME = new JetNodeType("VALUE_ARGUMENT_NAME", JetValueArgumentName.class);
|
||||
IElementType TYPE_REFERENCE = JetStubElementTypes.TYPE_REFERENCE;
|
||||
|
||||
JetNodeType USER_TYPE = new JetNodeType("USER_TYPE", JetUserType.class);
|
||||
|
||||
IElementType USER_TYPE = JetStubElementTypes.USER_TYPE;
|
||||
JetNodeType FUNCTION_TYPE = new JetNodeType("FUNCTION_TYPE", JetFunctionType.class);
|
||||
JetNodeType FUNCTION_TYPE_RECEIVER = new JetNodeType("FUNCTION_TYPE_RECEIVER", JetFunctionTypeReceiver.class);
|
||||
JetNodeType SELF_TYPE = new JetNodeType("SELF_TYPE", JetSelfType.class);
|
||||
|
||||
@@ -18,19 +18,26 @@ package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetUserTypeStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class JetUserType extends JetElementImpl implements JetTypeElement {
|
||||
public class JetUserType extends JetElementImplStub<PsiJetUserTypeStub> implements JetTypeElement {
|
||||
public JetUserType(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public JetUserType(@NotNull PsiJetUserTypeStub stub) {
|
||||
super(stub, JetStubElementTypes.USER_TYPE);
|
||||
}
|
||||
|
||||
public boolean isAbsoluteInRootPackage() {
|
||||
return findChildByType(JetTokens.PACKAGE_KEYWORD) != null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 PsiJetUserTypeStub extends StubElement<JetUserType> {
|
||||
boolean isAbsoluteInRootPackage();
|
||||
}
|
||||
+3
-1
@@ -53,7 +53,9 @@ public interface JetStubElementTypes {
|
||||
|
||||
JetPlaceHolderStubElementType<JetNullableType> NULLABLE_TYPE =
|
||||
new JetPlaceHolderStubElementType<JetNullableType>("NULLABLE_TYPE", JetNullableType.class);
|
||||
|
||||
|
||||
JetPlaceHolderStubElementType<JetTypeReference> TYPE_REFERENCE =
|
||||
new JetPlaceHolderStubElementType<JetTypeReference>("TYPE_REFERENCE", JetTypeReference.class);;
|
||||
|
||||
JetUserTypeElementType USER_TYPE = new JetUserTypeElementType("USER_TYPE");
|
||||
}
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.elements;
|
||||
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.stubs.StubInputStream;
|
||||
import com.intellij.psi.stubs.StubOutputStream;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetUserType;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetUserTypeStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetUserTypeStubImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class JetUserTypeElementType extends JetStubElementType<PsiJetUserTypeStub, JetUserType> {
|
||||
public JetUserTypeElementType(@NotNull @NonNls String debugName) {
|
||||
super(debugName, JetUserType.class, PsiJetUserTypeStub.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiJetUserTypeStub createStub(@NotNull JetUserType psi, StubElement parentStub) {
|
||||
return new PsiJetUserTypeStubImpl(parentStub, psi.isAbsoluteInRootPackage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@NotNull PsiJetUserTypeStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
dataStream.writeBoolean(stub.isAbsoluteInRootPackage());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiJetUserTypeStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
boolean isAbsoluteInRootPackage = dataStream.readBoolean();
|
||||
return new PsiJetUserTypeStubImpl(parentStub, isAbsoluteInRootPackage);
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.StubBase;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetUserType;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetUserTypeStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
public class PsiJetUserTypeStubImpl extends StubBase<JetUserType> implements PsiJetUserTypeStub {
|
||||
private final boolean isAbsoluteInRootPackage;
|
||||
|
||||
public PsiJetUserTypeStubImpl(StubElement parent, boolean isAbsoluteInRootPackage) {
|
||||
super(parent, JetStubElementTypes.USER_TYPE);
|
||||
this.isAbsoluteInRootPackage = isAbsoluteInRootPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAbsoluteInRootPackage() {
|
||||
return isAbsoluteInRootPackage;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user