Esempio n. 1
0
    def _print_FunctionDefinition(self, fd):
        if elemental in fd.attrs:
            prefix = 'elemental '
        elif pure in fd.attrs:
            prefix = 'pure '
        else:
            prefix = ''

        entity = "{0} function ".format(self._print(fd.return_type))
        with printer_context(self, result_name=fd.name):
            return ("{prefix}{function_head}\n"
                    "{body}\n"
                    "end function\n").format(prefix=prefix,
                                             function_head=self._head(
                                                 entity, fd),
                                             body=self._print(fd.body))
Esempio n. 2
0
    def _print_FunctionDefinition(self, fd):
        if elemental in fd.attrs:
            prefix = 'elemental '
        elif pure in fd.attrs:
            prefix = 'pure '
        else:
            prefix = ''

        entity = "{0} function ".format(self._print(fd.return_type))
        with printer_context(self, result_name=fd.name):
            return (
                "{prefix}{function_head}\n"
                "{body}\n"
                "end function\n"
            ).format(
                prefix=prefix,
                function_head=self._head(entity, fd),
                body=self._print(fd.body)
            )