Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b078b832c
|
||
|
|
7515716864
|
||
|
|
218b0c5b78
|
No files matched your search
@@ -2,3 +2,10 @@ a: int = 3
|
||||
b: int = 4
|
||||
|
||||
c = a + b # -> int
|
||||
|
||||
c = "invalid" # -> can't assign str to int variable
|
||||
|
||||
d = True
|
||||
e = d + d
|
||||
|
||||
f: float = a
|
||||
@@ -335,13 +335,14 @@ class PythonParser:
|
||||
|
||||
def parse_compare(self, node: ast.Compare) -> Expr:
|
||||
ops: list[ast.cmpop] = node.ops
|
||||
left: Expr = self.parse_expr(node.left)
|
||||
rights: list[Expr] = [self.parse_expr(expr) for expr in node.comparators]
|
||||
expr: Expr = CompareExpr(
|
||||
location=Location.span(
|
||||
left.location,
|
||||
rights[0].location,
|
||||
rights[1].location,
|
||||
),
|
||||
left=self.parse_expr(node.left),
|
||||
left=left,
|
||||
operator=ops[0],
|
||||
right=rights[0],
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user