(self, n: ast3.AnnAssign)
| 1277 | |
| 1278 | # AnnAssign(expr target, expr annotation, expr? value, int simple) |
| 1279 | def visit_AnnAssign(self, n: ast3.AnnAssign) -> AssignmentStmt: |
| 1280 | line = n.lineno |
| 1281 | if n.value is None: # always allow 'x: int' |
| 1282 | rvalue: Expression = TempNode(AnyType(TypeOfAny.special_form), no_rhs=True) |
| 1283 | self.set_line(rvalue, n) |
| 1284 | else: |
| 1285 | rvalue = self.visit(n.value) |
| 1286 | typ = TypeConverter(self.errors, line=line).visit(n.annotation) |
| 1287 | assert typ is not None |
| 1288 | typ.column = n.annotation.col_offset |
| 1289 | s = AssignmentStmt([self.visit(n.target)], rvalue, type=typ, new_syntax=True) |
| 1290 | return self.set_line(s, n) |
| 1291 | |
| 1292 | # AugAssign(expr target, operator op, expr value) |
| 1293 | def visit_AugAssign(self, n: ast3.AugAssign) -> OperatorAssignmentStmt: |
nothing calls this directly
no test coverage detected