TypeVariableSet getTypeVariablesBoundBy(const FunctionTypePtr& funType) { // collect all free type variables int he parameters TypeVariableSet res; // collect all type variables for(const auto& paramType : funType->getParameterTypes()) { visitDepthFirstOnce(paramType, [&](const TypeVariablePtr& var) { res.insert(var); }); } // done return res; }
IRStatistic IRStatistic::evaluate(const NodePtr& node) { IRStatistic res; // count number of shared nodes ... visitDepthFirstOnce(node, makeLambdaVisitor([&res](const NodePtr& ptr) { res.numSharedNodes++; res.nodeTypeInfo[ptr->getNodeType()].numShared++; }, true)); // ... and addressable nodes visitDepthFirst(node, makeLambdaVisitor([&res](const NodePtr& ptr) { res.numAddressableNodes++; res.nodeTypeInfo[ptr->getNodeType()].numAddressable++; }, true)); // ... and height (lightweight) res.height = evalHeight(node); // build result return res; }