From 4e9cc919a18536df35f6f944c11ec48563197ec1 Mon Sep 17 00:00:00 2001 From: relrelb Date: Mon, 15 Aug 2022 02:01:19 +0300 Subject: [PATCH] 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 `::`. --- core/build_playerglobal/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/build_playerglobal/src/lib.rs b/core/build_playerglobal/src/lib.rs index 6b132961f..bb76e685a 100644 --- a/core/build_playerglobal/src/lib.rs +++ b/core/build_playerglobal/src/lib.rs @@ -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 {