LibIDL+LibWeb: Begin supporting the LegacyNamespace extended attribute

This is used by WebAssembly IDL files. For now, we mostly use this for
error messages and cache keys (to ensure compatibility with existing
code as WebAssembly is ported to IDL).
This commit is contained in:
Timothy Flynn 2023-03-15 14:40:51 -04:00 committed by Andreas Kling
commit af119d92cb
Notes: sideshowbarker 2024-07-16 23:05:02 +09:00
4 changed files with 16 additions and 8 deletions

View file

@ -592,6 +592,11 @@ void Parser::parse_interface(Interface& interface)
parse_function(extended_attributes, interface);
}
if (auto legacy_namespace = interface.extended_attributes.get("LegacyNamespace"sv); legacy_namespace.has_value())
interface.namespaced_name = DeprecatedString::formatted("{}.{}", *legacy_namespace, interface.name);
else
interface.namespaced_name = interface.name;
interface.constructor_class = DeprecatedString::formatted("{}Constructor", interface.name);
interface.prototype_class = DeprecatedString::formatted("{}Prototype", interface.name);
interface.prototype_base_class = DeprecatedString::formatted("{}Prototype", interface.parent_name.is_empty() ? "Object" : interface.parent_name);