Search in sources :

Example 1 with VariableExpression

use of apex.jorje.semantic.ast.expression.VariableExpression in project pmd by pmd.

the class Helper method getFQVariableName.

static String getFQVariableName(final ASTVariableExpression variable) {
    final ASTReferenceExpression ref = variable.getFirstChildOfType(ASTReferenceExpression.class);
    String objectName = "";
    if (ref != null) {
        if (ref.getNode().getNames().size() == 1) {
            objectName = ref.getNode().getNames().get(0).getValue() + ".";
        }
    }
    VariableExpression n = variable.getNode();
    StringBuilder sb = new StringBuilder().append(n.getDefiningType().getApexName()).append(":").append(objectName).append(n.getIdentifier().getValue());
    return sb.toString();
}
Also used : ASTReferenceExpression(net.sourceforge.pmd.lang.apex.ast.ASTReferenceExpression) VariableExpression(apex.jorje.semantic.ast.expression.VariableExpression) ASTVariableExpression(net.sourceforge.pmd.lang.apex.ast.ASTVariableExpression)

Aggregations

VariableExpression (apex.jorje.semantic.ast.expression.VariableExpression)1 ASTReferenceExpression (net.sourceforge.pmd.lang.apex.ast.ASTReferenceExpression)1 ASTVariableExpression (net.sourceforge.pmd.lang.apex.ast.ASTVariableExpression)1