mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-11-15 07:07:16 +00:00
Provide unique name from closures with same name (#488)
In YUL it's possible to declare closure with a same name, but in different scope, which previously resulted to func name conflict during LLVM IR construction. To solve this, track YUL scope when building LLVM IR and a special counter that increments every time function with the same name exists in LLVM module. There's still assert if somehow within the same scope there 2 functions with the same name, which should be forbidden by Yul Fixes: #474 --------- Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
This commit is contained in:
1 parent
dc155efc73
commit
61ac247135
8 files changed
+218
-19
No files matched your search
@@ -136,6 +136,7 @@ impl Block {
|
||||
|
||||
impl PolkaVMWriteLLVM for Block {
|
||||
fn into_llvm(self, context: &mut PolkaVMContext) -> anyhow::Result<()> {
|
||||
context.push_function_scope();
|
||||
let current_function = context.current_function().borrow().name().to_owned();
|
||||
let current_block = context.basic_block();
|
||||
|
||||
@@ -223,6 +224,7 @@ impl PolkaVMWriteLLVM for Block {
|
||||
}
|
||||
|
||||
context.pop_debug_scope();
|
||||
context.pop_function_scope();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user