1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

LibWeb: Cache and reuse resolved IDL imports instead of rejecting them

This ensures that transitive imports succeed even if they were directly
imported beforehand.
This commit is contained in:
Idan Horowitz 2022-04-01 21:43:02 +03:00 committed by Ali Mohammad Pur
parent 14dbd28033
commit 3ee8b5e534
3 changed files with 27 additions and 28 deletions

View file

@ -18,7 +18,7 @@ namespace IDL {
class Parser {
public:
Parser(String filename, StringView contents, String import_base_path);
NonnullOwnPtr<Interface> parse();
NonnullRefPtr<Interface> parse();
private:
// https://webidl.spec.whatwg.org/#dfn-special-operation
@ -31,7 +31,7 @@ private:
void assert_specific(char ch);
void assert_string(StringView expected);
void consume_whitespace();
Optional<NonnullOwnPtr<Interface>> resolve_import(auto path);
Optional<NonnullRefPtr<Interface>> resolve_import(auto path);
HashMap<String, String> parse_extended_attributes();
void parse_attribute(HashMap<String, String>& extended_attributes, Interface&);
@ -53,7 +53,7 @@ private:
NonnullRefPtr<Type> parse_type();
void parse_constant(Interface&);
static HashTable<String> s_all_imported_paths;
static HashMap<String, NonnullRefPtr<Interface>> s_resolved_imports;
HashTable<String> required_imported_paths;
String import_base_path;
String filename;