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