示例#1
0
 def visit_func_expr(self, node: FuncExpr) -> Node:
     new = FuncExpr([self.visit_var(var) for var in node.args],
                    node.arg_kinds[:], [None] * len(node.init),
                    self.block(node.body),
                    cast(FunctionLike, self.optional_type(node.type)))
     self.copy_function_attributes(new, node)
     return new
示例#2
0
    def visit_Lambda(self, n: ast3.Lambda) -> FuncExpr:
        body = ast3.Return(n.body)
        body.lineno = n.lineno
        body.col_offset = n.col_offset

        return FuncExpr(self.transform_args(n.args, n.lineno),
                        self.as_block([body], n.lineno))
示例#3
0
    def visit_Lambda(self, n: ast27.Lambda) -> FuncExpr:
        args, decompose_stmts = self.transform_args(n.args, n.lineno)

        n_body = ast27.Return(n.body)
        n_body.lineno = n.lineno
        n_body.col_offset = n.col_offset
        body = self.as_block([n_body], n.lineno)
        if decompose_stmts:
            body.body = decompose_stmts + body.body

        return FuncExpr(args, body)
示例#4
0
文件: fastparse.py 项目: tony/mypy
    def visit_Lambda(self, n: ast35.Lambda) -> Node:
        body = ast35.Return(n.body)
        body.lineno = n.lineno

        return FuncExpr(self.transform_args(n.args, n.lineno),
                        self.as_block([body], n.lineno))
示例#5
0
 def visit_func_expr(self, node: FuncExpr) -> Node:
     new = FuncExpr([self.copy_argument(arg) for arg in node.arguments],
                    self.block(node.body),
                    cast(FunctionLike, self.optional_type(node.type)))
     self.copy_function_attributes(new, node)
     return new
示例#6
0
    def visit_Lambda(self, n):
        body = typed_ast.Return(n.body)
        body.lineno = n.lineno

        return FuncExpr(self.transform_args(n.args, n.lineno),
                        self.as_block([body], n.lineno))