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

Class Frame

tools/inspector_protocol/jinja2/compiler.py:130–189  ·  view source on GitHub ↗

Holds compile time information for us.

Source from the content-addressed store, hash-verified

128
129
130class Frame(object):
131 """Holds compile time information for us."""
132
133 def __init__(self, eval_ctx, parent=None, level=None):
134 self.eval_ctx = eval_ctx
135 self.symbols = Symbols(parent and parent.symbols or None,
136 level=level)
137
138 # a toplevel frame is the root + soft frames such as if conditions.
139 self.toplevel = False
140
141 # the root frame is basically just the outermost frame, so no if
142 # conditions. This information is used to optimize inheritance
143 # situations.
144 self.rootlevel = False
145
146 # in some dynamic inheritance situations the compiler needs to add
147 # write tests around output statements.
148 self.require_output_check = parent and parent.require_output_check
149
150 # inside some tags we are using a buffer rather than yield statements.
151 # this for example affects {% filter %} or {% macro %}. If a frame
152 # is buffered this variable points to the name of the list used as
153 # buffer.
154 self.buffer = None
155
156 # the name of the block we're in, otherwise None.
157 self.block = parent and parent.block or None
158
159 # the parent of this frame
160 self.parent = parent
161
162 if parent is not None:
163 self.buffer = parent.buffer
164
165 def copy(self):
166 """Create a copy of the current one."""
167 rv = object.__new__(self.__class__)
168 rv.__dict__.update(self.__dict__)
169 rv.symbols = self.symbols.copy()
170 return rv
171
172 def inner(self, isolated=False):
173 """Return an inner frame."""
174 if isolated:
175 return Frame(self.eval_ctx, level=self.symbols.level + 1)
176 return Frame(self.eval_ctx, self)
177
178 def soft(self):
179 """Return a soft frame. A soft frame may not be modified as
180 standalone thing as it shares the resources with the frame it
181 was created of, but it's not a rootlevel frame any longer.
182
183 This is only used to implement if-statements.
184 """
185 rv = self.copy()
186 rv.rootlevel = False
187 return rv

Callers 2

innerMethod · 0.70
visit_TemplateMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected