예제 #1
0
 public static boolean isVariableIterable(
     @NotNull ExpressionTypingServices expressionTypingServices,
     @NotNull Project project,
     @NotNull VariableDescriptor variableDescriptor,
     @NotNull JetScope scope) {
   JetExpression expression = JetPsiFactory.createExpression(project, "fake");
   ExpressionReceiver expressionReceiver =
       new ExpressionReceiver(expression, variableDescriptor.getType());
   ExpressionTypingContext context =
       ExpressionTypingContext.newContext(
           expressionTypingServices,
           new HashMap<JetPattern, DataFlowInfo>(),
           new HashMap<JetPattern, List<VariableDescriptor>>(),
           new LabelResolver(),
           new BindingTraceContext(),
           scope,
           DataFlowInfo.EMPTY,
           TypeUtils.NO_EXPECTED_TYPE,
           TypeUtils.NO_EXPECTED_TYPE,
           false);
   return ControlStructureTypingVisitor.checkIterableConvention(expressionReceiver, context)
       != null;
 }
 @Override
 public JetTypeInfo visitIfExpression(
     JetIfExpression expression, ExpressionTypingContext context) {
   return controlStructures.visitIfExpression(expression, context, true);
 }