示例#1
0
  public boolean visit(PHPFieldDeclaration decl) throws Exception {
    // This is variable declaration:
    int modifiers = markAsDeprecated(decl.getModifiers(), decl);

    StringBuilder metadata = new StringBuilder();
    if (fCurrentQualifier != null) {
      metadata.append(fCurrentQualifierCounts.get(fCurrentQualifier));
      metadata.append(";"); // $NON-NLS-1$
    }

    modifyDeclaration(
        decl,
        new DeclarationInfo(
            IModelElement.FIELD,
            modifiers,
            decl.sourceStart(),
            decl.sourceEnd() - decl.sourceStart(),
            decl.getNameStart(),
            decl.getNameEnd() - decl.getNameStart(),
            decl.getName(),
            metadata.length() == 0 ? null : metadata.toString(),
            encodeDocInfo(decl),
            fCurrentQualifier,
            fCurrentParent));

    return visitGeneral(decl);
  }
 public boolean visit(Statement e) throws Exception {
   if (typeDeclaration.sourceStart() < e.sourceStart()
       && typeDeclaration.sourceEnd() > e.sourceEnd()) {
     if (e instanceof PHPFieldDeclaration) {
       PHPFieldDeclaration phpFieldDecl = (PHPFieldDeclaration) e;
       if (phpFieldDecl.getDeclarationStart() == offset
           && phpFieldDecl.sourceEnd() - phpFieldDecl.getDeclarationStart() == length) {
         result = ((PHPFieldDeclaration) e).getVariableValue();
         if (result instanceof Scalar) {
           Scalar scalar = (Scalar) result;
           if (scalar.getScalarType() == Scalar.TYPE_STRING
               && scalar.getValue().toLowerCase().equals(NULL)) {
             result = null;
           }
         }
         context = contextStack.peek();
       }
     }
   }
   return visitGeneral(e);
 }
 public boolean endvisit(PHPFieldDeclaration declaration) throws Exception {
   fRequestor.exitField(declaration.sourceEnd() - 1);
   fInfoStack.pop();
   return true;
 }