Stubs for JetPropertyAccessor
This commit is contained in:
@@ -72,7 +72,7 @@ public interface JetNodeTypes {
|
||||
IElementType TYPE_PROJECTION = JetStubElementTypes.TYPE_PROJECTION;
|
||||
|
||||
// TODO: review
|
||||
JetNodeType PROPERTY_ACCESSOR = new JetNodeType("PROPERTY_ACCESSOR", JetPropertyAccessor.class);
|
||||
IElementType PROPERTY_ACCESSOR = JetStubElementTypes.PROPERTY_ACCESSOR;
|
||||
JetNodeType INITIALIZER_LIST = new JetNodeType("INITIALIZER_LIST", JetInitializerList.class);
|
||||
IElementType THIS_CALL = JetStubElementTypes.THIS_CALL;
|
||||
JetNodeType THIS_CONSTRUCTOR_REFERENCE = new JetNodeType("THIS_CONSTRUCTOR_REFERENCE", JetThisReferenceExpression.class);
|
||||
|
||||
@@ -22,17 +22,23 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetNodeTypes;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyAccessorStub;
|
||||
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 JetPropertyAccessor extends JetDeclarationImpl
|
||||
public class JetPropertyAccessor extends JetDeclarationStub<PsiJetPropertyAccessorStub>
|
||||
implements JetDeclarationWithBody, JetModifierListOwner, JetWithExpressionInitializer {
|
||||
public JetPropertyAccessor(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
public JetPropertyAccessor(@NotNull PsiJetPropertyAccessorStub stub) {
|
||||
super(stub, JetStubElementTypes.PROPERTY_ACCESSOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) {
|
||||
return visitor.visitPropertyAccessor(this, data);
|
||||
|
||||
+26
@@ -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.jet.lang.psi.JetPropertyAccessor;
|
||||
|
||||
public interface PsiJetPropertyAccessorStub extends StubElement<JetPropertyAccessor> {
|
||||
boolean isGetter();
|
||||
boolean hasBody();
|
||||
boolean hasBlockBody();
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.JetPropertyAccessor;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyAccessorStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.impl.PsiJetPropertyAccessorStubImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class JetPropertyAccessorElementType extends JetStubElementType<PsiJetPropertyAccessorStub, JetPropertyAccessor> {
|
||||
public JetPropertyAccessorElementType(@NotNull @NonNls String debugName) {
|
||||
super(debugName, JetPropertyAccessor.class, PsiJetPropertyAccessorStub.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiJetPropertyAccessorStub createStub(@NotNull JetPropertyAccessor psi, StubElement parentStub) {
|
||||
return new PsiJetPropertyAccessorStubImpl(parentStub, psi.isGetter(), psi.hasBody(), psi.hasBlockBody());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(@NotNull PsiJetPropertyAccessorStub stub, @NotNull StubOutputStream dataStream) throws IOException {
|
||||
dataStream.writeBoolean(stub.isGetter());
|
||||
dataStream.writeBoolean(stub.hasBody());
|
||||
dataStream.writeBoolean(stub.hasBlockBody());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiJetPropertyAccessorStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
boolean isGetter = dataStream.readBoolean();
|
||||
boolean hasBody = dataStream.readBoolean();
|
||||
boolean hasBlockBody = dataStream.readBoolean();
|
||||
return new PsiJetPropertyAccessorStubImpl(parentStub, isGetter, hasBody, hasBlockBody);
|
||||
}
|
||||
}
|
||||
+2
@@ -25,6 +25,8 @@ public interface JetStubElementTypes {
|
||||
JetClassElementType CLASS = new JetClassElementType("CLASS");
|
||||
JetFunctionElementType FUNCTION = new JetFunctionElementType("FUN");
|
||||
JetPropertyElementType PROPERTY = new JetPropertyElementType("PROPERTY");
|
||||
JetPropertyAccessorElementType PROPERTY_ACCESSOR = new JetPropertyAccessorElementType("PROPERTY_ACCESSOR");
|
||||
|
||||
JetClassElementType ENUM_ENTRY = new JetClassElementType("ENUM_ENTRY");
|
||||
JetObjectElementType OBJECT_DECLARATION = new JetObjectElementType("OBJECT_DECLARATION");
|
||||
JetPlaceHolderStubElementType<JetClassObject> CLASS_OBJECT =
|
||||
|
||||
+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.impl;
|
||||
|
||||
import com.intellij.psi.stubs.StubBase;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import org.jetbrains.jet.lang.psi.JetPropertyAccessor;
|
||||
import org.jetbrains.jet.lang.psi.stubs.PsiJetPropertyAccessorStub;
|
||||
import org.jetbrains.jet.lang.psi.stubs.elements.JetStubElementTypes;
|
||||
|
||||
public class PsiJetPropertyAccessorStubImpl extends StubBase<JetPropertyAccessor> implements PsiJetPropertyAccessorStub {
|
||||
private final boolean isGetter;
|
||||
private final boolean hasBody;
|
||||
private final boolean hasBlockBody;
|
||||
|
||||
public PsiJetPropertyAccessorStubImpl(StubElement parent, boolean isGetter, boolean hasBody, boolean hasBlockBody) {
|
||||
super(parent, JetStubElementTypes.PROPERTY_ACCESSOR);
|
||||
this.isGetter = isGetter;
|
||||
this.hasBody = hasBody;
|
||||
this.hasBlockBody = hasBlockBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGetter() {
|
||||
return isGetter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBody() {
|
||||
return hasBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBlockBody() {
|
||||
return hasBlockBody;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user