MCPcopy Index your code
hub / github.com/nodejs/node / pop_assign_tracking

Method pop_assign_tracking

tools/inspector_protocol/jinja2/compiler.py:665–691  ·  view source on GitHub ↗

Pops the topmost level for assignment tracking and updates the context variables if necessary.

(self, frame)

Source from the content-addressed store, hash-verified

663 self._assign_stack.append(set())
664
665 def pop_assign_tracking(self, frame):
666 """Pops the topmost level for assignment tracking and updates the
667 context variables if necessary.
668 """
669 vars = self._assign_stack.pop()
670 if not frame.toplevel or not vars:
671 return
672 public_names = [x for x in vars if x[:1] != '_']
673 if len(vars) == 1:
674 name = next(iter(vars))
675 ref = frame.symbols.ref(name)
676 self.writeline('context.vars[%r] = %s' % (name, ref))
677 else:
678 self.writeline('context.vars.update({')
679 for idx, name in enumerate(vars):
680 if idx:
681 self.write(', ')
682 ref = frame.symbols.ref(name)
683 self.write('%r: %s' % (name, ref))
684 self.write('})')
685 if public_names:
686 if len(public_names) == 1:
687 self.writeline('context.exported_vars.add(%r)' %
688 public_names[0])
689 else:
690 self.writeline('context.exported_vars.update((%s))' %
691 ', '.join(imap(repr, public_names)))
692
693 # -- Statement Visitors
694

Callers 2

visit_AssignMethod · 0.95
visit_AssignBlockMethod · 0.95

Calls 7

writelineMethod · 0.95
writeMethod · 0.95
popMethod · 0.80
refMethod · 0.65
nextFunction · 0.50
enumerateFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected