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

Method optimize

include/chaiscript/language/chaiscript_optimizer.hpp:121–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45

Tested by

no test coverage detected