(...args)
| 17267 | lhsObject.setAttr(loc, this.method, lhs.attr, rhsValue); |
| 17268 | } |
| 17269 | emitTupleAssign(...args) { |
| 17270 | if (args.length === 2) { |
| 17271 | const [tl, rhs] = args; |
| 17272 | let n_binders = tl.elts.length; |
| 17273 | const starred_unpack = this.validateAssignLhsExpr(tl.elts, tl); |
| 17274 | if (starred_unpack) { |
| 17275 | n_binders--; |
| 17276 | } |
| 17277 | const output = this.emitSugaredExpr(rhs, n_binders); |
| 17278 | this.emitTupleAssign(tl, output, rhs.range(), n_binders, starred_unpack); |
| 17279 | } else if (args.length === 5) { |
| 17280 | const [tl, rhs_output, rhs_loc, n_binders, starred_unpack] = args; |
| 17281 | const outputs = rhs_output.asTuple(rhs_loc, this.method, starred_unpack ? null : n_binders); |
| 17282 | if (outputs.length < n_binders) { |
| 17283 | throw new python.Error('Not enough values to unpack.'); |
| 17284 | } |
| 17285 | if (outputs.length > n_binders && !starred_unpack) { |
| 17286 | throw new python.Error('Too many values to unpack.'); |
| 17287 | } |
| 17288 | this.emitExprsAssign(tl.elts, outputs, rhs_loc, n_binders); |
| 17289 | } else { |
| 17290 | throw new python.Error('Not implemented.'); |
| 17291 | } |
| 17292 | } |
| 17293 | emitExprsAssign(lhs_exprs, outputs /*, rhs_loc, n_binders */) { |
| 17294 | let i = 0; |
| 17295 | for (const assignee of lhs_exprs) { |
no test coverage detected