'Returns the task list for this role, which is created by first
recursively compiling the tasks for all direct dependencies, and
then adding on the tasks for this role.
The role compile() also remembers and saves the dependency chain
with each task, so tasks know by which route they were found, and
can correctly take their parent\'s tags/conditionals into account.'

def compile(self, play, dep_chain=None):

    block_list = []
    if (dep_chain is None):
        dep_chain = []
    new_dep_chain = (dep_chain + [self])
    deps = self.get_direct_dependencies()
    for dep in deps:
        dep_blocks = dep.compile(play=play, dep_chain=new_dep_chain)
        block_list.extend(dep_blocks)
    for (idx, task_block) in enumerate(self._task_blocks):
        new_task_block = task_block.copy(exclude_parent=True)
        if task_block._parent:
            new_task_block._parent = task_block._parent.copy()
        new_task_block._dep_chain = new_dep_chain
        new_task_block._play = play
        if (idx == (len(self._task_blocks) - 1)):
            new_task_block._eor = True
        block_list.append(new_task_block)
    return block_list
