code: function() {
  		var lastScope;
  
  		// find the first reference scope
  		var templateContext = this.getScope(function(scope) {
  			lastScope = scope;
  			return scope._context instanceof TemplateContext;
  		});
  
  		// if there is no reference scope, add one as the root
  		if(!templateContext) {
  			templateContext = new Scope(new TemplateContext());
  
  			// add templateContext to root of the scope chain so it
  			// can be found using `getScope` next time it is looked up
  			lastScope._parent = templateContext;
  		}
  		return templateContext;
  	}
docs: ### scope.getTemplateContext Returns the template context scope This function isn't named right.