src/AST/DeclReplacer.cpp
const ast::VariableExpr * DeclReplacer::previsit( const VariableExpr * varExpr ) {
			// xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are)
			if ( !declMap.count( varExpr->var ) ) return varExpr;

			auto replacement = declMap.at( varExpr->var );
			if ( debug ) {
				std::cerr << "replacing variable reference: "
					<< (void*)varExpr->var.get() << " " << varExpr->var
					<< " with " << (void*)replacement << " " << replacement
					<< std::endl;
			}
			auto nexpr = mutate(varExpr);
			nexpr->var = replacement;
			return nexpr;
		}
// replace variable with new node from decl map
replace variable with new node from decl map
replace variable with new node from decl map
const ast::VariableExpr * DeclReplacer::previsit( const VariableExpr * varExpr ) {
			if ( !declMap.count( varExpr->var ) ) return varExpr;
			auto replacement = declMap.at( varExpr->var );
			if ( debug ) {
				std::cerr << "replacing variable reference: "
					<< (void*)varExpr->var.get() << " " << varExpr->var
					<< " with " << (void*)replacement << " " << replacement
					<< std::endl;
			}
			auto nexpr = mutate(varExpr);
			nexpr->var = replacement;
			return nexpr;
		}
const ast :: VariableExpr * DeclReplacer :: previsit ( const VariableExpr * varExpr ) { if ( ! declMap . count ( varExpr -> var ) ) return varExpr ; auto replacement = declMap . at ( varExpr -> var ) ; if ( debug ) { std :: cerr << " " << ( void * ) varExpr -> var . get ( ) << " " << varExpr -> var << " " << ( void * ) replacement << " " << replacement << std :: endl ; } auto nexpr = mutate ( varExpr ) ; nexpr -> var = replacement ; return nexpr ; }
replace variable with new node from decl map
replace variable with new node from decl map
// xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are)