writer/spriv: Add an assert that functions_ is not empty

... before attempting to push instructions to `functions_.back()`

If this fires, we're in an invalid state anyway. At least make the explosion less head scratching.

Change-Id: I7b4a002043de4b55a12d9aba80a0393c630140c2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33664
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/writer/spirv/builder.h b/src/writer/spirv/builder.h
index 7be24c6..7e6acbb 100644
--- a/src/writer/spirv/builder.h
+++ b/src/writer/spirv/builder.h
@@ -175,11 +175,13 @@
   /// @param op the operation
   /// @param operands the operands
   void push_function_inst(spv::Op op, const OperandList& operands) {
+    assert(!functions_.empty());
     functions_.back().push_inst(op, operands);
   }
   /// Pushes a variable to the current function
   /// @param operands the variable operands
   void push_function_var(const OperandList& operands) {
+    assert(!functions_.empty());
     functions_.back().push_var(operands);
   }