MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / Block

Class Block

include/chaiscript/language/chaiscript_optimizer.hpp:119–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117 }
118
119 struct Block {
120 template<typename T>
121 auto optimize(eval::AST_Node_Impl_Ptr<T> node) {
122 if (node->identifier == AST_Node_Type::Block)
123 {
124 if (!contains_var_decl_in_scope(*node))
125 {
126 if (node->children.size() == 1) {
127 return std::move(node->children[0]);
128 } else {
129 return chaiscript::make_unique<eval::AST_Node_Impl<T>, eval::Scopeless_Block_AST_Node<T>>(node->text, node->location,
130 std::move(node->children));
131 }
132 }
133 }
134
135 return node;
136 }
137 };
138
139 struct Dead_Code {
140 template<typename T>

Callers 8

LambdaMethod · 0.85
DefMethod · 0.85
TryMethod · 0.85
IfMethod · 0.85
WhileMethod · 0.85
ForMethod · 0.85
CaseMethod · 0.85
StatementsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected