Exemple #1
0
    def vcall(self,
              module: 'values.Field',
              graph: 'graphs.Graph',
              inst: 'values.Object',
              args=[],
              line=-1):
        ret = values.Object(
            values.UserDefinedInstance(module, None, self.classinfo))
        inst = ret

        func_field = values.Field()
        func_field.set_module(module)

        # add self
        if inst is not None:
            self_func_arg = FunctionArg()
            self_func_arg.obj = inst
            args = [self_func_arg] + args

        # add args
        funcArgs = self.parse_args(args)

        for fa in funcArgs:
            func_field.get_field().get_attribute(fa.name).revise(fa.obj)

        astc = vevaluator.AstContext(self.ast.body, self.lineno - 1)
        vevaluator.veval_ast(astc, func_field, graph)

        return ret
    def vcall(self,
              module: 'values.Field',
              graph: 'graphs.Graph',
              inst: 'values.ValueRef',
              args: 'FunctionArgInput',
              line=-1):
        ret = values.ValueRef(
            values.UserDefinedInstance(module, None, self.classinfo))
        inst = ret

        func_field = values.Field()
        func_field.set_module(module)

        # add args
        funcArgs = self.args.merge_inputs(inst, args)

        for k, v in funcArgs.keywords.items():
            func_field.get_field().get_attribute(k).revise(v)

        astc = vevaluator.AstContext(self.ast.body, self.lineno - 1)
        vevaluator.veval_ast(astc, func_field, graph)

        return ret
    def vcall(self,
              module: 'values.Field',
              graph: 'core.Graph',
              inst: 'values.ValueRef',
              args: 'FunctionArgInput',
              line=-1):
        func_field = values.Field()
        func_field.set_module(module)

        # add args
        funcArgs = self.args.merge_inputs(inst, args)

        for k, v in funcArgs.keywords.items():
            func_field.get_field().get_attribute(k).revise(v)

        astc = vevaluator.AstContext(self.ast.body, self.lineno - 1)
        return vevaluator.veval_ast(astc, func_field, graph)
    def vcall(self, module : 'values.Field', graph : 'core.Graph', inst : 'Value', args = [], line = -1):
        func_field = values.Field()
        func_field.set_module(module)

        # add self
        if inst is not None:
            self_func_arg = FunctionArg()
            self_func_arg.value = inst
            args = [self_func_arg] + args

        # add args
        funcArgs = self.parse_args(args)

        for fa in funcArgs:
            func_field.get_field().get_attribute(fa.name).revise(fa.value)

        astc = vevaluator.AstContext(self.ast.body, self.lineno - 1)
        return vevaluator.veval_ast(astc, func_field, graph)
Exemple #5
0
    def vcall(self,
              module: 'values.Field',
              graph: 'core.Graph',
              inst: 'values.Object',
              args: 'FunctionArgInput',
              line=-1):
        func_field = values.Field()
        func_field.set_module(module)

        # add self
        if inst is not None:
            args.inputs = [inst] + args.inputs

        # add args
        funcArgs = self.args.merge_inputs(args)

        for fa in funcArgs.get_args():
            func_field.get_field().get_attribute(fa.name).revise(fa.obj)

        astc = vevaluator.AstContext(self.ast.body, self.lineno - 1)
        return vevaluator.veval_ast(astc, func_field, graph)