mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-17 07:50:04 +00:00
LibIDL: Remove static maps for interfaces and resolved imports
Instead, create a tree of Parsers all pointing to a top-level Parser. All module imports and interfaces are stored at the top level, instead of in a static map. This allows creating multiple IDL::Parsers in the same process without them stepping on each others toes.
This commit is contained in:
parent
2341294c20
commit
067a53b7e7
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/ADKaster
Commit: 067a53b7e7
Pull-request: https://github.com/SerenityOS/serenity/pull/15520
3 changed files with 49 additions and 14 deletions
|
@ -28,6 +28,8 @@ private:
|
|||
Yes,
|
||||
};
|
||||
|
||||
Parser(Parser* parent, String filename, StringView contents, String import_base_path);
|
||||
|
||||
void assert_specific(char ch);
|
||||
void assert_string(StringView expected);
|
||||
void consume_whitespace();
|
||||
|
@ -53,13 +55,17 @@ private:
|
|||
NonnullRefPtr<Type> parse_type();
|
||||
void parse_constant(Interface&);
|
||||
|
||||
static HashTable<NonnullOwnPtr<Interface>> s_interfaces;
|
||||
static HashMap<String, Interface*> s_resolved_imports;
|
||||
|
||||
String import_base_path;
|
||||
String filename;
|
||||
StringView input;
|
||||
GenericLexer lexer;
|
||||
|
||||
HashTable<NonnullOwnPtr<Interface>>& top_level_interfaces();
|
||||
HashTable<NonnullOwnPtr<Interface>> interfaces;
|
||||
HashMap<String, Interface*>& top_level_resolved_imports();
|
||||
HashMap<String, Interface*> resolved_imports;
|
||||
Parser* top_level_parser();
|
||||
Parser* parent = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue