LibWeb+LibIDL: Remove support for #import directives during parsing

These no longer serve any purpose now that we run the IDLGenerator
on all of these files at once.
This commit is contained in:
Shannon Booth
2026-04-23 22:41:12 +02:00
committed by Shannon Booth
parent ba741994dd
commit cc6e048bd6
Notes: github-actions[bot] 2026-04-24 18:09:33 +00:00
527 changed files with 10 additions and 1840 deletions

View File

@@ -95,7 +95,6 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
{
Core::ArgsParser args_parser;
Vector<ByteString> paths;
Vector<ByteString> base_paths;
StringView output_path = "-"sv;
StringView depfile_path;
@@ -110,17 +109,6 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
return true;
},
});
args_parser.add_option(Core::ArgsParser::Option {
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
.help_string = "Path to root of IDL file tree(s)",
.long_name = "base-path",
.short_name = 'b',
.value_name = "base-path",
.accept_value = [&](StringView s) {
base_paths.append(s);
return true;
},
});
args_parser.add_option(output_path, "Path to output generated files into", "output-path", 'o', "output-path");
args_parser.add_option(depfile_path, "Path to write dependency file to", "depfile", 'd', "depfile-path");
args_parser.add_positional_argument(paths, "IDL file(s)", "idl-files");
@@ -152,15 +140,8 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
for (auto const& path : paths) {
auto file = TRY(Core::MappedFile::map(path, Core::MappedFile::Mode::ReadOnly));
auto lexical_path = LexicalPath { path };
auto import_base_paths = base_paths;
if (import_base_paths.is_empty())
import_base_paths.append(lexical_path.dirname());
auto module = IDL::Parser::parse(path, file->bytes(), move(import_base_paths), context);
auto module = IDL::Parser::parse(path, file->bytes(), context);
append_dependency_path(path);
for (auto const& imported_file : module.imported_files)
append_dependency_path(imported_file);
}
context.resolve();

View File

@@ -510,26 +510,13 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
Core::ArgsParser args_parser;
StringView output_path;
Vector<ByteString> base_paths;
Vector<ByteString> paths;
args_parser.add_option(output_path, "Path to output generated files into", "output-path", 'o', "output-path");
args_parser.add_option(Core::ArgsParser::Option {
.argument_mode = Core::ArgsParser::OptionArgumentMode::Required,
.help_string = "Path to root of IDL file tree(s)",
.long_name = "base-path",
.short_name = 'b',
.value_name = "base-path",
.accept_value = [&](StringView s) {
base_paths.append(s);
return true;
},
});
args_parser.add_positional_argument(paths, "Paths of every IDL file that could be Exposed", "paths");
args_parser.parse(arguments);
VERIFY(!paths.is_empty());
VERIFY(!base_paths.is_empty());
if (paths.first().starts_with("@"sv)) {
// Response file
@@ -550,12 +537,6 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
}
}
Vector<ByteString> lexical_bases;
for (auto const& base_path : base_paths) {
VERIFY(!base_path.is_empty());
lexical_bases.append(base_path);
}
// Read in all IDL files, we must own the storage for all of these for the lifetime of the program
Vector<NonnullOwnPtr<Core::MappedFile>> files;
files.ensure_capacity(paths.size());
@@ -575,7 +556,7 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
for (size_t i = 0; i < paths.size(); ++i) {
auto const& path = paths[i];
StringView file_contents = files[i]->bytes();
auto module = IDL::Parser::parse(path, file_contents, lexical_bases, context);
auto module = IDL::Parser::parse(path, file_contents, context);
if (!module.interface.has_value()) {
s_error_string = ByteString::formatted("Interface for file {} missing", path);
return Error::from_string_view(s_error_string.view());