[spv-in] support string instruction

This commit is contained in:
Systemcluster 2021-02-14 10:47:30 +01:00 committed by Dzmitry Malyshau
parent dcd269782a
commit b642c5b89b

View File

@ -1654,6 +1654,7 @@ impl<I: Iterator<Item = u32>> Parser<I> {
Op::MemoryModel => self.parse_memory_model(inst),
Op::EntryPoint => self.parse_entry_point(inst),
Op::ExecutionMode => self.parse_execution_mode(inst),
Op::String => self.parse_string(inst),
Op::Source => self.parse_source(inst),
Op::SourceExtension => self.parse_source_extension(inst),
Op::Name => self.parse_name(inst),
@ -1840,6 +1841,13 @@ impl<I: Iterator<Item = u32>> Parser<I> {
Ok(())
}
fn parse_string(&mut self, inst: Instruction) -> Result<(), Error> {
self.switch(ModuleState::Source, inst.op)?;
inst.expect_at_least(3)?;
let (_name, _) = self.next_string(inst.wc - 1)?;
Ok(())
}
fn parse_source(&mut self, inst: Instruction) -> Result<(), Error> {
self.switch(ModuleState::Source, inst.op)?;
for _ in 1..inst.wc {