/**
  * Simply return if the image start with keyword 'this' or 'super'.
  *
  * @return true, if keyword is used, false otherwise.
  */
 public boolean useThisOrSuper() {
   Node node = location.jjtGetParent();
   if (node instanceof ASTPrimaryExpression) {
     ASTPrimaryExpression primaryExpression = (ASTPrimaryExpression) node;
     ASTPrimaryPrefix prefix = (ASTPrimaryPrefix) primaryExpression.jjtGetChild(0);
     if (prefix != null) {
       return prefix.usesSuperModifier() || prefix.usesThisModifier();
     }
   }
   return image.startsWith(THIS_DOT) || image.startsWith(SUPER_DOT);
 }
Exemplo n.º 2
0
 private String getExpressionVarName(Node e) {
   String assignedVar = getFirstNameImage(e);
   if (assignedVar == null) {
     ASTPrimarySuffix suffix = e.getFirstDescendantOfType(ASTPrimarySuffix.class);
     if (suffix != null) {
       assignedVar = suffix.getImage();
       ASTPrimaryPrefix prefix = e.getFirstDescendantOfType(ASTPrimaryPrefix.class);
       if (prefix != null) {
         if (prefix.usesThisModifier()) {
           assignedVar = "this." + assignedVar;
         } else if (prefix.usesSuperModifier()) {
           assignedVar = "super." + assignedVar;
         }
       }
     }
   }
   return assignedVar;
 }