35        : subst(subst), typeMap(typeMap), tc(tc) {
 
   39        LOG3(
"ConstantTypeSubstitution " << subst);
 
   42    const IR::Node *postorder(IR::Constant *cst)
 override {
 
   43        auto cstType = typeMap->getType(getOriginal(), 
true);
 
   44        if (!cstType->is<IR::ITypeVar>()) 
return cst;
 
   46        while (repl->is<IR::ITypeVar>()) {
 
   47            auto next = subst->get(repl->to<IR::ITypeVar>());
 
   48            BUG_CHECK(next != repl, 
"Cycle in substitutions: %1%", next);
 
   52        if (repl != cstType) {
 
   54            LOG2(
"Inferred type " << repl << 
" for " << cst);
 
   55            cst = 
new IR::Constant(cst->srcInfo, repl, cst->value, cst->base);
 
   57            LOG2(
"No type inferred for " << cst << 
" repl is " << repl);
 
   62    const IR::Expression *convert(
const IR::Expression *expr, 
const Visitor::Context *ctxt) {
 
   63        auto result = expr->apply(*
this, ctxt)->to<IR::Expression>();
 
   64        if (result != expr && (::errorCount() == 0)) tc->learn(result, 
this, ctxt);
 
   70        if (result != vec) tc->learn(result, 
this, ctxt);
 
   76        if (result != vec) tc->learn(result, 
this, ctxt);
 
 
Visitor mixin for looking up names in enclosing scopes from the Visitor::Context.
Definition resolveReferences.h:32