Skip to content

Commit

Permalink
Fix Disassemble trait implementation comment
Browse files Browse the repository at this point in the history
The comment attached to dr::Function's disassemble() should be for
dr::Module's disassemble().

Also clarified a TODO.
  • Loading branch information
antiagainst committed Oct 13, 2019
1 parent 74b32cc commit 96bbb9f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions rspirv/binary/disassemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ impl Disassemble for dr::BasicBlock {
}

impl Disassemble for dr::Function {
/// Disassembles this module and returns the disassembly text.
///
/// This method will try to link information together to be wise. E.g.,
/// If the extended instruction set is recognized, the symbolic opcode for
/// instructions in it will be shown.
fn disassemble(&self) -> String {
let def = self.def.as_ref().map_or(String::new(), |i| i.disassemble());
let end = self.end.as_ref().map_or(String::new(), |i| i.disassemble());
Expand All @@ -112,6 +107,11 @@ macro_rules! push {
}

impl Disassemble for dr::Module {
/// Disassembles this module and returns the disassembly text.
///
/// This method will try to link information together to be wise. E.g.,
/// If the extended instruction set is recognized, the symbolic opcode for
/// instructions in it will be shown.
fn disassemble(&self) -> String {
let mut ext_inst_set_tracker = tracker::ExtInstSetTracker::new();
for i in &self.ext_inst_imports {
Expand All @@ -129,7 +129,9 @@ impl Disassemble for dr::Module {
.join("\n");
push!(&mut text, global_insts);

// TODO: Code here is essentially duplicated.
// TODO: Code here is essentially duplicated. Ideally we should be able
// to call dr::Function and dr::BasicBlock's disassemble() method here
// but because of the ExtInstSetTracker, we are not able to directly.
for f in &self.functions {
push!(&mut text,
f.def.as_ref().map_or(String::new(), |i| i.disassemble()));
Expand Down

0 comments on commit 96bbb9f

Please sign in to comment.