LibWeb/Bindings: Track generated binding includes at use sites
Replace the bindings generator's up-front dependency include scan with a GeneratedIncludes accumulator that is threaded through the implementation, dictionary conversion, argument conversion, and wrapping emitters. Emitters now add the headers required by the code they produce, while generated headers and implementations are built into temporary builders so includes can be collected before the prologue is emitted. This also folds module, bindings, and iterator include handling into the same sorted/deduped header path mechanism.
This commit is contained in:
parent
6248296f86
commit
63195c4830
4 changed files with 517 additions and 669 deletions
|
|
@ -338,14 +338,6 @@ bool Type::is_json(Context const& context) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Interface::will_generate_code() const
|
||||
{
|
||||
return !is_partial
|
||||
&& (!name.is_empty()
|
||||
|| !own_dictionaries.is_empty()
|
||||
|| !own_enumerations.is_empty());
|
||||
}
|
||||
|
||||
void EffectiveOverloadSet::remove_all_other_entries()
|
||||
{
|
||||
Vector<Item> new_items;
|
||||
|
|
|
|||
|
|
@ -234,8 +234,6 @@ public:
|
|||
|
||||
virtual ~ParameterizedType() override = default;
|
||||
|
||||
void generate_sequence_from_iterable(SourceGenerator& generator, ByteString const& cpp_name, ByteString const& iterable_cpp_name, ByteString const& iterator_method_cpp_name, Context const&, size_t recursion_depth) const;
|
||||
|
||||
Vector<NonnullRefPtr<Type const>> const& parameters() const { return m_parameters; }
|
||||
Vector<NonnullRefPtr<Type const>>& parameters() { return m_parameters; }
|
||||
|
||||
|
|
@ -336,8 +334,6 @@ public:
|
|||
// https://webidl.spec.whatwg.org/#dfn-legacy-platform-object
|
||||
bool is_legacy_platform_object() const { return !extended_attributes.contains("Global") && (supports_indexed_properties() || supports_named_properties()); }
|
||||
|
||||
bool will_generate_code() const;
|
||||
|
||||
void extend_with_partial_interface(Interface const&);
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -157,7 +157,7 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
|
|||
auto implementation_path = ByteString::formatted("{}.cpp", path_prefix);
|
||||
|
||||
if constexpr (BINDINGS_GENERATOR_DEBUG) {
|
||||
if (module->interface.has_value() && module->interface->will_generate_code())
|
||||
if (module->interface.has_value())
|
||||
module->interface->dump();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue