if (tokenAndQual != null && selected.size() > 0) {
for (IDefinition d : selected) {
Definition def = (Definition) d;
SimpleNode astToPrint = null;
if (def.ast != null) {
astToPrint = def.ast;
if ((astToPrint instanceof Name || astToPrint instanceof NameTok) && def.scope != null) {
//There's no real point in just printing the name, let's see if we're able to actually find
//the scope where it's in and print that scope.
FastStack<SimpleNode> scopeStack = def.scope.getScopeStack();
if (scopeStack != null && scopeStack.size() > 0) {
SimpleNode peek = scopeStack.peek();
if (peek != null) {
stmtType stmt = NodeUtils.findStmtForNode(peek, astToPrint);
if (stmt != null) {
astToPrint = stmt;
}