Esempio n. 1
0
 @NotNull
 private static LexicalScope getScopeForProperty(
     @NotNull BodiesResolveContext c, @NotNull JetProperty property) {
   LexicalScope scope = c.getDeclaringScope(property);
   assert scope != null : "Scope for property " + property.getText() + " should exists";
   return scope;
 }
Esempio n. 2
0
 private LexicalScope makeScopeForPropertyAccessor(
     @NotNull BodiesResolveContext c,
     @NotNull JetPropertyAccessor accessor,
     @NotNull PropertyDescriptor descriptor) {
   LexicalScope accessorDeclaringScope = c.getDeclaringScope(accessor);
   assert accessorDeclaringScope != null
       : "Scope for accessor " + accessor.getText() + " should exists";
   return JetScopeUtils.makeScopeForPropertyAccessor(descriptor, accessorDeclaringScope, trace);
 }
Esempio n. 3
0
 private void resolveSecondaryConstructors(@NotNull BodiesResolveContext c) {
   for (Map.Entry<JetSecondaryConstructor, ConstructorDescriptor> entry :
       c.getSecondaryConstructors().entrySet()) {
     LexicalScope declaringScope = c.getDeclaringScope(entry.getKey());
     assert declaringScope != null : "Declaring scope should be registered before body resolve";
     resolveSecondaryConstructorBody(
         c.getOuterDataFlowInfo(), trace, entry.getKey(), entry.getValue(), declaringScope);
   }
   if (c.getSecondaryConstructors().isEmpty()) return;
   Set<ConstructorDescriptor> visitedConstructors = Sets.newHashSet();
   for (Map.Entry<JetSecondaryConstructor, ConstructorDescriptor> entry :
       c.getSecondaryConstructors().entrySet()) {
     checkCyclicConstructorDelegationCall(entry.getValue(), visitedConstructors);
   }
 }
Esempio n. 4
0
  private void resolveFunctionBodies(@NotNull BodiesResolveContext c) {
    for (Map.Entry<JetNamedFunction, SimpleFunctionDescriptor> entry :
        c.getFunctions().entrySet()) {
      JetNamedFunction declaration = entry.getKey();

      LexicalScope scope = c.getDeclaringScope(declaration);
      assert scope != null
          : "Scope is null: " + PsiUtilPackage.getElementTextWithContext(declaration);

      if (!c.getTopDownAnalysisMode().getIsLocalDeclarations()
          && !(bodyResolveCache instanceof BodyResolveCache.ThrowException)
          && expressionTypingServices.getStatementFilter() != StatementFilter.NONE) {
        bodyResolveCache.resolveFunctionBody(declaration).addOwnDataTo(trace, true);
      } else {
        resolveFunctionBody(c.getOuterDataFlowInfo(), trace, declaration, entry.getValue(), scope);
      }
    }
  }