avm2: Fix bindings of empty namespace

Previously native functions defined inside a `package {}` block
(without a package name) would cause a syntax error by two consecutive
`::`.
This commit is contained in:
relrelb 2022-08-15 02:01:19 +03:00 committed by Mike Welsh
parent 91247f5779
commit 4e9cc919a1
1 changed files with 5 additions and 2 deletions

View File

@ -132,8 +132,11 @@ fn rust_method_path(
// For example, a namespace of "flash.system" and a name of "Security"
// turns into the path "flash::system::security"
let multiname = &abc.constant_pool.multinames[parent.0 as usize - 1];
path += &flash_to_rust_path(resolve_multiname_ns(&abc, multiname));
path += "::";
let ns = flash_to_rust_path(resolve_multiname_ns(&abc, multiname));
if !ns.is_empty() {
path += &ns;
path += "::";
}
path += &flash_to_rust_path(resolve_multiname_name(&abc, multiname));
path += "::";
} else {