garritfra / qbe-rs

QBE IR in natural Rust data structures
https://c9x.me/compile
Other
80 stars 7 forks source link

feat(functions): return mutatble reference from add_block #18

Closed garritfra closed 2 years ago

garritfra commented 2 years ago

Fixes #17

Description

Function::add_block() should return a reference to the created block.

Changes proposed in this pull request

ToDo

YerinAlexey commented 2 years ago

Function::last_block is useful for checking if the function always returns, for example

garritfra commented 2 years ago

Function::last_block is useful for checking if the function always returns, for example

But that can also be done via self.blocks.last(), which is hardly any more code to write.