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

Method visit_NSRef

tools/inspector_protocol/jinja2/compiler.py:1418–1428  ·  view source on GitHub ↗
(self, node, frame)

Source from the content-addressed store, hash-verified

1416 self.write(ref)
1417
1418 def visit_NSRef(self, node, frame):
1419 # NSRefs can only be used to store values; since they use the normal
1420 # `foo.bar` notation they will be parsed as a normal attribute access
1421 # when used anywhere but in a `set` context
1422 ref = frame.symbols.ref(node.name)
1423 self.writeline('if not isinstance(%s, Namespace):' % ref)
1424 self.indent()
1425 self.writeline('raise TemplateRuntimeError(%r)' %
1426 'cannot assign attribute on non-namespace object')
1427 self.outdent()
1428 self.writeline('%s[%r]' % (ref, node.attr))
1429
1430 def visit_Const(self, node, frame):
1431 val = node.as_const(frame.eval_ctx)

Callers

nothing calls this directly

Calls 4

writelineMethod · 0.95
indentMethod · 0.95
outdentMethod · 0.95
refMethod · 0.65

Tested by

no test coverage detected