Index: src/AST/Pass.hpp
===================================================================
--- src/AST/Pass.hpp	(revision e7d6968ca3b4455b39947466f58154fce3451c5c)
+++ src/AST/Pass.hpp	(revision cb25fc9986ee4c5499f5787578c8c32099e0d866)
@@ -88,4 +88,10 @@
 		if(visitor) {
 			*const_cast<type **>( visitor ) = this;
+		}
+
+		// After the pass is constructed, check if it wants to track the inFunction field
+		const bool * const * infunc_ptr = __pass::infunc_ptr(core, 0);
+		if(infunc_ptr) {
+			*const_cast<const bool **>( infunc_ptr ) = &this->inFunction;
 		}
 	}
@@ -380,4 +386,17 @@
 };
 
+/// Used to track whether or not we are in a function.
+class WithIsInFuncion {
+	const bool * const __in_funct_ptr = nullptr;
+
+	template<typename core_t>
+	friend class Pass;
+public:
+	bool isInFunction() {
+		assert( __in_funct_ptr );
+		return *__in_funct_ptr;
+	}
+};
+
 /// Use when the templated visitor should update the symbol table
 struct WithSymbolTable {
Index: src/AST/Pass.proto.hpp
===================================================================
--- src/AST/Pass.proto.hpp	(revision e7d6968ca3b4455b39947466f58154fce3451c5c)
+++ src/AST/Pass.proto.hpp	(revision cb25fc9986ee4c5499f5787578c8c32099e0d866)
@@ -244,4 +244,5 @@
 	FIELD_PTR( at_cleanup, __pass::at_cleanup_t )
 	FIELD_PTR( visitor, ast::Pass<core_t> * const )
+	FIELD_PTR( infunc_ptr, const bool * const )
 
 	// Remove the macro to make sure we don't clash
