* @param fallbackBaseName The fallback base name.
* @return The base placeholder (or plural/select var) name for the given expression.
*/
static String genBaseNameFromExpr(ExprRootNode<?> exprRoot, String fallbackBaseName) {
ExprNode exprNode = exprRoot.getChild(0);
if (exprNode instanceof DataRefNode) {
DataRefNode dataRefNode = (DataRefNode) exprNode;
if (dataRefNode.numChildren() > 0) {
ExprNode lastChild = dataRefNode.getChild(dataRefNode.numChildren() - 1);
// Only handle if last child is a key. Else, fall through.
if (lastChild instanceof DataRefAccessKeyNode) {
return BaseUtils.convertToUpperUnderscore(((DataRefAccessKeyNode) lastChild).getKey());
}
} else {