Stubs for JetTypeConstraint
This commit is contained in:
@@ -77,7 +77,7 @@ public interface JetNodeTypes {
|
||||
IElementType THIS_CALL = JetStubElementTypes.THIS_CALL;
|
||||
JetNodeType THIS_CONSTRUCTOR_REFERENCE = new JetNodeType("THIS_CONSTRUCTOR_REFERENCE", JetThisReferenceExpression.class);
|
||||
IElementType TYPE_CONSTRAINT_LIST = JetStubElementTypes.TYPE_CONSTRAINT_LIST;
|
||||
JetNodeType TYPE_CONSTRAINT = new JetNodeType("TYPE_CONSTRAINT", JetTypeConstraint.class);
|
||||
IElementType TYPE_CONSTRAINT = JetStubElementTypes.TYPE_CONSTRAINT;
|
||||
|
||||
// TODO: Not sure if we need separate NT for each kind of constants
|
||||
JetNodeType NULL = new JetNodeType("NULL", JetConstantExpression.class);
|
||||
|
||||
@@ -17,17 +17,24 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
public class JetTypeConstraint extends JetElementImpl {
|
||||
public class JetTypeConstraint extends JetElementImplStub<PsiJetTypeConstraintStub> {
|
||||
public JetTypeConstraint(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public JetTypeConstraint(@NotNull PsiJetTypeConstraintStub stub) {
|
||||
super(stub, JetStubElementTypes.TYPE_CONSTRAINT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitTypeConstraint(this, data);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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 PsiJetTypeConstraintStub extends StubElement<JetTypeConstraint> {
|
||||
boolean isClassObjectConstraint();
|
||||
}
|
||||
+2
@@ -61,6 +61,8 @@ public interface JetStubElementTypes {
|
||||
JetPlaceHolderStubElementType<JetTypeConstraintList> TYPE_CONSTRAINT_LIST =
|
||||
new JetPlaceHolderStubElementType<JetTypeConstraintList>("TYPE_CONSTRAINT_LIST", JetTypeConstraintList.class);
|
||||
|
||||
JetTypeConstraintElementType TYPE_CONSTRAINT = new JetTypeConstraintElementType("TYPE_CONSTRAINT");
|
||||
|
||||
JetPlaceHolderStubElementType<JetNullableType> NULLABLE_TYPE =
|
||||
new JetPlaceHolderStubElementType<JetNullableType>("NULLABLE_TYPE", JetNullableType.class);
|
||||
|
||||
|
||||
+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.JetTypeConstraint;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetTypeConstraintImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class JetTypeConstraintElementType extends JetStubElementType<PsiJetTypeConstraintStub, JetTypeConstraint> {
|
||||
public JetTypeConstraintElementType(@NotNull @NonNls String debugName) {
|
||||
super(debugName, JetTypeConstraint.class, PsiJetTypeConstraintStub.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiJetTypeConstraintStub createStub(@NotNull JetTypeConstraint psi, StubElement parentStub) {
|
||||
return new PsiJetTypeConstraintImpl(parentStub, psi.isClassObjectConstraint());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@NotNull PsiJetTypeConstraintStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
dataStream.writeBoolean(stub.isClassObjectConstraint());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiJetTypeConstraintStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
boolean isClassObjectConstraint = dataStream.readBoolean();
|
||||
return new PsiJetTypeConstraintImpl(parentStub, isClassObjectConstraint);
|
||||
}
|
||||
}
|
||||
+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.StubBase;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.jet.lang.psi.JetTypeConstraint;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetTypeConstraintStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
|
||||
public class PsiJetTypeConstraintImpl extends StubBase<JetTypeConstraint> implements PsiJetTypeConstraintStub {
|
||||
private final boolean isClassObjectConstraint;
|
||||
|
||||
public PsiJetTypeConstraintImpl(StubElement parent, boolean isClassObjectConstraint) {
|
||||
super(parent, JetStubElementTypes.TYPE_CONSTRAINT);
|
||||
this.isClassObjectConstraint = isClassObjectConstraint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClassObjectConstraint() {
|
||||
return isClassObjectConstraint;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user