/**
   * Search for magic variables using the @property tag
   *
   * @param types
   * @param variableName
   * @param cache
   */
  private void resolveMagicClassVariableDeclaration(
      IType[] types, String variableName, IModelAccessCache cache) {
    for (IType type : types) {
      resolveMagicClassVariableDeclaration(variableName, type, cache);
      try {
        if (evaluated.isEmpty()
            && type.getSuperClasses() != null
            && type.getSuperClasses().length > 0) {

          ITypeHierarchy hierarchy = null;
          if (cache != null) {
            hierarchy = cache.getSuperTypeHierarchy(type, null);
          }
          IType[] superClasses = PHPModelUtils.getSuperClasses(type, hierarchy);

          for (int i = 0; i < superClasses.length /* && evaluated.isEmpty() */; i++) {
            IType superClass = superClasses[i];
            resolveMagicClassVariableDeclaration(variableName, superClass, cache);
          }
        }
      } catch (ModelException e) {
        e.printStackTrace();
      }
    }
  }
Пример #2
0
  public boolean endvisit(TypeDeclaration type) throws Exception {
    if (type instanceof NamespaceDeclaration) {
      NamespaceDeclaration namespaceDecl = (NamespaceDeclaration) type;
      while (deferredNamespacedDeclarations != null && !deferredNamespacedDeclarations.isEmpty()) {
        final ASTNode[] declarations =
            deferredNamespacedDeclarations.toArray(
                new ASTNode[deferredNamespacedDeclarations.size()]);
        deferredNamespacedDeclarations.clear();

        for (ASTNode deferred : declarations) {
          deferred.traverse(this);
        }
      }

      fCurrentNamespace = null; // there are no nested namespaces
      fCurrentQualifier = null;
      fLastUseParts.clear();
      if (namespaceDecl.isGlobal()) {
        return visitGeneral(type);
      }
    } else {
      fCurrentParent = null;
    }
    declarations.pop();

    // resolve more type member declarations
    resolveMagicMembers(type);

    for (PhpIndexingVisitorExtension visitor : extensions) {
      visitor.endvisit(type);
    }

    endvisitGeneral(type);
    return true;
  }
  public boolean endvisit(TypeDeclaration type) throws Exception {
    if (type instanceof NamespaceDeclaration) {
      NamespaceDeclaration namespaceDecl = (NamespaceDeclaration) type;
      while (deferredNamespacedDeclarations != null && !deferredNamespacedDeclarations.isEmpty()) {
        final ASTNode[] declarations =
            deferredNamespacedDeclarations.toArray(
                new ASTNode[deferredNamespacedDeclarations.size()]);
        deferredNamespacedDeclarations.clear();

        for (ASTNode deferred : declarations) {
          deferred.traverse(this);
        }
      }
      fLastNamespace = null; // there are no nested namespaces
      if (namespaceDecl.isGlobal()) {
        return true;
      }
    }

    declarations.pop();

    // resolve more type member declarations
    resolveMagicMembers(type);

    for (PHPSourceElementRequestorExtension visitor : extensions) {
      visitor.endvisit(type);
    }

    return super.endvisit(type);
  }
Пример #4
0
 public boolean endvisit(ModuleDeclaration s) throws Exception {
   List<ASTError> errors = ((PHPModuleDeclaration) s).getErrors();
   if (!errors.isEmpty()) {
     xmlWriter.startTag("Errors", null);
     for (ASTError error : errors) {
       error.traverse(this);
     }
     xmlWriter.endTag("Errors");
   }
   xmlWriter.endTag("ModuleDeclaration");
   return true;
 }
  public boolean endvisit(ModuleDeclaration declaration) throws Exception {
    for (PHPSourceElementRequestorExtension visitor : extensions) {
      visitor.endvisit(declaration);
    }

    while (deferredDeclarations != null && !deferredDeclarations.isEmpty()) {
      final ASTNode[] declarations =
          deferredDeclarations.toArray(new ASTNode[deferredDeclarations.size()]);
      deferredDeclarations.clear();

      for (ASTNode deferred : declarations) {
        deferred.traverse(this);
      }
    }
    fLastUseParts.clear();
    return super.endvisit(declaration);
  }
Пример #6
0
  public boolean endvisit(ModuleDeclaration declaration) throws Exception {
    while (deferredDeclarations != null && !deferredDeclarations.isEmpty()) {
      final ASTNode[] declarations =
          deferredDeclarations.toArray(new ASTNode[deferredDeclarations.size()]);
      deferredDeclarations.clear();

      for (ASTNode deferred : declarations) {
        deferred.traverse(this);
      }
    }

    for (PhpIndexingVisitorExtension visitor : extensions) {
      visitor.endvisit(declaration);
    }

    fLastUseParts.clear();
    endvisitGeneral(declaration);
    return true;
  }