class NativeCodeGenerator(CodeGenerator):
Static Method | _default_finalize |
The default finalize function if the environment isn't configured with one. Or, if the environment has one, this is called on that function's output for constants. |
Method | _output_child_post |
Output extra source code after visiting a child of an Output node. |
Method | _output_child_pre |
Output extra source code before visiting a child of an Output node. |
Method | _output_child_to_const |
Try to optimize a child of an Output node by trying to convert it to constant, finalized data at compile time. |
Method | _output_const_repr |
Given a group of constant values converted from Output child nodes, produce a string to write to the template module source. |
Inherited from CodeGenerator
:
Class | _FinalizeInfo |
Undocumented |
Method | __init__ |
Undocumented |
Method | _filter_test_common |
Undocumented |
Method | _import_common |
Undocumented |
Method | _make_finalize |
Build the finalize function to be used on constants and at runtime. Cached so it's only created once for all output nodes. |
Method | blockvisit |
Visit a list of nodes as block in a frame. If the current frame is no buffer a dummy if 0: yield None is written automatically. |
Method | buffer |
Enable buffering for the frame from that point onwards. |
Method | choose_async |
Undocumented |
Method | derive_context |
Undocumented |
Method | dump_local_context |
Undocumented |
Method | end_write |
End the writing process started by start_write . |
Method | enter_frame |
Undocumented |
Method | fail |
Fail with a TemplateAssertionError . |
Method | func |
Undocumented |
Method | get_context_ref |
Undocumented |
Method | get_resolve_func |
Undocumented |
Method | indent |
Indent by one. |
Method | leave_frame |
Undocumented |
Method | macro_body |
Dump the function def of a macro or call block. |
Method | macro_def |
Dump the macro definition for the def created by macro_body. |
Method | mark_parameter_stored |
Marks a parameter in the current parameter definitions as stored. This will skip the enforced undefined checks. |
Method | newline |
Add one or more newlines before the next write. |
Method | outdent |
Outdent by step. |
Method | parameter_is_undeclared |
Checks if a given target is an undeclared parameter. |
Method | pop_assign_tracking |
Pops the topmost level for assignment tracking and updates the context variables if necessary. |
Method | pop_context_reference |
Undocumented |
Method | pop_parameter_definitions |
Pops the current parameter definitions set. |
Method | position |
Return a human readable position for the node. |
Method | pull_dependencies |
No summary |
Method | push_assign_tracking |
Pushes a new layer for assignment tracking. |
Method | push_context_reference |
Undocumented |
Method | push_parameter_definitions |
No summary |
Method | return_buffer_contents |
Return the buffer contents of the frame. |
Method | signature |
No summary |
Method | simple_write |
Simple shortcut for start_write + write + end_write. |
Method | start_write |
Yield or write into the frame buffer. |
Method | temporary_identifier |
Get a new unique identifier. |
Method | visit_Assign |
Undocumented |
Method | visit_AssignBlock |
Undocumented |
Method | visit_Block |
Call a block and register it for the template. |
Method | visit_Break |
Undocumented |
Method | visit_Call |
Undocumented |
Method | visit_CallBlock |
Undocumented |
Method | visit_Compare |
Undocumented |
Method | visit_Concat |
Undocumented |
Method | visit_CondExpr |
Undocumented |
Method | visit_Const |
Undocumented |
Method | visit_ContextReference |
Undocumented |
Method | visit_Continue |
Undocumented |
Method | visit_DerivedContextReference |
Undocumented |
Method | visit_Dict |
Undocumented |
Method | visit_EnvironmentAttribute |
Undocumented |
Method | visit_EvalContextModifier |
Undocumented |
Method | visit_ExprStmt |
Undocumented |
Method | visit_Extends |
Calls the extender. |
Method | visit_ExtensionAttribute |
Undocumented |
Method | visit_Filter |
Undocumented |
Method | visit_FilterBlock |
Undocumented |
Method | visit_For |
Undocumented |
Method | visit_FromImport |
Visit named imports. |
Method | visit_Getattr |
Undocumented |
Method | visit_Getitem |
Undocumented |
Method | visit_If |
Undocumented |
Method | visit_Import |
Visit regular imports. |
Method | visit_ImportedName |
Undocumented |
Method | visit_Include |
Handles includes. |
Method | visit_InternalName |
Undocumented |
Method | visit_Keyword |
Undocumented |
Method | visit_List |
Undocumented |
Method | visit_Macro |
Undocumented |
Method | visit_MarkSafe |
Undocumented |
Method | visit_MarkSafeIfAutoescape |
Undocumented |
Method | visit_Name |
Undocumented |
Method | visit_NSRef |
Undocumented |
Method | visit_Operand |
Undocumented |
Method | visit_Output |
Undocumented |
Method | visit_OverlayScope |
Undocumented |
Method | visit_Scope |
Undocumented |
Method | visit_ScopedEvalContextModifier |
Undocumented |
Method | visit_Slice |
Undocumented |
Method | visit_Template |
Undocumented |
Method | visit_TemplateData |
Undocumented |
Method | visit_Test |
Undocumented |
Method | visit_Tuple |
Undocumented |
Method | visit_With |
Undocumented |
Method | write |
Write a string into the output stream. |
Method | write_commons |
Writes a common preamble that is used by root and block functions. Primarily this sets up common local helpers and enforces a generator through a dead branch. |
Method | writeline |
Combination of newline and write. |
Class Variable | visit_Add |
Undocumented |
Class Variable | visit_And |
Undocumented |
Class Variable | visit_Div |
Undocumented |
Class Variable | visit_FloorDiv |
Undocumented |
Class Variable | visit_Mod |
Undocumented |
Class Variable | visit_Mul |
Undocumented |
Class Variable | visit_Neg |
Undocumented |
Class Variable | visit_Not |
Undocumented |
Class Variable | visit_Or |
Undocumented |
Class Variable | visit_Pos |
Undocumented |
Class Variable | visit_Pow |
Undocumented |
Class Variable | visit_Sub |
Undocumented |
Instance Variable | _assign_stack |
Undocumented |
Instance Variable | _context_reference_stack |
Undocumented |
Instance Variable | _finalize |
Undocumented |
Instance Variable | _first_write |
Undocumented |
Instance Variable | _indentation |
Undocumented |
Instance Variable | _last_identifier |
Undocumented |
Instance Variable | _last_line |
Undocumented |
Instance Variable | _new_lines |
Undocumented |
Instance Variable | _param_def_block |
Undocumented |
Instance Variable | _write_debug_info |
Undocumented |
Instance Variable | blocks |
Undocumented |
Instance Variable | code_lineno |
Undocumented |
Instance Variable | created_block_context |
Undocumented |
Instance Variable | debug_info |
Undocumented |
Instance Variable | defer_init |
Undocumented |
Instance Variable | environment |
Undocumented |
Instance Variable | extends_so_far |
Undocumented |
Instance Variable | filename |
Undocumented |
Instance Variable | filters |
Undocumented |
Instance Variable | has_known_extends |
Undocumented |
Instance Variable | import_aliases |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | optimizer |
Undocumented |
Instance Variable | stream |
Undocumented |
Instance Variable | tests |
Undocumented |
Property | optimized |
Undocumented |
Inherited from NodeVisitor
(via CodeGenerator
):
Method | generic_visit |
Called if no explicit visitor function exists for a node. |
Method | get_visitor |
Return the visitor function for this node or None if no visitor exists for this node. In that case the generic visit function is used instead. |
Method | visit |
Visit a node. |
Parameters | |
value:t.Any | Undocumented |
Returns | |
t.Any | Undocumented |
Parameters | |
node:nodes.Expr | Undocumented |
frame:Frame | Undocumented |
finalize:CodeGenerator._FinalizeInfo | Undocumented |
Parameters | |
node:nodes.Expr | Undocumented |
frame:Frame | Undocumented |
finalize:CodeGenerator._FinalizeInfo | Undocumented |
Try to optimize a child of an Output node by trying to convert it to constant, finalized data at compile time.
If Impossible
is raised, the node is not constant and
will be evaluated at runtime. Any other exception will also be
evaluated at runtime for easier debugging.
Parameters | |
node:nodes.Expr | Undocumented |
frame:Frame | Undocumented |
finalize:CodeGenerator._FinalizeInfo | Undocumented |
Returns | |
t.Any | Undocumented |