public function generateCode($key)
	{
		if($this->extends === NULL && $this->output != '')
		{
			$this->buffer .= "\t\t\$out->write(" . var_export($this->output, true) .  ");\n";
			$this->output = '';
		}
		
		$buffer = sprintf("<?php\n\nnamespace %s {\n\n", __NAMESPACE__);
		$buffer .= 'use KoolKode\View\TagBuilder;' . "\n";
		
		$buffer .= "\n";
		$buffer .= sprintf('final class CompiledTemplate_%s extends CompiledTemplate {' . "\n\n", $key);
		
		for($count = count($this->fields), $step = 8, $i = 0; $i < $count; $i += $step)
		{
			$buffer .= "\tprivate \$" . $this->fields[$i];
			
			for($max = min($count, $i + $step), $j = $i + 1; $j < $max; $j++)
			{
				$buffer .= ', $' . $this->fields[$j];
			}
			
			$buffer .= ";\n";
		}
		
		$buffer .= "\n\tpublic function getResource() {\n";
		$buffer .= "\t\treturn " . var_export($this->resource, true) . ";\n";
		$buffer .= "\t}\n";
		
		if($this->extends === NULL)
		{
			$buffer .= "\n\tprotected function renderMain(OutputBuffer \$out) {\n\n";
			$buffer .= "\t\t\$pout = \$this->context->set('@out', \$out);\n";
			$buffer .= "\t\t\$pthis = \$this->context->set('@this', \$this);\n";
			$buffer .= "\t\ttry {\n";
			$buffer .= "\n" . $this->buffer . "\n";
			$buffer .= "\t\t} finally {\n";
			$buffer .= "\t\t\t\$this->context->set('@out', \$pout);\n";
			$buffer .= "\t\t\t\$this->context->set('@this', \$pthis);\n";
			$buffer .= "\t\t}\n";
			$buffer .= "\t}\n";
		}
		else
		{
			$compiler = new self($this->renderer);
				
			foreach($this->extends as $i => $node)
			{
				if($i != 0)
				{
					$compiler->write(' . ');
				}
		
				$node->compile($compiler, NodeInterface::FLAG_RAW);
			}
			
			$buffer .= "\n\tprotected function getExtended() {\n";
			$buffer .= "\t\treturn " . $compiler->getBuffer() . ";\n";
			$buffer .= "\t}\n";
		}
		
		foreach($this->blocks as $block)
		{
			$buffer .= "\n" . $block;
		}
		
		$buffer .= "}}\n ?>";
		
		return $buffer;
	}