Index: src/AST/Pass.proto.hpp
===================================================================
--- src/AST/Pass.proto.hpp	(revision 0d070cacad00a72507dd2c167585d3eb6ccc9198)
+++ src/AST/Pass.proto.hpp	(revision 8d8ac3bbf7435ae27e31e4195ddf5824bbe9c0da)
@@ -20,5 +20,5 @@
 
 namespace ast {
-template<typename pass_type>
+template<typename core_t>
 class Pass;
 
@@ -113,7 +113,7 @@
 	/// "Short hand" to check if this is a valid previsit function
 	/// Mostly used to make the static_assert look (and print) prettier
-	template<typename pass_t, typename node_t>
+	template<typename core_t, typename node_t>
 	struct is_valid_previsit {
-		using ret_t = decltype( ((pass_t*)nullptr)->previsit( (const node_t *)nullptr ) );
+		using ret_t = decltype( ((core_t*)nullptr)->previsit( (const node_t *)nullptr ) );
 
 		static constexpr bool value = std::is_void< ret_t >::value ||
@@ -129,7 +129,7 @@
 	template<>
 	struct __assign<true> {
-		template<typename pass_t, typename node_t>
-		static inline void result( pass_t & pass, const node_t * & node ) {
-			pass.previsit( node );
+		template<typename core_t, typename node_t>
+		static inline void result( core_t & core, const node_t * & node ) {
+			core.previsit( node );
 		}
 	};
@@ -137,7 +137,7 @@
 	template<>
 	struct __assign<false> {
-		template<typename pass_t, typename node_t>
-		static inline void result( pass_t & pass, const node_t * & node ) {
-			node = pass.previsit( node );
+		template<typename core_t, typename node_t>
+		static inline void result( core_t & core, const node_t * & node ) {
+			node = core.previsit( node );
 			assertf(node, "Previsit must not return NULL");
 		}
@@ -152,7 +152,7 @@
 	template<>
 	struct __return<true> {
-		template<typename pass_t, typename node_t>
-		static inline const node_t * result( pass_t & pass, const node_t * & node ) {
-			pass.postvisit( node );
+		template<typename core_t, typename node_t>
+		static inline const node_t * result( core_t & core, const node_t * & node ) {
+			core.postvisit( node );
 			return node;
 		}
@@ -161,7 +161,7 @@
 	template<>
 	struct __return<false> {
-		template<typename pass_t, typename node_t>
-		static inline auto result( pass_t & pass, const node_t * & node ) {
-			return pass.postvisit( node );
+		template<typename core_t, typename node_t>
+		static inline auto result( core_t & core, const node_t * & node ) {
+			return core.postvisit( node );
 		}
 	};
@@ -182,8 +182,8 @@
 	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 	// PreVisit : may mutate the pointer passed in if the node is mutated in the previsit call
-	template<typename pass_t, typename node_t>
-	static inline auto previsit( pass_t & pass, const node_t * & node, int ) -> decltype( pass.previsit( node ), void() ) {
+	template<typename core_t, typename node_t>
+	static inline auto previsit( core_t & core, const node_t * & node, int ) -> decltype( core.previsit( node ), void() ) {
 		static_assert(
-			is_valid_previsit<pass_t, node_t>::value,
+			is_valid_previsit<core_t, node_t>::value,
 			"Previsit may not change the type of the node. It must return its paremeter or void."
 		);
@@ -191,26 +191,26 @@
 		__assign<
 			std::is_void<
-				decltype( pass.previsit( node ) )
+				decltype( core.previsit( node ) )
 			>::value
-		>::result( pass, node );
+		>::result( core, node );
 	}
 
-	template<typename pass_t, typename node_t>
-	static inline auto previsit( pass_t &, const node_t *, long ) {}
+	template<typename core_t, typename node_t>
+	static inline auto previsit( core_t &, const node_t *, long ) {}
 
 	// PostVisit : never mutates the passed pointer but may return a different node
-	template<typename pass_t, typename node_t>
-	static inline auto postvisit( pass_t & pass, const node_t * node, int ) ->
-		decltype( pass.postvisit( node ), node->accept( *(Visitor*)nullptr ) )
+	template<typename core_t, typename node_t>
+	static inline auto postvisit( core_t & core, const node_t * node, int ) ->
+		decltype( core.postvisit( node ), node->accept( *(Visitor*)nullptr ) )
 	{
 		return __return<
 			std::is_void<
-				decltype( pass.postvisit( node ) )
+				decltype( core.postvisit( node ) )
 			>::value
-		>::result( pass, node );
+		>::result( core, node );
 	}
 
-	template<typename pass_t, typename node_t>
-	static inline const node_t * postvisit( pass_t &, const node_t * node, long ) { return node; }
+	template<typename core_t, typename node_t>
+	static inline const node_t * postvisit( core_t &, const node_t * node, long ) { return node; }
 
 	//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -227,9 +227,9 @@
 	// The type is not strictly enforced but does match the accessory
 	#define FIELD_PTR( name, default_type ) \
-	template< typename pass_t > \
-	static inline auto name( pass_t & pass, int ) -> decltype( &pass.name ) { return &pass.name; } \
+	template< typename core_t > \
+	static inline auto name( core_t & core, int ) -> decltype( &core.name ) { return &core.name; } \
 	\
-	template< typename pass_t > \
-	static inline default_type * name( pass_t &, long ) { return nullptr; }
+	template< typename core_t > \
+	static inline default_type * name( core_t &, long ) { return nullptr; }
 
 	// List of fields and their expected types
@@ -241,24 +241,24 @@
 	FIELD_PTR( visit_children, __pass::bool_ref )
 	FIELD_PTR( at_cleanup, __pass::at_cleanup_t )
-	FIELD_PTR( visitor, ast::Pass<pass_t> * const )
+	FIELD_PTR( visitor, ast::Pass<core_t> * const )
 
 	// Remove the macro to make sure we don't clash
 	#undef FIELD_PTR
 
-	template< typename pass_t >
-	static inline auto beginTrace(pass_t &, int) -> decltype( pass_t::traceId, void() ) {
-		// Stats::Heap::stacktrace_push(pass_t::traceId);
+	template< typename core_t >
+	static inline auto beginTrace(core_t &, int) -> decltype( core_t::traceId, void() ) {
+		// Stats::Heap::stacktrace_push(core_t::traceId);
 	}
 
-	template< typename pass_t >
-	static inline auto endTrace(pass_t &, int) -> decltype( pass_t::traceId, void() ) {
+	template< typename core_t >
+	static inline auto endTrace(core_t &, int) -> decltype( core_t::traceId, void() ) {
 		// Stats::Heap::stacktrace_pop();
 	}
 
-	template< typename pass_t >
-	static void beginTrace(pass_t &, long) {}
-
-	template< typename pass_t >
-	static void endTrace(pass_t &, long) {}
+	template< typename core_t >
+	static void beginTrace(core_t &, long) {}
+
+	template< typename core_t >
+	static void endTrace(core_t &, long) {}
 
 	// Another feature of the templated visitor is that it calls beginScope()/endScope() for compound statement.
@@ -266,19 +266,19 @@
 	// detect it using the same strategy
 	namespace scope {
-		template<typename pass_t>
-		static inline auto enter( pass_t & pass, int ) -> decltype( pass.beginScope(), void() ) {
-			pass.beginScope();
-		}
-
-		template<typename pass_t>
-		static inline void enter( pass_t &, long ) {}
-
-		template<typename pass_t>
-		static inline auto leave( pass_t & pass, int ) -> decltype( pass.endScope(), void() ) {
-			pass.endScope();
-		}
-
-		template<typename pass_t>
-		static inline void leave( pass_t &, long ) {}
+		template<typename core_t>
+		static inline auto enter( core_t & core, int ) -> decltype( core.beginScope(), void() ) {
+			core.beginScope();
+		}
+
+		template<typename core_t>
+		static inline void enter( core_t &, long ) {}
+
+		template<typename core_t>
+		static inline auto leave( core_t & core, int ) -> decltype( core.endScope(), void() ) {
+			core.endScope();
+		}
+
+		template<typename core_t>
+		static inline void leave( core_t &, long ) {}
 	} // namespace scope
 
@@ -287,39 +287,39 @@
 	namespace symtab {
 		// Some simple scoping rules
-		template<typename pass_t>
-		static inline auto enter( pass_t & pass, int ) -> decltype( pass.symtab, void() ) {
-			pass.symtab.enterScope();
-		}
-
-		template<typename pass_t>
-		static inline auto enter( pass_t &, long ) {}
-
-		template<typename pass_t>
-		static inline auto leave( pass_t & pass, int ) -> decltype( pass.symtab, void() ) {
-			pass.symtab.leaveScope();
-		}
-
-		template<typename pass_t>
-		static inline auto leave( pass_t &, long ) {}
+		template<typename core_t>
+		static inline auto enter( core_t & core, int ) -> decltype( core.symtab, void() ) {
+			core.symtab.enterScope();
+		}
+
+		template<typename core_t>
+		static inline auto enter( core_t &, long ) {}
+
+		template<typename core_t>
+		static inline auto leave( core_t & core, int ) -> decltype( core.symtab, void() ) {
+			core.symtab.leaveScope();
+		}
+
+		template<typename core_t>
+		static inline auto leave( core_t &, long ) {}
 
 		// The symbol table has 2 kind of functions mostly, 1 argument and 2 arguments
 		// Create macro to condense these common patterns
 		#define SYMTAB_FUNC1( func, type ) \
-		template<typename pass_t> \
-		static inline auto func( pass_t & pass, int, type arg ) -> decltype( pass.symtab.func( arg ), void() ) {\
-			pass.symtab.func( arg ); \
+		template<typename core_t> \
+		static inline auto func( core_t & core, int, type arg ) -> decltype( core.symtab.func( arg ), void() ) {\
+			core.symtab.func( arg ); \
 		} \
 		\
-		template<typename pass_t> \
-		static inline void func( pass_t &, long, type ) {}
+		template<typename core_t> \
+		static inline void func( core_t &, long, type ) {}
 
 		#define SYMTAB_FUNC2( func, type1, type2 ) \
-		template<typename pass_t> \
-		static inline auto func( pass_t & pass, int, type1 arg1, type2 arg2 ) -> decltype( pass.symtab.func( arg1, arg2 ), void () ) {\
-			pass.symtab.func( arg1, arg2 ); \
+		template<typename core_t> \
+		static inline auto func( core_t & core, int, type1 arg1, type2 arg2 ) -> decltype( core.symtab.func( arg1, arg2 ), void () ) {\
+			core.symtab.func( arg1, arg2 ); \
 		} \
 			\
-		template<typename pass_t> \
-		static inline void func( pass_t &, long, type1, type2 ) {}
+		template<typename core_t> \
+		static inline void func( core_t &, long, type1, type2 ) {}
 
 		SYMTAB_FUNC1( addId     , const DeclWithType *  );
@@ -332,43 +332,43 @@
 
 		// A few extra functions have more complicated behaviour, they are hand written
-		template<typename pass_t>
-		static inline auto addStructFwd( pass_t & pass, int, const ast::StructDecl * decl ) -> decltype( pass.symtab.addStruct( decl ), void() ) {
+		template<typename core_t>
+		static inline auto addStructFwd( core_t & core, int, const ast::StructDecl * decl ) -> decltype( core.symtab.addStruct( decl ), void() ) {
 			ast::StructDecl * fwd = new ast::StructDecl( decl->location, decl->name );
 			fwd->params = decl->params;
-			pass.symtab.addStruct( fwd );
-		}
-
-		template<typename pass_t>
-		static inline void addStructFwd( pass_t &, long, const ast::StructDecl * ) {}
-
-		template<typename pass_t>
-		static inline auto addUnionFwd( pass_t & pass, int, const ast::UnionDecl * decl ) -> decltype( pass.symtab.addUnion( decl ), void() ) {
+			core.symtab.addStruct( fwd );
+		}
+
+		template<typename core_t>
+		static inline void addStructFwd( core_t &, long, const ast::StructDecl * ) {}
+
+		template<typename core_t>
+		static inline auto addUnionFwd( core_t & core, int, const ast::UnionDecl * decl ) -> decltype( core.symtab.addUnion( decl ), void() ) {
 			UnionDecl * fwd = new UnionDecl( decl->location, decl->name );
 			fwd->params = decl->params;
-			pass.symtab.addUnion( fwd );
-		}
-
-		template<typename pass_t>
-		static inline void addUnionFwd( pass_t &, long, const ast::UnionDecl * ) {}
-
-		template<typename pass_t>
-		static inline auto addStruct( pass_t & pass, int, const std::string & str ) -> decltype( pass.symtab.addStruct( str ), void() ) {
-			if ( ! pass.symtab.lookupStruct( str ) ) {
-				pass.symtab.addStruct( str );
+			core.symtab.addUnion( fwd );
+		}
+
+		template<typename core_t>
+		static inline void addUnionFwd( core_t &, long, const ast::UnionDecl * ) {}
+
+		template<typename core_t>
+		static inline auto addStruct( core_t & core, int, const std::string & str ) -> decltype( core.symtab.addStruct( str ), void() ) {
+			if ( ! core.symtab.lookupStruct( str ) ) {
+				core.symtab.addStruct( str );
 			}
 		}
 
-		template<typename pass_t>
-		static inline void addStruct( pass_t &, long, const std::string & ) {}
-
-		template<typename pass_t>
-		static inline auto addUnion( pass_t & pass, int, const std::string & str ) -> decltype( pass.symtab.addUnion( str ), void() ) {
-			if ( ! pass.symtab.lookupUnion( str ) ) {
-				pass.symtab.addUnion( str );
+		template<typename core_t>
+		static inline void addStruct( core_t &, long, const std::string & ) {}
+
+		template<typename core_t>
+		static inline auto addUnion( core_t & core, int, const std::string & str ) -> decltype( core.symtab.addUnion( str ), void() ) {
+			if ( ! core.symtab.lookupUnion( str ) ) {
+				core.symtab.addUnion( str );
 			}
 		}
 
-		template<typename pass_t>
-		static inline void addUnion( pass_t &, long, const std::string & ) {}
+		template<typename core_t>
+		static inline void addUnion( core_t &, long, const std::string & ) {}
 
 		#undef SYMTAB_FUNC1
@@ -380,41 +380,41 @@
 	namespace forall {
 		// Some simple scoping rules
-		template<typename pass_t>
-		static inline auto enter( pass_t & pass, int, const ast::ParameterizedType * type )
-		-> decltype( pass.subs, void() ) {
-			if ( ! type->forall.empty() ) pass.subs.beginScope();
-		}
-
-		template<typename pass_t>
-		static inline auto enter( pass_t &, long, const ast::ParameterizedType * ) {}
-
-		template<typename pass_t>
-		static inline auto leave( pass_t & pass, int, const ast::ParameterizedType * type )
-		-> decltype( pass.subs, void() ) {
-			if ( ! type->forall.empty() ) { pass.subs.endScope(); }
-		}
-
-		template<typename pass_t>
-		static inline auto leave( pass_t &, long, const ast::ParameterizedType * ) {}
+		template<typename core_t>
+		static inline auto enter( core_t & core, int, const ast::ParameterizedType * type )
+		-> decltype( core.subs, void() ) {
+			if ( ! type->forall.empty() ) core.subs.beginScope();
+		}
+
+		template<typename core_t>
+		static inline auto enter( core_t &, long, const ast::ParameterizedType * ) {}
+
+		template<typename core_t>
+		static inline auto leave( core_t & core, int, const ast::ParameterizedType * type )
+		-> decltype( core.subs, void() ) {
+			if ( ! type->forall.empty() ) { core.subs.endScope(); }
+		}
+
+		template<typename core_t>
+		static inline auto leave( core_t &, long, const ast::ParameterizedType * ) {}
 
 		// Get the substitution table, if present
-		template<typename pass_t>
-		static inline auto subs( pass_t & pass, int ) -> decltype( &pass.subs ) {
-			return &pass.subs;
-		}
-
-		template<typename pass_t>
-		static inline ast::ForallSubstitutionTable * subs( pass_t &, long ) { return nullptr; }
+		template<typename core_t>
+		static inline auto subs( core_t & core, int ) -> decltype( &core.subs ) {
+			return &core.subs;
+		}
+
+		template<typename core_t>
+		static inline ast::ForallSubstitutionTable * subs( core_t &, long ) { return nullptr; }
 
 		// Replaces a TypeInstType's base TypeDecl according to the table
-		template<typename pass_t>
-		static inline auto replace( pass_t & pass, int, const ast::TypeInstType *& inst )
-		-> decltype( pass.subs, void() ) {
+		template<typename core_t>
+		static inline auto replace( core_t & core, int, const ast::TypeInstType *& inst )
+		-> decltype( core.subs, void() ) {
 			inst = ast::mutate_field(
-				inst, &ast::TypeInstType::base, pass.subs.replace( inst->base ) );
-		}
-
-		template<typename pass_t>
-		static inline auto replace( pass_t &, long, const ast::TypeInstType *& ) {}
+				inst, &ast::TypeInstType::base, core.subs.replace( inst->base ) );
+		}
+
+		template<typename core_t>
+		static inline auto replace( core_t &, long, const ast::TypeInstType *& ) {}
 
 	} // namespace forall
