Move IfNotParsed interface to separate class
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 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;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comes along with @Nullable to indicate null is only possible if parsing error present
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
public @interface IfNotParsed {}
|
||||||
@@ -24,11 +24,6 @@ import com.intellij.psi.PsiElementVisitor;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.plugin.JetLanguage;
|
import org.jetbrains.jet.plugin.JetLanguage;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author max
|
* @author max
|
||||||
*/
|
*/
|
||||||
@@ -37,13 +32,6 @@ public class JetElementImpl extends ASTWrapperPsiElement implements JetElement {
|
|||||||
super(node);
|
super(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Comes along with @Nullable to indicate null is only possible if parsing error present
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.METHOD})
|
|
||||||
public @interface IfNotParsed {}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Language getLanguage() {
|
public Language getLanguage() {
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ public class JetPsiUtil {
|
|||||||
return firstPart.child(functionName);
|
return firstPart.child(functionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable @JetElementImpl.IfNotParsed
|
@Nullable @IfNotParsed
|
||||||
public static ImportPath getImportPath(JetImportDirective importDirective) {
|
public static ImportPath getImportPath(JetImportDirective importDirective) {
|
||||||
final JetExpression importedReference = importDirective.getImportedReference();
|
final JetExpression importedReference = importDirective.getImportedReference();
|
||||||
if (importedReference == null) {
|
if (importedReference == null) {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.intellij.psi.tree.IElementType;
|
|||||||
import com.intellij.psi.tree.TokenSet;
|
import com.intellij.psi.tree.TokenSet;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.JetNodeTypes;
|
|
||||||
import org.jetbrains.jet.lang.parsing.JetExpressionParsing;
|
import org.jetbrains.jet.lang.parsing.JetExpressionParsing;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lexer.JetTokens;
|
import org.jetbrains.jet.lexer.JetTokens;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public interface ValueArgument {
|
public interface ValueArgument {
|
||||||
@Nullable
|
@Nullable
|
||||||
@JetElementImpl.IfNotParsed
|
@IfNotParsed
|
||||||
JetExpression getArgumentExpression();
|
JetExpression getArgumentExpression();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ import org.jetbrains.annotations.NonNls;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||||
import org.jetbrains.jet.lang.parsing.JetParserDefinition;
|
import org.jetbrains.jet.lang.parsing.JetParserDefinition;
|
||||||
|
import org.jetbrains.jet.lang.psi.IfNotParsed;
|
||||||
import org.jetbrains.jet.lang.psi.JetElement;
|
import org.jetbrains.jet.lang.psi.JetElement;
|
||||||
import org.jetbrains.jet.lang.psi.JetElementImpl;
|
|
||||||
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
|
import org.jetbrains.jet.lang.psi.JetVisitorVoid;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -103,7 +103,7 @@ public class JetParsingTest extends ParsingTestCase {
|
|||||||
Object result = method.invoke(elem);
|
Object result = method.invoke(elem);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
for (Annotation annotation : method.getDeclaredAnnotations()) {
|
for (Annotation annotation : method.getDeclaredAnnotations()) {
|
||||||
if (annotation instanceof JetElementImpl.IfNotParsed) {
|
if (annotation instanceof IfNotParsed) {
|
||||||
assertNotNull(
|
assertNotNull(
|
||||||
"Incomplete operation in parsed OK test, method " + methodName +
|
"Incomplete operation in parsed OK test, method " + methodName +
|
||||||
" in " + declaringClass.getSimpleName() + " returns null. Element text: \n" + elem.getText(),
|
" in " + declaringClass.getSimpleName() + " returns null. Element text: \n" + elem.getText(),
|
||||||
|
|||||||
Reference in New Issue
Block a user