Simplify Result.force_expr
This commit is contained in:
parent
21f7ef0713
commit
45ec57ab56
@ -184,18 +184,11 @@ class Result(object):
|
|||||||
"""
|
"""
|
||||||
if self.expr:
|
if self.expr:
|
||||||
return self.expr
|
return self.expr
|
||||||
|
return ast.Name(
|
||||||
# Spoof the position of the last statement for our generated None
|
id=ast_str("None"),
|
||||||
lineno = 0
|
|
||||||
col_offset = 0
|
|
||||||
if self.stmts:
|
|
||||||
lineno = self.stmts[-1].lineno
|
|
||||||
col_offset = self.stmts[-1].col_offset
|
|
||||||
|
|
||||||
return ast.Name(id=ast_str("None"),
|
|
||||||
ctx=ast.Load(),
|
ctx=ast.Load(),
|
||||||
lineno=lineno,
|
lineno=self.stmts[-1].lineno if self.stmts else 0,
|
||||||
col_offset=col_offset)
|
col_offset=self.stmts[-1].col_offset if self.stmts else 0)
|
||||||
|
|
||||||
def expr_as_stmt(self):
|
def expr_as_stmt(self):
|
||||||
"""Convert the Result's expression context to a statement
|
"""Convert the Result's expression context to a statement
|
||||||
|
Loading…
x
Reference in New Issue
Block a user