MCPcopy
hub / github.com/lutzroeder/netron / emitFor

Method emitFor

source/python.js:16845–16865  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

16843 loop_guard.dispose();
16844 }
16845 emitFor(...args) {
16846 if (args.length === 1 && args[0] instanceof ast.For) {
16847 const [stmt] = args;
16848 const emit_body = () => this.emitStatements(stmt.body);
16849 this.emitFor(stmt.target, stmt.iter, stmt.range(), emit_body);
16850 } else if (args.length === 4) {
16851 const [targets, itrs, loc, emit_body] = args;
16852 if (itrs instanceof ast.Tuple) {
16853 throw new python.Error('List of iterables is not supported currently.');
16854 }
16855 const sv = this.emitSugaredExpr(itrs, 1);
16856 const iterable = sv.iter(loc, this.method);
16857 if (iterable.shouldEmitUnrolled()) {
16858 this.emitUnrolledLoop(loc, emit_body, iterable, targets);
16859 } else {
16860 this.emitLoopCommon(loc, emit_body, iterable, [targets], null);
16861 }
16862 } else {
16863 throw new python.Error('Not implemented.');
16864 }
16865 }
16866 emitWhile(stmt) {
16867 const cond = stmt.test;
16868 const emit_body = () => this.emitStatements(stmt.body);

Callers 1

emitStatementsMethod · 0.80

Calls 4

emitSugaredExprMethod · 0.80
iterMethod · 0.80
shouldEmitUnrolledMethod · 0.80
emitLoopCommonMethod · 0.80

Tested by

no test coverage detected