MCPcopy Index your code
hub / github.com/lutzroeder/netron / validateAssignLhsExpr

Method validateAssignLhsExpr

source/python.js:17814–17833  ·  view source on GitHub ↗
(lhs /*, r */)

Source from the content-addressed store, hash-verified

17812 }
17813 }
17814 validateAssignLhsExpr(lhs /*, r */) {
17815 let num_normal_assign = 0;
17816 let num_starred = 0;
17817 for (const assignee of lhs) {
17818 if (assignee instanceof ast.Name || assignee instanceof ast.Subscript || assignee instanceof ast.Tuple || assignee instanceof ast.Attribute) {
17819 num_normal_assign++;
17820 } else if (assignee instanceof ast.Starred) {
17821 num_starred++;
17822 } else {
17823 throw new python.Error('Assignment must be a variable, subscript, or starred expression.');
17824 }
17825 }
17826 if (num_starred > 1) {
17827 throw new python.Error('Only one starred expression is allowed.');
17828 }
17829 if (num_starred > 0 && num_normal_assign === 0) {
17830 throw new python.Error('Invalid starred expression.');
17831 }
17832 return num_starred;
17833 }
17834 createTempName(prefix) {
17835 return `${prefix}${this._temp_name_count++}`;
17836 }

Callers 2

emitLoopCommonMethod · 0.80
emitTupleAssignMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected