'For JavaScript-in-the-browser the top-level scope is the
Window object instance. For now we are always presuming we
are running in the browser if the language is JavaScript.
Problem: if we *started* on the Window class then the parent
scope should be -> built-in-blob. This is what
\'started_in_builtin_window_scope\' is used for.'

def parent_scoperef_from_scoperef(self, scoperef, started_in_builtin_window_scope=False):

    (blob, lpath) = scoperef
    global_var = self._global_var
    if ((not started_in_builtin_window_scope) and (lpath == [global_var]) and (blob is self.built_in_blob)):
        return None
    elif lpath:
        return (blob, lpath[:(-1)])
    elif (blob is self.built_in_blob):
        if started_in_builtin_window_scope:
            return None
        elif (global_var is not None):
            return (self.built_in_blob, [global_var])
    else:
        return (self.built_in_blob, [])
