(stmt)
| 17206 | return this.graph.insertConstant(maybe_out_stack[0], tree); |
| 17207 | } |
| 17208 | emitAssignment(stmt) { |
| 17209 | if (stmt instanceof ast.AnnAssign) { |
| 17210 | return this.emitSingleAssignment(stmt); |
| 17211 | } |
| 17212 | if (stmt.targets.length === 1) { |
| 17213 | const entries = Object.entries(stmt).filter(([key]) => key !== 'targets' && key !== 'value' && key !== 'ctx'); |
| 17214 | const assign = new ast.AnnAssign(stmt.targets[0], null, stmt.value, stmt.targets[0] instanceof ast.Name); |
| 17215 | for (const [key, value] of entries) { |
| 17216 | assign[key] = value; |
| 17217 | } |
| 17218 | return this.emitSingleAssignment(assign); |
| 17219 | } |
| 17220 | if (stmt.targets.length <= 1) { |
| 17221 | throw new python.Error('Invalid assignment.'); |
| 17222 | } |
| 17223 | throw new python.Error('Not implemented.'); |
| 17224 | /* |
| 17225 | const tmp_name = this.createTempName('$tmp_assign_'); |
| 17226 | this.environment_stack.setSugaredVar(stmt.value, tmp_name, this.emitSugaredExpr(stmt.value, 1), annotated_type=null); |
| 17227 | const ident = new ast.Name(tmp_name); |
| 17228 | for (const expr of lhs_list) { |
| 17229 | const assign = new ast.Assign(targets, value, ctx); |
| 17230 | this.emitSingleAssignment(Assign.create(stmt, |
| 17231 | List<Expr>.create(expr.range(), [expr]), |
| 17232 | Maybe<Expr>::create(stmt.rhs().range(), ident), |
| 17233 | Maybe<Expr>::create(stmt.range()))); |
| 17234 | } |
| 17235 | */ |
| 17236 | } |
| 17237 | emitSingleAssignment(stmt) { |
| 17238 | torch._C.AT_ASSERT(stmt instanceof ast.AnnAssign); |
| 17239 | const rhs = stmt.value; |
no test coverage detected