示例#1
0
 private void resolvePropertyInitializer(
     JetProperty property,
     PropertyDescriptor propertyDescriptor,
     JetExpression initializer,
     JetScope scope) {
   // JetFlowInformationProvider flowInformationProvider =
   // context.getDescriptorResolver().computeFlowData(property, initializer); // TODO : flow JET-15
   JetType expectedTypeForInitializer =
       property.getPropertyTypeRef() != null ? propertyDescriptor.getType() : NO_EXPECTED_TYPE;
   JetType type =
       expressionTypingServices.getType(
           descriptorResolver.getPropertyDeclarationInnerScope(
               scope,
               propertyDescriptor,
               propertyDescriptor.getTypeParameters(),
               propertyDescriptor.getReceiverParameter(),
               trace),
           initializer,
           expectedTypeForInitializer,
           trace);
   //
   //        JetType expectedType = propertyDescriptor.getInType();
   //        if (expectedType == null) {
   //            expectedType = propertyDescriptor.getType();
   //        }
   //        if (type != null && expectedType != null
   //            && !context.getSemanticServices().getTypeChecker().isSubtypeOf(type,
   // expectedType)) {
   ////            trace.report(TYPE_MISMATCH.on(initializer, expectedType, type));
   //        }
 }
示例#2
0
  private JetScope makeScopeForPropertyAccessor(
      @NotNull JetPropertyAccessor accessor, PropertyDescriptor propertyDescriptor) {
    JetScope declaringScope = context.getDeclaringScopes().get(accessor);

    JetScope propertyDeclarationInnerScope =
        descriptorResolver.getPropertyDeclarationInnerScope(
            declaringScope,
            propertyDescriptor,
            propertyDescriptor.getTypeParameters(),
            propertyDescriptor.getReceiverParameter(),
            trace);
    WritableScope accessorScope =
        new WritableScopeImpl(
                propertyDeclarationInnerScope,
                declaringScope.getContainingDeclaration(),
                new TraceBasedRedeclarationHandler(trace))
            .setDebugName("Accessor scope");
    accessorScope.changeLockLevel(WritableScope.LockLevel.READING);

    return accessorScope;
  }