/**
  * The scope that we should declare this function in, if it needs to be declared in a scope.
  * Notice that TypedScopeCreator takes care of most scope-declaring.
  */
 private Scope getScopeDeclaredIn() {
   int dotIndex = fnName.indexOf(".");
   if (dotIndex != -1) {
     String rootVarName = fnName.substring(0, dotIndex);
     Var rootVar = scope.getVar(rootVarName);
     if (rootVar != null) {
       return rootVar.getScope();
     }
   }
   return scope;
 }