code: public VariableRef[] getOutOfScopeVariableRefs() {
          Scope parent;
          if ((parent = getParent()) == null) {
              return new VariableRef[0];
          }
  
          Collection<VariableRef> allRefs = new ArrayList<VariableRef>();
          fillVariableRefs(allRefs, this);
  
          Collection<VariableRef> refs =
              new ArrayList<VariableRef>(allRefs.size());
  
          Iterator<VariableRef> it = allRefs.iterator();
          while (it.hasNext()) {
              VariableRef ref = it.next();
              Variable var = ref.getVariable();
              if (var != null &&
                  parent.getDeclaredVariable(var.getName()) == var) {
                  refs.add(ref);
              }
          }
  
          VariableRef[] refsArray = new VariableRef[refs.size()];
          return refs.toArray(refsArray);
      }
docs: Returns all the references made from this scope and all child scopes to
  variables declared outside of this scope.