Annotate JetVisitorVoid and its inheritors
This commit is contained in:
@@ -1324,12 +1324,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
private void lookupConstructorExpressionsInClosureIfPresent(final ConstructorContext constructorContext) {
|
||||
JetVisitorVoid visitor = new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetElement(JetElement e) {
|
||||
public void visitJetElement(@NotNull JetElement e) {
|
||||
e.acceptChildren(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expr) {
|
||||
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expr) {
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expr);
|
||||
if (descriptor instanceof VariableDescriptor && !(descriptor instanceof PropertyDescriptor)) {
|
||||
ConstructorDescriptor constructorDescriptor = (ConstructorDescriptor) constructorContext.getContextDescriptor();
|
||||
@@ -1355,7 +1355,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitThisExpression(JetThisExpression expression) {
|
||||
public void visitThisExpression(@NotNull JetThisExpression expression) {
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getInstanceReference());
|
||||
assert descriptor instanceof CallableDescriptor ||
|
||||
descriptor instanceof ClassDescriptor : "'This' reference target should be class or callable descriptor but was " + descriptor;
|
||||
|
||||
+15
-15
@@ -139,13 +139,13 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
super.visitJetElement(element);
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetFile(JetFile file) {
|
||||
public void visitJetFile(@NotNull JetFile file) {
|
||||
if (file.isScript()) {
|
||||
//noinspection ConstantConditions
|
||||
ClassDescriptor classDescriptor = bindingContext.get(CLASS_FOR_SCRIPT, bindingContext.get(SCRIPT, file.getScript()));
|
||||
@@ -164,7 +164,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnumEntry(JetEnumEntry enumEntry) {
|
||||
public void visitEnumEntry(@NotNull JetEnumEntry enumEntry) {
|
||||
ClassDescriptor descriptor = bindingContext.get(CLASS, enumEntry);
|
||||
assert descriptor != null;
|
||||
|
||||
@@ -181,7 +181,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClassObject(JetClassObject classObject) {
|
||||
public void visitClassObject(@NotNull JetClassObject classObject) {
|
||||
ClassDescriptor classDescriptor = bindingContext.get(CLASS, classObject.getObjectDeclaration());
|
||||
assert classDescriptor != null;
|
||||
|
||||
@@ -196,7 +196,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitObjectDeclaration(JetObjectDeclaration declaration) {
|
||||
public void visitObjectDeclaration(@NotNull JetObjectDeclaration declaration) {
|
||||
if (declaration.getParent() instanceof JetObjectLiteralExpression || declaration.getParent() instanceof JetClassObject) {
|
||||
super.visitObjectDeclaration(declaration);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClass(JetClass klass) {
|
||||
public void visitClass(@NotNull JetClass klass) {
|
||||
ClassDescriptor classDescriptor = bindingContext.get(CLASS, klass);
|
||||
// working around a problem with shallow analysis
|
||||
if (classDescriptor == null) return;
|
||||
@@ -239,7 +239,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) {
|
||||
public void visitObjectLiteralExpression(@NotNull JetObjectLiteralExpression expression) {
|
||||
ClassDescriptor classDescriptor = bindingContext.get(CLASS, expression.getObjectDeclaration());
|
||||
if (classDescriptor == null) {
|
||||
// working around a problem with shallow analysis
|
||||
@@ -259,7 +259,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
||||
public void visitFunctionLiteralExpression(@NotNull JetFunctionLiteralExpression expression) {
|
||||
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||
FunctionDescriptor functionDescriptor =
|
||||
(FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, functionLiteral);
|
||||
@@ -298,7 +298,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
||||
public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
|
||||
ClassDescriptorWithState state = peekFromStack(classStack);
|
||||
assert state != null : "Class descriptor should be recorded before " + call + " processing";
|
||||
state.setDelegationToSuperCall(true);
|
||||
@@ -307,7 +307,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCallableReferenceExpression(JetCallableReferenceExpression expression) {
|
||||
public void visitCallableReferenceExpression(@NotNull JetCallableReferenceExpression expression) {
|
||||
FunctionDescriptor functionDescriptor = bindingContext.get(FUNCTION, expression);
|
||||
// working around a problem with shallow analysis
|
||||
if (functionDescriptor == null) return;
|
||||
@@ -339,7 +339,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitProperty(JetProperty property) {
|
||||
public void visitProperty(@NotNull JetProperty property) {
|
||||
DeclarationDescriptor propertyDescriptor = bindingContext.get(DECLARATION_TO_DESCRIPTOR, property);
|
||||
// working around a problem with shallow analysis
|
||||
if (propertyDescriptor == null) return;
|
||||
@@ -356,7 +356,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitNamedFunction(JetNamedFunction function) {
|
||||
public void visitNamedFunction(@NotNull JetNamedFunction function) {
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, function);
|
||||
// working around a problem with shallow analysis
|
||||
if (functionDescriptor == null) return;
|
||||
@@ -402,7 +402,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCallExpression(JetCallExpression expression) {
|
||||
public void visitCallExpression(@NotNull JetCallExpression expression) {
|
||||
super.visitCallExpression(expression);
|
||||
ResolvedCall<? extends CallableDescriptor> call = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getCalleeExpression());
|
||||
if (call == null) {
|
||||
@@ -437,7 +437,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitBinaryExpression(JetBinaryExpression expression) {
|
||||
public void visitBinaryExpression(@NotNull JetBinaryExpression expression) {
|
||||
super.visitBinaryExpression(expression);
|
||||
|
||||
FunctionDescriptor operationDescriptor =
|
||||
@@ -460,7 +460,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitArrayAccessExpression(JetArrayAccessExpression expression) {
|
||||
public void visitArrayAccessExpression(@NotNull JetArrayAccessExpression expression) {
|
||||
super.visitArrayAccessExpression(expression);
|
||||
|
||||
FunctionDescriptor operationDescriptor = (FunctionDescriptor) bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
|
||||
|
||||
@@ -83,7 +83,7 @@ public class DebugInfoUtil {
|
||||
root.acceptChildren(new JetTreeVisitorVoid() {
|
||||
|
||||
@Override
|
||||
public void visitReferenceExpression(JetReferenceExpression expression) {
|
||||
public void visitReferenceExpression(@NotNull JetReferenceExpression expression) {
|
||||
super.visitReferenceExpression(expression);
|
||||
if (!BindingContextUtils.isExpressionWithValidReference(expression, bindingContext)){
|
||||
return;
|
||||
|
||||
@@ -95,31 +95,31 @@ public class JetControlFlowProcessor {
|
||||
private final JetVisitorVoid conditionVisitor = new JetVisitorVoid() {
|
||||
|
||||
@Override
|
||||
public void visitWhenConditionInRange(JetWhenConditionInRange condition) {
|
||||
public void visitWhenConditionInRange(@NotNull JetWhenConditionInRange condition) {
|
||||
generateInstructions(condition.getRangeExpression(), CFPVisitor.this.inCondition); // TODO : inCondition?
|
||||
generateInstructions(condition.getOperationReference(), CFPVisitor.this.inCondition); // TODO : inCondition?
|
||||
// TODO : read the call to contains()...
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitWhenConditionIsPattern(JetWhenConditionIsPattern condition) {
|
||||
public void visitWhenConditionIsPattern(@NotNull JetWhenConditionIsPattern condition) {
|
||||
// TODO: types in CF?
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) {
|
||||
public void visitWhenConditionWithExpression(@NotNull JetWhenConditionWithExpression condition) {
|
||||
generateInstructions(condition.getExpression(), inCondition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
throw new UnsupportedOperationException("[JetControlFlowProcessor] " + element.toString());
|
||||
}
|
||||
};
|
||||
private final JetVisitorVoid patternVisitor = new JetVisitorVoid() {
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
throw new UnsupportedOperationException("[JetControlFlowProcessor] " + element.toString());
|
||||
}
|
||||
};
|
||||
@@ -141,7 +141,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
||||
public void visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression) {
|
||||
builder.read(expression);
|
||||
|
||||
JetExpression innerExpression = expression.getExpression();
|
||||
@@ -151,7 +151,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitAnnotatedExpression(JetAnnotatedExpression expression) {
|
||||
public void visitAnnotatedExpression(@NotNull JetAnnotatedExpression expression) {
|
||||
builder.read(expression);
|
||||
|
||||
JetExpression baseExpression = expression.getBaseExpression();
|
||||
@@ -161,17 +161,17 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitThisExpression(JetThisExpression expression) {
|
||||
public void visitThisExpression(@NotNull JetThisExpression expression) {
|
||||
builder.read(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitConstantExpression(JetConstantExpression expression) {
|
||||
public void visitConstantExpression(@NotNull JetConstantExpression expression) {
|
||||
builder.read(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
|
||||
builder.read(expression);
|
||||
if (trace.get(BindingContext.PROCESSED, expression)) {
|
||||
JetType type = trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, expression);
|
||||
@@ -182,7 +182,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) {
|
||||
public void visitLabelQualifiedExpression(@NotNull JetLabelQualifiedExpression expression) {
|
||||
String labelName = expression.getLabelName();
|
||||
JetExpression labeledExpression = expression.getLabeledExpression();
|
||||
if (labelName != null && labeledExpression != null) {
|
||||
@@ -198,7 +198,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@SuppressWarnings("SuspiciousMethodCalls") @Override
|
||||
public void visitBinaryExpression(JetBinaryExpression expression) {
|
||||
public void visitBinaryExpression(@NotNull JetBinaryExpression expression) {
|
||||
IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
|
||||
JetExpression right = expression.getRight();
|
||||
if (operationType == JetTokens.ANDAND) {
|
||||
@@ -294,7 +294,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitUnaryExpression(JetUnaryExpression expression) {
|
||||
public void visitUnaryExpression(@NotNull JetUnaryExpression expression) {
|
||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||
IElementType operationType = operationSign.getReferencedNameElementType();
|
||||
JetExpression baseExpression = expression.getBaseExpression();
|
||||
@@ -322,7 +322,7 @@ public class JetControlFlowProcessor {
|
||||
|
||||
|
||||
@Override
|
||||
public void visitIfExpression(JetIfExpression expression) {
|
||||
public void visitIfExpression(@NotNull JetIfExpression expression) {
|
||||
JetExpression condition = expression.getCondition();
|
||||
if (condition != null) {
|
||||
generateInstructions(condition, true);
|
||||
@@ -376,7 +376,7 @@ public class JetControlFlowProcessor {
|
||||
|
||||
|
||||
@Override
|
||||
public void visitTryExpression(JetTryExpression expression) {
|
||||
public void visitTryExpression(@NotNull JetTryExpression expression) {
|
||||
builder.read(expression);
|
||||
JetFinallySection finallyBlock = expression.getFinallyBlock();
|
||||
final FinallyBlockGenerator finallyBlockGenerator = new FinallyBlockGenerator(finallyBlock);
|
||||
@@ -461,7 +461,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitWhileExpression(JetWhileExpression expression) {
|
||||
public void visitWhileExpression(@NotNull JetWhileExpression expression) {
|
||||
builder.read(expression);
|
||||
LoopInfo loopInfo = builder.enterLoop(expression, null, null);
|
||||
|
||||
@@ -492,7 +492,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDoWhileExpression(JetDoWhileExpression expression) {
|
||||
public void visitDoWhileExpression(@NotNull JetDoWhileExpression expression) {
|
||||
builder.read(expression);
|
||||
LoopInfo loopInfo = builder.enterLoop(expression, null, null);
|
||||
|
||||
@@ -512,7 +512,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitForExpression(JetForExpression expression) {
|
||||
public void visitForExpression(@NotNull JetForExpression expression) {
|
||||
builder.read(expression);
|
||||
JetExpression loopRange = expression.getLoopRange();
|
||||
if (loopRange != null) {
|
||||
@@ -548,7 +548,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitBreakExpression(JetBreakExpression expression) {
|
||||
public void visitBreakExpression(@NotNull JetBreakExpression expression) {
|
||||
JetElement loop = getCorrespondingLoop(expression);
|
||||
if (loop != null) {
|
||||
builder.jump(builder.getExitPoint(loop));
|
||||
@@ -556,7 +556,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitContinueExpression(JetContinueExpression expression) {
|
||||
public void visitContinueExpression(@NotNull JetContinueExpression expression) {
|
||||
JetElement loop = getCorrespondingLoop(expression);
|
||||
if (loop != null) {
|
||||
builder.jump(builder.getEntryPoint(loop));
|
||||
@@ -588,7 +588,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitReturnExpression(JetReturnExpression expression) {
|
||||
public void visitReturnExpression(@NotNull JetReturnExpression expression) {
|
||||
JetExpression returnedExpression = expression.getReturnedExpression();
|
||||
if (returnedExpression != null) {
|
||||
generateInstructions(returnedExpression, false);
|
||||
@@ -623,7 +623,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitParameter(JetParameter parameter) {
|
||||
public void visitParameter(@NotNull JetParameter parameter) {
|
||||
builder.declare(parameter);
|
||||
JetExpression defaultValue = parameter.getDefaultValue();
|
||||
if (defaultValue != null) {
|
||||
@@ -633,7 +633,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitBlockExpression(JetBlockExpression expression) {
|
||||
public void visitBlockExpression(@NotNull JetBlockExpression expression) {
|
||||
List<JetElement> statements = expression.getStatements();
|
||||
for (JetElement statement : statements) {
|
||||
generateInstructions(statement, false);
|
||||
@@ -644,19 +644,19 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitNamedFunction(JetNamedFunction function) {
|
||||
public void visitNamedFunction(@NotNull JetNamedFunction function) {
|
||||
processLocalDeclaration(function);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
||||
public void visitFunctionLiteralExpression(@NotNull JetFunctionLiteralExpression expression) {
|
||||
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||
processLocalDeclaration(functionLiteral);
|
||||
builder.read(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitQualifiedExpression(JetQualifiedExpression expression) {
|
||||
public void visitQualifiedExpression(@NotNull JetQualifiedExpression expression) {
|
||||
generateInstructions(expression.getReceiverExpression(), false);
|
||||
JetExpression selectorExpression = expression.getSelectorExpression();
|
||||
if (selectorExpression != null) {
|
||||
@@ -685,7 +685,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCallExpression(JetCallExpression expression) {
|
||||
public void visitCallExpression(@NotNull JetCallExpression expression) {
|
||||
//inline functions after M1
|
||||
// ResolvedCall<? extends CallableDescriptor> resolvedCall = trace.get(BindingContext.RESOLVED_CALL, expression.getCalleeExpression());
|
||||
// assert resolvedCall != null;
|
||||
@@ -722,7 +722,7 @@ public class JetControlFlowProcessor {
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void visitProperty(JetProperty property) {
|
||||
public void visitProperty(@NotNull JetProperty property) {
|
||||
builder.declare(property);
|
||||
JetExpression initializer = property.getInitializer();
|
||||
if (initializer != null) {
|
||||
@@ -739,7 +739,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMultiDeclaration(JetMultiDeclaration declaration) {
|
||||
public void visitMultiDeclaration(@NotNull JetMultiDeclaration declaration) {
|
||||
JetExpression initializer = declaration.getInitializer();
|
||||
if (initializer != null) {
|
||||
generateInstructions(initializer, false);
|
||||
@@ -752,12 +752,12 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPropertyAccessor(JetPropertyAccessor accessor) {
|
||||
public void visitPropertyAccessor(@NotNull JetPropertyAccessor accessor) {
|
||||
processLocalDeclaration(accessor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) {
|
||||
public void visitBinaryWithTypeRHSExpression(@NotNull JetBinaryExpressionWithTypeRHS expression) {
|
||||
IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
|
||||
if (operationType == JetTokens.COLON || operationType == JetTokens.AS_KEYWORD || operationType == JetTokens.AS_SAFE) {
|
||||
generateInstructions(expression.getLeft(), false);
|
||||
@@ -769,7 +769,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitThrowExpression(JetThrowExpression expression) {
|
||||
public void visitThrowExpression(@NotNull JetThrowExpression expression) {
|
||||
JetExpression thrownExpression = expression.getThrownExpression();
|
||||
if (thrownExpression != null) {
|
||||
generateInstructions(thrownExpression, false);
|
||||
@@ -778,7 +778,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitArrayAccessExpression(JetArrayAccessExpression expression) {
|
||||
public void visitArrayAccessExpression(@NotNull JetArrayAccessExpression expression) {
|
||||
for (JetExpression index : expression.getIndexExpressions()) {
|
||||
generateInstructions(index, false);
|
||||
}
|
||||
@@ -788,7 +788,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitIsExpression(JetIsExpression expression) {
|
||||
public void visitIsExpression(@NotNull JetIsExpression expression) {
|
||||
generateInstructions(expression.getLeftHandSide(), inCondition);
|
||||
// no CF for types
|
||||
// TODO : builder.read(expression.getPattern());
|
||||
@@ -796,7 +796,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitWhenExpression(JetWhenExpression expression) {
|
||||
public void visitWhenExpression(@NotNull JetWhenExpression expression) {
|
||||
JetExpression subjectExpression = expression.getSubjectExpression();
|
||||
if (subjectExpression != null) {
|
||||
generateInstructions(subjectExpression, inCondition);
|
||||
@@ -853,7 +853,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) {
|
||||
public void visitObjectLiteralExpression(@NotNull JetObjectLiteralExpression expression) {
|
||||
JetObjectDeclaration declaration = expression.getObjectDeclaration();
|
||||
generateInstructions(declaration, inCondition);
|
||||
|
||||
@@ -871,12 +871,12 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitObjectDeclaration(JetObjectDeclaration objectDeclaration) {
|
||||
public void visitObjectDeclaration(@NotNull JetObjectDeclaration objectDeclaration) {
|
||||
visitClassOrObject(objectDeclaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitStringTemplateExpression(JetStringTemplateExpression expression) {
|
||||
public void visitStringTemplateExpression(@NotNull JetStringTemplateExpression expression) {
|
||||
for (JetStringTemplateEntry entry : expression.getEntries()) {
|
||||
if (entry instanceof JetStringTemplateEntryWithExpression) {
|
||||
JetStringTemplateEntryWithExpression entryWithExpression = (JetStringTemplateEntryWithExpression) entry;
|
||||
@@ -887,12 +887,12 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTypeProjection(JetTypeProjection typeProjection) {
|
||||
public void visitTypeProjection(@NotNull JetTypeProjection typeProjection) {
|
||||
// TODO : Support Type Arguments. Class object may be initialized at this point");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitAnonymousInitializer(JetClassInitializer classInitializer) {
|
||||
public void visitAnonymousInitializer(@NotNull JetClassInitializer classInitializer) {
|
||||
generateInstructions(classInitializer.getBody(), inCondition);
|
||||
}
|
||||
|
||||
@@ -909,7 +909,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClass(JetClass klass) {
|
||||
public void visitClass(@NotNull JetClass klass) {
|
||||
List<JetParameter> parameters = klass.getPrimaryConstructorParameters();
|
||||
for (JetParameter parameter : parameters) {
|
||||
generateInstructions(parameter, inCondition);
|
||||
@@ -918,7 +918,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
||||
public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
|
||||
List<? extends ValueArgument> valueArguments = call.getValueArguments();
|
||||
for (ValueArgument valueArgument : valueArguments) {
|
||||
generateInstructions(valueArgument.getArgumentExpression(), inCondition);
|
||||
@@ -926,12 +926,12 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) {
|
||||
public void visitDelegationByExpressionSpecifier(@NotNull JetDelegatorByExpressionSpecifier specifier) {
|
||||
generateInstructions(specifier.getDelegateExpression(), inCondition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetFile(JetFile file) {
|
||||
public void visitJetFile(@NotNull JetFile file) {
|
||||
for (JetDeclaration declaration : file.getDeclarations()) {
|
||||
if (declaration instanceof JetProperty) {
|
||||
generateInstructions(declaration, inCondition);
|
||||
@@ -940,7 +940,7 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
builder.unsupported(element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,14 +144,14 @@ public class JetFlowInformationProvider {
|
||||
for (JetElement returnedExpression : returnedExpressions) {
|
||||
returnedExpression.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitReturnExpression(JetReturnExpression expression) {
|
||||
public void visitReturnExpression(@NotNull JetReturnExpression expression) {
|
||||
if (!blockBody) {
|
||||
trace.report(RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY.on(expression));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitExpression(JetExpression expression) {
|
||||
public void visitExpression(@NotNull JetExpression expression) {
|
||||
if (blockBody && !noExpectedType(expectedReturnType) && !KotlinBuiltIns.getInstance().isUnit(expectedReturnType) && !rootUnreachableElements.contains(expression)) {
|
||||
noReturnError[0] = true;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class JetPsiUtil {
|
||||
final Set<JetElement> shadowedElements = new HashSet<JetElement>();
|
||||
JetVisitorVoid shadowAllChildren = new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
if (shadowedElements.add(element)) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
@@ -841,7 +841,7 @@ public class JetPsiUtil {
|
||||
((JetElement) root).accept(
|
||||
new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
if (predicate.apply(element)) {
|
||||
//noinspection unchecked
|
||||
results.add(element);
|
||||
|
||||
@@ -17,161 +17,162 @@
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class JetVisitorVoid extends PsiElementVisitor {
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
visitElement(element);
|
||||
}
|
||||
|
||||
public void visitDeclaration(JetDeclaration dcl) {
|
||||
public void visitDeclaration(@NotNull JetDeclaration dcl) {
|
||||
visitExpression(dcl);
|
||||
}
|
||||
|
||||
public void visitClass(JetClass klass) {
|
||||
public void visitClass(@NotNull JetClass klass) {
|
||||
visitNamedDeclaration(klass);
|
||||
}
|
||||
|
||||
public void visitClassObject(JetClassObject classObject) {
|
||||
public void visitClassObject(@NotNull JetClassObject classObject) {
|
||||
visitDeclaration(classObject);
|
||||
}
|
||||
|
||||
public void visitNamedFunction(JetNamedFunction function) {
|
||||
public void visitNamedFunction(@NotNull JetNamedFunction function) {
|
||||
visitNamedDeclaration(function);
|
||||
}
|
||||
|
||||
public void visitProperty(JetProperty property) {
|
||||
public void visitProperty(@NotNull JetProperty property) {
|
||||
visitNamedDeclaration(property);
|
||||
}
|
||||
|
||||
public void visitTypedef(JetTypedef typedef) {
|
||||
public void visitTypedef(@NotNull JetTypedef typedef) {
|
||||
visitNamedDeclaration(typedef);
|
||||
}
|
||||
|
||||
public void visitJetFile(JetFile file) {
|
||||
public void visitJetFile(@NotNull JetFile file) {
|
||||
visitFile(file);
|
||||
}
|
||||
|
||||
public void visitScript(JetScript script) {
|
||||
public void visitScript(@NotNull JetScript script) {
|
||||
visitDeclaration(script);
|
||||
}
|
||||
|
||||
public void visitImportDirective(JetImportDirective importDirective) {
|
||||
public void visitImportDirective(@NotNull JetImportDirective importDirective) {
|
||||
visitJetElement(importDirective);
|
||||
}
|
||||
|
||||
public void visitImportList(JetImportList importList) {
|
||||
public void visitImportList(@NotNull JetImportList importList) {
|
||||
visitJetElement(importList);
|
||||
}
|
||||
|
||||
public void visitClassBody(JetClassBody classBody) {
|
||||
public void visitClassBody(@NotNull JetClassBody classBody) {
|
||||
visitJetElement(classBody);
|
||||
}
|
||||
|
||||
public void visitModifierList(JetModifierList list) {
|
||||
public void visitModifierList(@NotNull JetModifierList list) {
|
||||
visitJetElement(list);
|
||||
}
|
||||
|
||||
public void visitAnnotation(JetAnnotation annotation) {
|
||||
public void visitAnnotation(@NotNull JetAnnotation annotation) {
|
||||
visitJetElement(annotation);
|
||||
}
|
||||
|
||||
public void visitAnnotationEntry(JetAnnotationEntry annotationEntry) {
|
||||
public void visitAnnotationEntry(@NotNull JetAnnotationEntry annotationEntry) {
|
||||
visitJetElement(annotationEntry);
|
||||
}
|
||||
|
||||
public void visitTypeParameterList(JetTypeParameterList list) {
|
||||
public void visitTypeParameterList(@NotNull JetTypeParameterList list) {
|
||||
visitJetElement(list);
|
||||
}
|
||||
|
||||
public void visitTypeParameter(JetTypeParameter parameter) {
|
||||
public void visitTypeParameter(@NotNull JetTypeParameter parameter) {
|
||||
visitNamedDeclaration(parameter);
|
||||
}
|
||||
|
||||
public void visitEnumEntry(JetEnumEntry enumEntry) {
|
||||
public void visitEnumEntry(@NotNull JetEnumEntry enumEntry) {
|
||||
visitClass(enumEntry);
|
||||
}
|
||||
|
||||
public void visitParameterList(JetParameterList list) {
|
||||
public void visitParameterList(@NotNull JetParameterList list) {
|
||||
visitJetElement(list);
|
||||
}
|
||||
|
||||
public void visitParameter(JetParameter parameter) {
|
||||
public void visitParameter(@NotNull JetParameter parameter) {
|
||||
visitNamedDeclaration(parameter);
|
||||
}
|
||||
|
||||
public void visitDelegationSpecifierList(JetDelegationSpecifierList list) {
|
||||
public void visitDelegationSpecifierList(@NotNull JetDelegationSpecifierList list) {
|
||||
visitJetElement(list);
|
||||
}
|
||||
|
||||
public void visitDelegationSpecifier(JetDelegationSpecifier specifier) {
|
||||
public void visitDelegationSpecifier(@NotNull JetDelegationSpecifier specifier) {
|
||||
visitJetElement(specifier);
|
||||
}
|
||||
|
||||
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) {
|
||||
public void visitDelegationByExpressionSpecifier(@NotNull JetDelegatorByExpressionSpecifier specifier) {
|
||||
visitDelegationSpecifier(specifier);
|
||||
}
|
||||
|
||||
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
||||
public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
|
||||
visitDelegationSpecifier(call);
|
||||
}
|
||||
|
||||
public void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier) {
|
||||
public void visitDelegationToSuperClassSpecifier(@NotNull JetDelegatorToSuperClass specifier) {
|
||||
visitDelegationSpecifier(specifier);
|
||||
}
|
||||
|
||||
public void visitDelegationToThisCall(JetDelegatorToThisCall thisCall) {
|
||||
public void visitDelegationToThisCall(@NotNull JetDelegatorToThisCall thisCall) {
|
||||
visitDelegationSpecifier(thisCall);
|
||||
}
|
||||
|
||||
public void visitPropertyDelegate(JetPropertyDelegate delegate) {
|
||||
public void visitPropertyDelegate(@NotNull JetPropertyDelegate delegate) {
|
||||
visitJetElement(delegate);
|
||||
}
|
||||
|
||||
public void visitTypeReference(JetTypeReference typeReference) {
|
||||
public void visitTypeReference(@NotNull JetTypeReference typeReference) {
|
||||
visitJetElement(typeReference);
|
||||
}
|
||||
|
||||
public void visitValueArgumentList(JetValueArgumentList list) {
|
||||
public void visitValueArgumentList(@NotNull JetValueArgumentList list) {
|
||||
visitJetElement(list);
|
||||
}
|
||||
|
||||
public void visitArgument(JetValueArgument argument) {
|
||||
public void visitArgument(@NotNull JetValueArgument argument) {
|
||||
visitJetElement(argument);
|
||||
}
|
||||
|
||||
public void visitExpression(JetExpression expression) {
|
||||
public void visitExpression(@NotNull JetExpression expression) {
|
||||
visitJetElement(expression);
|
||||
}
|
||||
|
||||
public void visitLoopExpression(JetLoopExpression loopExpression) {
|
||||
public void visitLoopExpression(@NotNull JetLoopExpression loopExpression) {
|
||||
visitExpression(loopExpression);
|
||||
}
|
||||
|
||||
public void visitConstantExpression(JetConstantExpression expression) {
|
||||
public void visitConstantExpression(@NotNull JetConstantExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
|
||||
visitReferenceExpression(expression);
|
||||
}
|
||||
|
||||
public void visitReferenceExpression(JetReferenceExpression expression) {
|
||||
public void visitReferenceExpression(@NotNull JetReferenceExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitPrefixExpression(JetPrefixExpression expression) {
|
||||
public void visitPrefixExpression(@NotNull JetPrefixExpression expression) {
|
||||
visitUnaryExpression(expression);
|
||||
}
|
||||
|
||||
public void visitPostfixExpression(JetPostfixExpression expression) {
|
||||
public void visitPostfixExpression(@NotNull JetPostfixExpression expression) {
|
||||
visitUnaryExpression(expression);
|
||||
}
|
||||
|
||||
public void visitUnaryExpression(JetUnaryExpression expression) {
|
||||
public void visitUnaryExpression(@NotNull JetUnaryExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitBinaryExpression(JetBinaryExpression expression) {
|
||||
public void visitBinaryExpression(@NotNull JetBinaryExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
@@ -179,231 +180,231 @@ public class JetVisitorVoid extends PsiElementVisitor {
|
||||
// visitExpression(expression);
|
||||
// }
|
||||
//
|
||||
public void visitReturnExpression(JetReturnExpression expression) {
|
||||
public void visitReturnExpression(@NotNull JetReturnExpression expression) {
|
||||
visitLabelQualifiedExpression(expression);
|
||||
}
|
||||
|
||||
public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) {
|
||||
public void visitLabelQualifiedExpression(@NotNull JetLabelQualifiedExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitThrowExpression(JetThrowExpression expression) {
|
||||
public void visitThrowExpression(@NotNull JetThrowExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitBreakExpression(JetBreakExpression expression) {
|
||||
public void visitBreakExpression(@NotNull JetBreakExpression expression) {
|
||||
visitLabelQualifiedExpression(expression);
|
||||
}
|
||||
|
||||
public void visitContinueExpression(JetContinueExpression expression) {
|
||||
public void visitContinueExpression(@NotNull JetContinueExpression expression) {
|
||||
visitLabelQualifiedExpression(expression);
|
||||
}
|
||||
|
||||
public void visitIfExpression(JetIfExpression expression) {
|
||||
public void visitIfExpression(@NotNull JetIfExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitWhenExpression(JetWhenExpression expression) {
|
||||
public void visitWhenExpression(@NotNull JetWhenExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitTryExpression(JetTryExpression expression) {
|
||||
public void visitTryExpression(@NotNull JetTryExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitForExpression(JetForExpression expression) {
|
||||
public void visitForExpression(@NotNull JetForExpression expression) {
|
||||
visitLoopExpression(expression);
|
||||
}
|
||||
|
||||
public void visitWhileExpression(JetWhileExpression expression) {
|
||||
public void visitWhileExpression(@NotNull JetWhileExpression expression) {
|
||||
visitLoopExpression(expression);
|
||||
}
|
||||
|
||||
public void visitDoWhileExpression(JetDoWhileExpression expression) {
|
||||
public void visitDoWhileExpression(@NotNull JetDoWhileExpression expression) {
|
||||
visitLoopExpression(expression);
|
||||
}
|
||||
|
||||
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
||||
public void visitFunctionLiteralExpression(@NotNull JetFunctionLiteralExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitAnnotatedExpression(JetAnnotatedExpression expression) {
|
||||
public void visitAnnotatedExpression(@NotNull JetAnnotatedExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitCallExpression(JetCallExpression expression) {
|
||||
public void visitCallExpression(@NotNull JetCallExpression expression) {
|
||||
visitReferenceExpression(expression);
|
||||
}
|
||||
|
||||
public void visitArrayAccessExpression(JetArrayAccessExpression expression) {
|
||||
public void visitArrayAccessExpression(@NotNull JetArrayAccessExpression expression) {
|
||||
visitReferenceExpression(expression);
|
||||
}
|
||||
|
||||
public void visitQualifiedExpression(JetQualifiedExpression expression) {
|
||||
public void visitQualifiedExpression(@NotNull JetQualifiedExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitCallableReferenceExpression(JetCallableReferenceExpression expression) {
|
||||
public void visitCallableReferenceExpression(@NotNull JetCallableReferenceExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitDotQualifiedExpression(JetDotQualifiedExpression expression) {
|
||||
public void visitDotQualifiedExpression(@NotNull JetDotQualifiedExpression expression) {
|
||||
visitQualifiedExpression(expression);
|
||||
}
|
||||
|
||||
public void visitSafeQualifiedExpression(JetSafeQualifiedExpression expression) {
|
||||
public void visitSafeQualifiedExpression(@NotNull JetSafeQualifiedExpression expression) {
|
||||
visitQualifiedExpression(expression);
|
||||
}
|
||||
|
||||
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) {
|
||||
public void visitObjectLiteralExpression(@NotNull JetObjectLiteralExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitRootNamespaceExpression(JetRootNamespaceExpression expression) {
|
||||
public void visitRootNamespaceExpression(@NotNull JetRootNamespaceExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitBlockExpression(JetBlockExpression expression) {
|
||||
public void visitBlockExpression(@NotNull JetBlockExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitCatchSection(JetCatchClause catchClause) {
|
||||
public void visitCatchSection(@NotNull JetCatchClause catchClause) {
|
||||
visitJetElement(catchClause);
|
||||
}
|
||||
|
||||
public void visitFinallySection(JetFinallySection finallySection) {
|
||||
public void visitFinallySection(@NotNull JetFinallySection finallySection) {
|
||||
visitJetElement(finallySection);
|
||||
}
|
||||
|
||||
public void visitTypeArgumentList(JetTypeArgumentList typeArgumentList) {
|
||||
public void visitTypeArgumentList(@NotNull JetTypeArgumentList typeArgumentList) {
|
||||
visitJetElement(typeArgumentList);
|
||||
}
|
||||
|
||||
public void visitThisExpression(JetThisExpression expression) {
|
||||
public void visitThisExpression(@NotNull JetThisExpression expression) {
|
||||
visitLabelQualifiedExpression(expression);
|
||||
}
|
||||
|
||||
public void visitSuperExpression(JetSuperExpression expression) {
|
||||
public void visitSuperExpression(@NotNull JetSuperExpression expression) {
|
||||
visitLabelQualifiedExpression(expression);
|
||||
}
|
||||
|
||||
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
||||
public void visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitInitializerList(JetInitializerList list) {
|
||||
public void visitInitializerList(@NotNull JetInitializerList list) {
|
||||
visitJetElement(list);
|
||||
}
|
||||
|
||||
public void visitAnonymousInitializer(JetClassInitializer initializer) {
|
||||
public void visitAnonymousInitializer(@NotNull JetClassInitializer initializer) {
|
||||
visitDeclaration(initializer);
|
||||
}
|
||||
|
||||
public void visitPropertyAccessor(JetPropertyAccessor accessor) {
|
||||
public void visitPropertyAccessor(@NotNull JetPropertyAccessor accessor) {
|
||||
visitDeclaration(accessor);
|
||||
}
|
||||
|
||||
public void visitTypeConstraintList(JetTypeConstraintList list) {
|
||||
public void visitTypeConstraintList(@NotNull JetTypeConstraintList list) {
|
||||
visitJetElement(list);
|
||||
}
|
||||
|
||||
public void visitTypeConstraint(JetTypeConstraint constraint) {
|
||||
public void visitTypeConstraint(@NotNull JetTypeConstraint constraint) {
|
||||
visitJetElement(constraint);
|
||||
}
|
||||
|
||||
private void visitTypeElement(JetTypeElement type) {
|
||||
private void visitTypeElement(@NotNull JetTypeElement type) {
|
||||
visitJetElement(type);
|
||||
}
|
||||
|
||||
public void visitUserType(JetUserType type) {
|
||||
public void visitUserType(@NotNull JetUserType type) {
|
||||
visitTypeElement(type);
|
||||
}
|
||||
|
||||
public void visitFunctionType(JetFunctionType type) {
|
||||
public void visitFunctionType(@NotNull JetFunctionType type) {
|
||||
visitTypeElement(type);
|
||||
}
|
||||
|
||||
public void visitSelfType(JetSelfType type) {
|
||||
public void visitSelfType(@NotNull JetSelfType type) {
|
||||
visitTypeElement(type);
|
||||
}
|
||||
|
||||
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) {
|
||||
public void visitBinaryWithTypeRHSExpression(@NotNull JetBinaryExpressionWithTypeRHS expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitStringTemplateExpression(JetStringTemplateExpression expression) {
|
||||
public void visitStringTemplateExpression(@NotNull JetStringTemplateExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitNamedDeclaration(JetNamedDeclaration declaration) {
|
||||
public void visitNamedDeclaration(@NotNull JetNamedDeclaration declaration) {
|
||||
visitDeclaration(declaration);
|
||||
}
|
||||
|
||||
public void visitNullableType(JetNullableType nullableType) {
|
||||
public void visitNullableType(@NotNull JetNullableType nullableType) {
|
||||
visitTypeElement(nullableType);
|
||||
}
|
||||
|
||||
public void visitTypeProjection(JetTypeProjection typeProjection) {
|
||||
public void visitTypeProjection(@NotNull JetTypeProjection typeProjection) {
|
||||
visitJetElement(typeProjection);
|
||||
}
|
||||
|
||||
public void visitWhenEntry(JetWhenEntry jetWhenEntry) {
|
||||
public void visitWhenEntry(@NotNull JetWhenEntry jetWhenEntry) {
|
||||
visitJetElement(jetWhenEntry);
|
||||
}
|
||||
|
||||
public void visitIsExpression(JetIsExpression expression) {
|
||||
public void visitIsExpression(@NotNull JetIsExpression expression) {
|
||||
visitExpression(expression);
|
||||
}
|
||||
|
||||
public void visitWhenConditionIsPattern(JetWhenConditionIsPattern condition) {
|
||||
public void visitWhenConditionIsPattern(@NotNull JetWhenConditionIsPattern condition) {
|
||||
visitJetElement(condition);
|
||||
}
|
||||
|
||||
public void visitWhenConditionInRange(JetWhenConditionInRange condition) {
|
||||
public void visitWhenConditionInRange(@NotNull JetWhenConditionInRange condition) {
|
||||
visitJetElement(condition);
|
||||
}
|
||||
|
||||
public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) {
|
||||
public void visitWhenConditionWithExpression(@NotNull JetWhenConditionWithExpression condition) {
|
||||
visitJetElement(condition);
|
||||
}
|
||||
|
||||
public void visitObjectDeclaration(JetObjectDeclaration declaration) {
|
||||
public void visitObjectDeclaration(@NotNull JetObjectDeclaration declaration) {
|
||||
visitNamedDeclaration(declaration);
|
||||
}
|
||||
|
||||
public void visitObjectDeclarationName(JetObjectDeclarationName declaration) {
|
||||
public void visitObjectDeclarationName(@NotNull JetObjectDeclarationName declaration) {
|
||||
visitNamedDeclaration(declaration);
|
||||
}
|
||||
|
||||
public void visitStringTemplateEntry(JetStringTemplateEntry entry) {
|
||||
public void visitStringTemplateEntry(@NotNull JetStringTemplateEntry entry) {
|
||||
visitJetElement(entry);
|
||||
}
|
||||
|
||||
public void visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry) {
|
||||
public void visitStringTemplateEntryWithExpression(@NotNull JetStringTemplateEntryWithExpression entry) {
|
||||
visitStringTemplateEntry(entry);
|
||||
}
|
||||
|
||||
public void visitBlockStringTemplateEntry(JetBlockStringTemplateEntry entry) {
|
||||
public void visitBlockStringTemplateEntry(@NotNull JetBlockStringTemplateEntry entry) {
|
||||
visitStringTemplateEntryWithExpression(entry);
|
||||
}
|
||||
|
||||
public void visitSimpleNameStringTemplateEntry(JetSimpleNameStringTemplateEntry entry) {
|
||||
public void visitSimpleNameStringTemplateEntry(@NotNull JetSimpleNameStringTemplateEntry entry) {
|
||||
visitStringTemplateEntryWithExpression(entry);
|
||||
}
|
||||
|
||||
public void visitLiteralStringTemplateEntry(JetLiteralStringTemplateEntry entry) {
|
||||
public void visitLiteralStringTemplateEntry(@NotNull JetLiteralStringTemplateEntry entry) {
|
||||
visitStringTemplateEntry(entry);
|
||||
}
|
||||
|
||||
public void visitEscapeStringTemplateEntry(JetEscapeStringTemplateEntry entry) {
|
||||
public void visitEscapeStringTemplateEntry(@NotNull JetEscapeStringTemplateEntry entry) {
|
||||
visitStringTemplateEntry(entry);
|
||||
}
|
||||
|
||||
public void visitMultiDeclaration(JetMultiDeclaration declaration) {
|
||||
public void visitMultiDeclaration(@NotNull JetMultiDeclaration declaration) {
|
||||
visitDeclaration(declaration);
|
||||
}
|
||||
|
||||
public void visitMultiDeclarationEntry(JetMultiDeclarationEntry entry) {
|
||||
public void visitMultiDeclarationEntry(@NotNull JetMultiDeclarationEntry entry) {
|
||||
visitNamedDeclaration(entry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class BodyResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) {
|
||||
public void visitDelegationByExpressionSpecifier(@NotNull JetDelegatorByExpressionSpecifier specifier) {
|
||||
if (descriptor.getKind() == ClassKind.TRAIT) {
|
||||
trace.report(DELEGATION_IN_TRAIT.on(specifier));
|
||||
}
|
||||
@@ -224,7 +224,7 @@ public class BodyResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
||||
public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
|
||||
JetValueArgumentList valueArgumentList = call.getValueArgumentList();
|
||||
PsiElement elementToMark = valueArgumentList == null ? call : valueArgumentList;
|
||||
if (descriptor.getKind() == ClassKind.TRAIT) {
|
||||
@@ -256,7 +256,7 @@ public class BodyResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier) {
|
||||
public void visitDelegationToSuperClassSpecifier(@NotNull JetDelegatorToSuperClass specifier) {
|
||||
JetTypeReference typeReference = specifier.getTypeReference();
|
||||
JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, typeReference);
|
||||
recordSupertype(typeReference, supertype);
|
||||
@@ -270,12 +270,12 @@ public class BodyResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDelegationToThisCall(JetDelegatorToThisCall thisCall) {
|
||||
public void visitDelegationToThisCall(@NotNull JetDelegatorToThisCall thisCall) {
|
||||
throw new IllegalStateException("This-calls should be prohibited by the parser");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
throw new UnsupportedOperationException(element.getText() + " : " + element);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -217,7 +217,7 @@ public class DeclarationResolver {
|
||||
for (JetDeclaration declaration : declarations) {
|
||||
declaration.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitNamedFunction(JetNamedFunction function) {
|
||||
public void visitNamedFunction(@NotNull JetNamedFunction function) {
|
||||
SimpleFunctionDescriptor functionDescriptor = descriptorResolver.resolveFunctionDescriptor(
|
||||
namespaceLike.getOwnerForChildren(),
|
||||
scopeForFunctions,
|
||||
@@ -231,7 +231,7 @@ public class DeclarationResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitProperty(JetProperty property) {
|
||||
public void visitProperty(@NotNull JetProperty property) {
|
||||
PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor(
|
||||
namespaceLike.getOwnerForChildren(),
|
||||
scopeForPropertyInitializers,
|
||||
@@ -252,7 +252,7 @@ public class DeclarationResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitObjectDeclaration(JetObjectDeclaration declaration) {
|
||||
public void visitObjectDeclaration(@NotNull JetObjectDeclaration declaration) {
|
||||
PropertyDescriptor propertyDescriptor = descriptorResolver.resolveObjectDeclarationAsPropertyDescriptor(
|
||||
scopeForFunctions, namespaceLike.getOwnerForChildren(), declaration, context.getObjects().get(declaration), trace);
|
||||
|
||||
@@ -260,7 +260,7 @@ public class DeclarationResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnumEntry(JetEnumEntry enumEntry) {
|
||||
public void visitEnumEntry(@NotNull JetEnumEntry enumEntry) {
|
||||
// FIX: Bad cast
|
||||
MutableClassDescriptorLite classObjectDescriptor =
|
||||
((MutableClassDescriptorLite)namespaceLike.getOwnerForChildren()).getClassObjectDescriptor();
|
||||
|
||||
@@ -440,7 +440,7 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetFile(JetFile file) {
|
||||
public void visitJetFile(@NotNull JetFile file) {
|
||||
NamespaceDescriptorImpl namespaceDescriptor = namespaceFactory.createNamespaceDescriptorPathIfNeeded(
|
||||
file, outerScope, RedeclarationHandler.DO_NOTHING);
|
||||
context.getNamespaceDescriptors().put(file, namespaceDescriptor);
|
||||
@@ -458,14 +458,14 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClass(JetClass klass) {
|
||||
public void visitClass(@NotNull JetClass klass) {
|
||||
MutableClassDescriptor mutableClassDescriptor = createClassDescriptorForClass(klass, owner.getOwnerForChildren());
|
||||
|
||||
owner.addClassifierDescriptor(mutableClassDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitObjectDeclaration(JetObjectDeclaration declaration) {
|
||||
public void visitObjectDeclaration(@NotNull JetObjectDeclaration declaration) {
|
||||
MutableClassDescriptor objectDescriptor =
|
||||
createClassDescriptorForObject(declaration, owner, outerScope, JetPsiUtil.safeName(declaration.getName()),
|
||||
ClassKind.OBJECT);
|
||||
@@ -474,7 +474,7 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnumEntry(JetEnumEntry enumEntry) {
|
||||
public void visitEnumEntry(@NotNull JetEnumEntry enumEntry) {
|
||||
// TODO: Bad casting
|
||||
MutableClassDescriptorLite ownerClassDescriptor = (MutableClassDescriptorLite) owner.getOwnerForChildren();
|
||||
MutableClassDescriptorLite classObjectDescriptor = ownerClassDescriptor.getClassObjectDescriptor();
|
||||
@@ -484,12 +484,12 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTypedef(JetTypedef typedef) {
|
||||
public void visitTypedef(@NotNull JetTypedef typedef) {
|
||||
trace.report(UNSUPPORTED.on(typedef, "TypeHierarchyResolver"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClassObject(JetClassObject classObject) {
|
||||
public void visitClassObject(@NotNull JetClassObject classObject) {
|
||||
JetObjectDeclaration objectDeclaration = classObject.getObjectDeclaration();
|
||||
if (objectDeclaration != null) {
|
||||
Name classObjectName = getClassObjectName(owner.getOwnerForChildren().getName());
|
||||
|
||||
@@ -99,7 +99,7 @@ public class TypeResolver {
|
||||
if (typeElement != null) {
|
||||
typeElement.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitUserType(JetUserType type) {
|
||||
public void visitUserType(@NotNull JetUserType type) {
|
||||
JetSimpleNameExpression referenceExpression = type.getReferenceExpression();
|
||||
String referencedName = type.getReferencedName();
|
||||
if (referenceExpression == null || referencedName == null) {
|
||||
@@ -191,7 +191,7 @@ public class TypeResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitNullableType(JetNullableType nullableType) {
|
||||
public void visitNullableType(@NotNull JetNullableType nullableType) {
|
||||
PossiblyBareType baseType = resolveTypeElement(c, annotations, nullableType.getInnerType());
|
||||
if (baseType.isNullable()) {
|
||||
c.trace.report(REDUNDANT_NULLABLE.on(nullableType));
|
||||
@@ -203,7 +203,7 @@ public class TypeResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitFunctionType(JetFunctionType type) {
|
||||
public void visitFunctionType(@NotNull JetFunctionType type) {
|
||||
JetTypeReference receiverTypeRef = type.getReceiverTypeRef();
|
||||
JetType receiverType = receiverTypeRef == null ? null : resolveType(c.noBareTypes(), receiverTypeRef);
|
||||
|
||||
@@ -224,7 +224,7 @@ public class TypeResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
c.trace.report(UNSUPPORTED.on(element, "Self-types are not supported yet"));
|
||||
}
|
||||
});
|
||||
|
||||
+3
-3
@@ -1143,7 +1143,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
entry.accept(new JetVisitorVoid() {
|
||||
|
||||
@Override
|
||||
public void visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry) {
|
||||
public void visitStringTemplateEntryWithExpression(@NotNull JetStringTemplateEntryWithExpression entry) {
|
||||
JetExpression entryExpression = entry.getExpression();
|
||||
if (entryExpression != null) {
|
||||
JetTypeInfo typeInfo = facade.getTypeInfo(entryExpression, context.replaceDataFlowInfo(dataFlowInfo[0]));
|
||||
@@ -1153,12 +1153,12 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLiteralStringTemplateEntry(JetLiteralStringTemplateEntry entry) {
|
||||
public void visitLiteralStringTemplateEntry(@NotNull JetLiteralStringTemplateEntry entry) {
|
||||
builder.append(entry.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEscapeStringTemplateEntry(JetEscapeStringTemplateEntry entry) {
|
||||
public void visitEscapeStringTemplateEntry(@NotNull JetEscapeStringTemplateEntry entry) {
|
||||
CompileTimeConstant<?> character = CompileTimeConstantResolver.escapedStringToCharValue(entry.getText(), entry);
|
||||
if (character instanceof ErrorValue) {
|
||||
assert character instanceof ErrorValueWithDiagnostic;
|
||||
|
||||
@@ -51,14 +51,14 @@ public class DataFlowUtils {
|
||||
final Ref<DataFlowInfo> result = new Ref<DataFlowInfo>(null);
|
||||
condition.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitIsExpression(JetIsExpression expression) {
|
||||
public void visitIsExpression(@NotNull JetIsExpression expression) {
|
||||
if (conditionValue && !expression.isNegated() || !conditionValue && expression.isNegated()) {
|
||||
result.set(context.trace.get(BindingContext.DATAFLOW_INFO_AFTER_CONDITION, expression));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitBinaryExpression(JetBinaryExpression expression) {
|
||||
public void visitBinaryExpression(@NotNull JetBinaryExpression expression) {
|
||||
IElementType operationToken = expression.getOperationToken();
|
||||
if (OperatorConventions.BOOLEAN_OPERATIONS.containsKey(operationToken)) {
|
||||
DataFlowInfo dataFlowInfo = extractDataFlowInfoFromCondition(expression.getLeft(), conditionValue, context);
|
||||
@@ -110,7 +110,7 @@ public class DataFlowUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitUnaryExpression(JetUnaryExpression expression) {
|
||||
public void visitUnaryExpression(@NotNull JetUnaryExpression expression) {
|
||||
IElementType operationTokenType = expression.getOperationReference().getReferencedNameElementType();
|
||||
if (operationTokenType == JetTokens.EXCL) {
|
||||
JetExpression baseExpression = expression.getBaseExpression();
|
||||
@@ -121,7 +121,7 @@ public class DataFlowUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
||||
public void visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression) {
|
||||
JetExpression body = expression.getExpression();
|
||||
if (body != null) {
|
||||
body.accept(this);
|
||||
|
||||
+4
-4
@@ -178,7 +178,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
|
||||
final Ref<DataFlowInfos> newDataFlowInfo = new Ref<DataFlowInfos>(noChange(context));
|
||||
condition.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitWhenConditionInRange(JetWhenConditionInRange condition) {
|
||||
public void visitWhenConditionInRange(@NotNull JetWhenConditionInRange condition) {
|
||||
JetExpression rangeExpression = condition.getRangeExpression();
|
||||
if (rangeExpression == null) return;
|
||||
if (expectedCondition) {
|
||||
@@ -197,7 +197,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitWhenConditionIsPattern(JetWhenConditionIsPattern condition) {
|
||||
public void visitWhenConditionIsPattern(@NotNull JetWhenConditionIsPattern condition) {
|
||||
if (expectedCondition) {
|
||||
context.trace.report(EXPECTED_CONDITION.on(condition));
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) {
|
||||
public void visitWhenConditionWithExpression(@NotNull JetWhenConditionWithExpression condition) {
|
||||
JetExpression expression = condition.getExpression();
|
||||
if (expression != null) {
|
||||
newDataFlowInfo.set(checkTypeForExpressionCondition(context, expression, subjectType, subjectExpression == null,
|
||||
@@ -222,7 +222,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName()));
|
||||
}
|
||||
});
|
||||
|
||||
+6
-6
@@ -63,7 +63,7 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
|
||||
final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>();
|
||||
psiFile.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetFile(JetFile file) {
|
||||
public void visitJetFile(@NotNull JetFile file) {
|
||||
String qualifiedName = file.getNamespaceHeader().getQualifiedName();
|
||||
if (!qualifiedName.isEmpty()) {
|
||||
NamespaceDescriptor packageDescriptor = resolveSession.getPackageDescriptorByFqName(new FqName(qualifiedName));
|
||||
@@ -73,12 +73,12 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClassObject(JetClassObject classObject) {
|
||||
public void visitClassObject(@NotNull JetClassObject classObject) {
|
||||
classObject.acceptChildren(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitParameter(JetParameter parameter) {
|
||||
public void visitParameter(@NotNull JetParameter parameter) {
|
||||
PsiElement declaringElement = parameter.getParent().getParent();
|
||||
if (declaringElement instanceof JetFunctionType) {
|
||||
return;
|
||||
@@ -108,7 +108,7 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPropertyAccessor(JetPropertyAccessor accessor) {
|
||||
public void visitPropertyAccessor(@NotNull JetPropertyAccessor accessor) {
|
||||
JetProperty parent = (JetProperty) accessor.getParent();
|
||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) resolveSession.resolveToDescriptor(parent);
|
||||
if (accessor.isGetter()) {
|
||||
@@ -120,7 +120,7 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDeclaration(JetDeclaration element) {
|
||||
public void visitDeclaration(@NotNull JetDeclaration element) {
|
||||
DeclarationDescriptor descriptor = resolveSession.resolveToDescriptor(element);
|
||||
descriptors.add(descriptor);
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
@@ -130,7 +130,7 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@ public abstract class AbstractJetParsingTest extends ParsingTestCase {
|
||||
|
||||
myFile.acceptChildren(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
element.acceptChildren(this);
|
||||
try {
|
||||
checkPsiGetters(element);
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.renderer;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.ConfigurationKind;
|
||||
import org.jetbrains.jet.JetLiteFixture;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
@@ -95,7 +96,7 @@ public class DescriptorRendererTest extends JetLiteFixture {
|
||||
final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>();
|
||||
psiFile.acceptChildren(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element);
|
||||
if (descriptor != null) {
|
||||
descriptors.add(descriptor);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.jet.plugin.codeInsight;
|
||||
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
@@ -44,12 +45,12 @@ public class ReferenceToClassesShortening {
|
||||
for (JetElement element : elementsToCompact) {
|
||||
element.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTypeReference(JetTypeReference typeReference) {
|
||||
public void visitTypeReference(@NotNull JetTypeReference typeReference) {
|
||||
super.visitTypeReference(typeReference);
|
||||
|
||||
JetTypeElement typeElement = typeReference.getTypeElement();
|
||||
|
||||
@@ -34,7 +34,7 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
|
||||
declaration.accept(
|
||||
new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitAnonymousInitializer(JetClassInitializer initializer) {
|
||||
public void visitAnonymousInitializer(@NotNull JetClassInitializer initializer) {
|
||||
PsiElement brace = initializer.getOpenBraceNode();
|
||||
if (brace != null) {
|
||||
memberSuspects.add(brace);
|
||||
@@ -42,13 +42,13 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClassObject(JetClassObject classObject) {
|
||||
public void visitClassObject(@NotNull JetClassObject classObject) {
|
||||
PsiElement classKeyword = classObject.getClassKeywordNode();
|
||||
if (classKeyword != null) memberSuspects.add(classKeyword);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitNamedFunction(JetNamedFunction function) {
|
||||
public void visitNamedFunction(@NotNull JetNamedFunction function) {
|
||||
PsiElement equalsToken = function.getEqualsToken();
|
||||
if (equalsToken != null) memberSuspects.add(equalsToken);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitProperty(JetProperty property) {
|
||||
public void visitProperty(@NotNull JetProperty property) {
|
||||
PsiElement valOrVarNode = property.getValOrVarNode().getPsi();
|
||||
if (valOrVarNode != null) memberSuspects.add(valOrVarNode);
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ public class JetImportOptimizer implements ImportOptimizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitUserType(JetUserType type) {
|
||||
public void visitUserType(@NotNull JetUserType type) {
|
||||
if (type.getQualifier() == null) {
|
||||
super.visitUserType(type);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class JetImportOptimizer implements ImportOptimizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitReferenceExpression(JetReferenceExpression expression) {
|
||||
public void visitReferenceExpression(@NotNull JetReferenceExpression expression) {
|
||||
if (PsiTreeUtil.getParentOfType(expression, JetImportDirective.class) == null &&
|
||||
PsiTreeUtil.getParentOfType(expression, JetNamespaceHeader.class) == null) {
|
||||
|
||||
@@ -161,7 +161,7 @@ public class JetImportOptimizer implements ImportOptimizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitForExpression(JetForExpression expression) {
|
||||
public void visitForExpression(@NotNull JetForExpression expression) {
|
||||
BindingContext context = AnalyzerFacadeWithCache.getContextForElement(expression);
|
||||
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.LOOP_RANGE_ITERATOR_RESOLVED_CALL, expression.getLoopRange());
|
||||
addResolvedCallFqName(resolvedCall);
|
||||
@@ -170,7 +170,7 @@ public class JetImportOptimizer implements ImportOptimizer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMultiDeclaration(JetMultiDeclaration declaration) {
|
||||
public void visitMultiDeclaration(@NotNull JetMultiDeclaration declaration) {
|
||||
BindingContext context = AnalyzerFacadeWithCache.getContextForElement(declaration);
|
||||
List<JetMultiDeclarationEntry> entries = declaration.getEntries();
|
||||
for (JetMultiDeclarationEntry entry : entries) {
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.jet.plugin.hierarchy.calls;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
@@ -38,14 +39,14 @@ public abstract class CalleeReferenceVisitorBase extends JetTreeVisitorVoid {
|
||||
protected abstract void processDeclaration(JetReferenceExpression reference, PsiElement declaration);
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
if (deepTraversal || !(element instanceof JetClassOrObject || element instanceof JetNamedFunction)) {
|
||||
super.visitJetElement(element);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
|
||||
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
|
||||
if (descriptor == null) return;
|
||||
|
||||
|
||||
@@ -51,12 +51,12 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSuperExpression(JetSuperExpression expression) {
|
||||
public void visitSuperExpression(@NotNull JetSuperExpression expression) {
|
||||
// Deprecated for super expression. Unnecessary to mark it as Deprecated
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitReferenceExpression(JetReferenceExpression expression) {
|
||||
public void visitReferenceExpression(@NotNull JetReferenceExpression expression) {
|
||||
super.visitReferenceExpression(expression);
|
||||
ResolvedCall resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression);
|
||||
if (resolvedCall != null && resolvedCall instanceof VariableAsFunctionResolvedCall) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.plugin.highlighter;
|
||||
|
||||
import com.intellij.lang.annotation.AnnotationHolder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
@@ -34,7 +35,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitNamedFunction(JetNamedFunction function) {
|
||||
public void visitNamedFunction(@NotNull JetNamedFunction function) {
|
||||
PsiElement nameIdentifier = function.getNameIdentifier();
|
||||
if (nameIdentifier != null) {
|
||||
JetPsiChecker.highlightName(holder, nameIdentifier, JetHighlightingColors.FUNCTION_DECLARATION);
|
||||
@@ -44,7 +45,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) {
|
||||
public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
|
||||
JetConstructorCalleeExpression calleeExpression = call.getCalleeExpression();
|
||||
JetTypeReference typeRef = calleeExpression.getTypeReference();
|
||||
if (typeRef != null) {
|
||||
@@ -60,7 +61,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCallExpression(JetCallExpression expression) {
|
||||
public void visitCallExpression(@NotNull JetCallExpression expression) {
|
||||
JetExpression callee = expression.getCalleeExpression();
|
||||
if (callee instanceof JetReferenceExpression) {
|
||||
ResolvedCall<? extends CallableDescriptor> resolvedCall =
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.jet.plugin.highlighter;
|
||||
|
||||
import com.intellij.lang.annotation.AnnotationHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetLabelQualifiedExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetPrefixExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
|
||||
@@ -28,7 +29,7 @@ class LabelsHighlightingVisitor extends HighlightingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPrefixExpression(JetPrefixExpression expression) {
|
||||
public void visitPrefixExpression(@NotNull JetPrefixExpression expression) {
|
||||
JetSimpleNameExpression operationSign = expression.getOperationReference();
|
||||
if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) {
|
||||
JetPsiChecker.highlightName(holder, operationSign, JetHighlightingColors.LABEL);
|
||||
@@ -36,7 +37,7 @@ class LabelsHighlightingVisitor extends HighlightingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) {
|
||||
public void visitLabelQualifiedExpression(@NotNull JetLabelQualifiedExpression expression) {
|
||||
JetSimpleNameExpression targetLabel = expression.getTargetLabel();
|
||||
if (targetLabel != null) {
|
||||
JetPsiChecker.highlightName(holder, targetLabel, JetHighlightingColors.LABEL);
|
||||
|
||||
@@ -34,7 +34,7 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
|
||||
if (expression.getParent() instanceof JetThisExpression) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
@@ -49,7 +50,7 @@ class SoftKeywordsHighlightingVisitor extends HighlightingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) {
|
||||
public void visitFunctionLiteralExpression(@NotNull JetFunctionLiteralExpression expression) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) return;
|
||||
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
|
||||
holder.createInfoAnnotation(functionLiteral.getOpenBraceNode(), null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW);
|
||||
|
||||
@@ -31,7 +31,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
|
||||
PsiReference ref = expression.getReference();
|
||||
if (ref == null) return;
|
||||
if (JetPsiChecker.isNamesHighlightingEnabled()) {
|
||||
@@ -50,7 +50,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTypeParameter(JetTypeParameter parameter) {
|
||||
public void visitTypeParameter(@NotNull JetTypeParameter parameter) {
|
||||
PsiElement identifier = parameter.getNameIdentifier();
|
||||
if (identifier != null) {
|
||||
JetPsiChecker.highlightName(holder, identifier, JetHighlightingColors.TYPE_PARAMETER);
|
||||
@@ -59,7 +59,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClass(JetClass klass) {
|
||||
public void visitClass(@NotNull JetClass klass) {
|
||||
PsiElement identifier = klass.getNameIdentifier();
|
||||
ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, klass);
|
||||
if (identifier != null && classDescriptor != null) {
|
||||
|
||||
@@ -59,7 +59,7 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitParameter(JetParameter parameter) {
|
||||
public void visitParameter(@NotNull JetParameter parameter) {
|
||||
visitVariableDeclaration(parameter);
|
||||
super.visitParameter(parameter);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class MigrateSureInProjectFix extends JetIntentionAction<PsiElement> {
|
||||
declaration.acceptChildren(new JetVisitorVoid() {
|
||||
|
||||
@Override
|
||||
public void visitCallExpression(JetCallExpression expression) {
|
||||
public void visitCallExpression(@NotNull JetCallExpression expression) {
|
||||
expression.acceptChildren(this);
|
||||
|
||||
if (!isUnresolvedSure(expression.getCalleeExpression())) return;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class RemoveValVarFromParametersFix implements IntentionAction {
|
||||
for (JetFile jetFile : files) {
|
||||
jetFile.acceptChildren(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitParameter(JetParameter parameter) {
|
||||
public void visitParameter(@NotNull JetParameter parameter) {
|
||||
visitJetElement(parameter); // run recursively for children
|
||||
|
||||
PsiElement parent = parameter.getParent();
|
||||
@@ -75,7 +75,7 @@ public class RemoveValVarFromParametersFix implements IntentionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.jet.plugin.refactoring;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
@@ -213,13 +214,13 @@ public class JetNameSuggester {
|
||||
private static void addNamesForExpression(final ArrayList<String> result, JetExpression expression, final JetNameValidator validator) {
|
||||
expression.accept(new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitQualifiedExpression(JetQualifiedExpression expression) {
|
||||
public void visitQualifiedExpression(@NotNull JetQualifiedExpression expression) {
|
||||
JetExpression selectorExpression = expression.getSelectorExpression();
|
||||
addNamesForExpression(result, selectorExpression, validator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSimpleNameExpression(JetSimpleNameExpression expression) {
|
||||
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
|
||||
String referenceName = expression.getReferencedName();
|
||||
if (referenceName.equals(referenceName.toUpperCase())) {
|
||||
addName(result, referenceName, validator);
|
||||
@@ -230,12 +231,12 @@ public class JetNameSuggester {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCallExpression(JetCallExpression expression) {
|
||||
public void visitCallExpression(@NotNull JetCallExpression expression) {
|
||||
addNamesForExpression(result, expression.getCalleeExpression(), validator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPostfixExpression(JetPostfixExpression expression) {
|
||||
public void visitPostfixExpression(@NotNull JetPostfixExpression expression) {
|
||||
addNamesForExpression(result, expression.getBaseExpression(), validator);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.jet.plugin.refactoring;
|
||||
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetExpression;
|
||||
@@ -79,7 +80,7 @@ public class JetNameValidatorImpl extends JetNameValidator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitExpression(JetExpression expression) {
|
||||
public void visitExpression(@NotNull JetExpression expression) {
|
||||
Collection<DeclarationDescriptor> variants =
|
||||
TipsManager.getVariantsNoReceiver(expression, myBindingContext);
|
||||
for (DeclarationDescriptor variant : variants) {
|
||||
|
||||
+2
-2
@@ -437,13 +437,13 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase {
|
||||
|
||||
JetVisitorVoid visitor = new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
public void visitJetElement(@NotNull JetElement element) {
|
||||
element.acceptChildren(this);
|
||||
super.visitJetElement(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitExpression(JetExpression expression) {
|
||||
public void visitExpression(@NotNull JetExpression expression) {
|
||||
if (PsiEquivalenceUtil.areElementsEquivalent(expression, actualExpression, null, new Comparator<PsiElement>() {
|
||||
@Override
|
||||
public int compare(PsiElement element1, PsiElement element2) {
|
||||
|
||||
Reference in New Issue
Block a user