def dispatch(self, tree):
        """Dispatcher function, dispatching tree type T to method _T."""
        # display omp directive in python dump
        for omp in metadata.get(tree, openmp.OMPDirective):
            deps = list()
            for dep in omp.deps:
                old_file = self.f
                self.f = io.StringIO()
                self.dispatch(dep)
                deps.append(self.f.getvalue())
                self.f = old_file
            directive = omp.s.format(*deps)
            self._Expr(ast.Expr(ast.Str(s=directive)))

        if isinstance(tree, list):
            for t in tree:
                self.dispatch(t)
            return
        meth = getattr(self, "_" + tree.__class__.__name__)
        meth(tree)
def dispatch ( self , tree ) : for omp in metadata . get ( tree , openmp . OMPDirective ) : deps = list ( ) for dep in omp . deps : old_file = self . f self . f = io . StringIO ( ) self . dispatch ( dep ) deps . append ( self . f . getvalue ( ) ) self . f = old_file directive = omp . s . format ( * deps ) self . _Expr ( ast . Expr ( ast . Str ( s = directive ) ) ) if isinstance ( tree , list ) : for t in tree : self . dispatch ( t ) return meth = getattr ( self , "_" + tree . __class__ . __name__ ) meth ( tree )
Dispatcher function, dispatching tree type T to method _T.