Skip to content

Commit fc79289

Browse files
committed
feat: expose end_col_offset in mypy ast nodes
1 parent 9611e2d commit fc79289

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

mypy/fastparse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ def set_line(self, node: N, n: AstNode) -> N:
373373
node.line = n.lineno
374374
node.column = n.col_offset
375375
node.end_line = getattr(n, "end_lineno", None) if isinstance(n, ast3.expr) else None
376+
node.end_column = getattr(n, "end_col_offset", None) if isinstance(n, ast3.expr) else None
377+
376378
return node
377379

378380
def translate_opt_expr_list(self, l: Sequence[Optional[AST]]) -> List[Optional[Expression]]:

mypy/nodes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@
2323

2424
class Context:
2525
"""Base type for objects that are valid as error message locations."""
26-
__slots__ = ('line', 'column', 'end_line')
26+
__slots__ = ('line', 'column', 'end_line', "end_column")
2727

2828
def __init__(self, line: int = -1, column: int = -1) -> None:
2929
self.line = line
3030
self.column = column
3131
self.end_line: Optional[int] = None
32+
self.end_column: Optional[int] = None
3233

3334
def set_line(self,
3435
target: Union['Context', int],

0 commit comments

Comments
 (0)