Пример #1
0
 def get_program(self, condition):
     return ast.Program(
         [],  # No local variable
         [
             ast.If(
                 condition,
                 ast.TaggedNode(ON_TRUE_TAG,
                                ast.Return(ast.LitteralBoolean(True))),
                 ast.TaggedNode(ON_FALSE_TAG,
                                ast.Return(ast.LitteralBoolean(False))))
         ])
Пример #2
0
    def get_program(self, param):
        temp_name = 'result'
        temp_usage = ast.VariableUsage(temp_name)

        return ast.Program([
            (temp_name, ast.BooleanType),
        ], [
            ast.Assign(temp_usage,
                       ast.Call(ast.VariableUsage('identity'), [param])),
            ast.Return(temp_usage),
        ])
Пример #3
0
 def get_program(self, decision_expr):
     return ast.Program(
         [], [ast.XContext(self.LANGUAGE, self.FORMAT, decision_expr)])
Пример #4
0
 def get_program(self, condition):
     return ast.Program([], [
         ast.Return(condition),
     ])