public boolean visit(ConstantDeclaration declaration) throws Exception {
    ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo();
    info.modifiers = Modifiers.AccConstant | Modifiers.AccPublic | Modifiers.AccFinal;
    ConstantReference constantName = declaration.getConstantName();
    info.name = ASTUtils.stripQuotes(constantName.getName());
    info.nameSourceEnd = constantName.sourceEnd() - 1;
    info.nameSourceStart = constantName.sourceStart();
    info.declarationStart = declaration.sourceStart();
    info.modifiers = markAsDeprecated(info.modifiers, declaration);

    fInfoStack.push(info);
    fRequestor.enterField(info);
    return true;
  }
Пример #2
0
 public boolean visit(ConstantDeclaration declaration) throws Exception {
   int modifiers = Modifiers.AccConstant | Modifiers.AccPublic | Modifiers.AccFinal;
   if (fCurrentParent != null) {
     modifiers = modifiers | PHPCoreConstants.AccClassField;
   }
   modifiers = markAsDeprecated(modifiers, declaration);
   ConstantReference constantName = declaration.getConstantName();
   int offset = constantName.sourceStart();
   int length = constantName.sourceEnd();
   StringBuilder metadata = new StringBuilder();
   if (fCurrentQualifier != null) {
     metadata.append(fCurrentQualifierCounts.get(fCurrentQualifier));
     metadata.append(";"); // $NON-NLS-1$
   }
   modifyDeclaration(
       declaration,
       new DeclarationInfo(
           IModelElement.FIELD,
           modifiers,
           offset,
           length,
           offset,
           length,
           ASTUtils.stripQuotes(constantName.getName()),
           metadata.length() == 0 ? null : metadata.toString(),
           encodeDocInfo(declaration),
           fCurrentQualifier,
           fCurrentParent));
   return visitGeneral(declaration);
 }
 public boolean endvisit(ConstantDeclaration declaration) throws Exception {
   fRequestor.exitField(declaration.sourceEnd() - 1);
   fInfoStack.pop();
   return true;
 }