mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibCpp: Store filename in ASTNodes
As part of the position information, we now also store the filename the ASTNode belongs to.
This commit is contained in:
parent
c4139be461
commit
d3ff82ba80
Notes:
sideshowbarker
2024-07-18 22:06:40 +09:00
Author: https://github.com/itamar8910
Commit: d3ff82ba80
Pull-request: https://github.com/SerenityOS/serenity/pull/5424
Reviewed-by: https://github.com/awesomekling
5 changed files with 86 additions and 73 deletions
|
@ -72,7 +72,7 @@ OwnPtr<ParserAutoComplete::DocumentData> ParserAutoComplete::create_document_dat
|
|||
auto document = filedb().get(file);
|
||||
ASSERT(document);
|
||||
auto content = document->text();
|
||||
auto document_data = make<DocumentData>(document->text());
|
||||
auto document_data = make<DocumentData>(document->text(), file);
|
||||
auto root = document_data->parser.parse();
|
||||
for (auto& path : document_data->preprocessor.included_paths()) {
|
||||
get_or_create_document_data(document_path_from_include_path(path));
|
||||
|
@ -88,10 +88,10 @@ void ParserAutoComplete::set_document_data(const String& file, OwnPtr<DocumentDa
|
|||
m_documents.set(filedb().to_absolute_path(file), move(data));
|
||||
}
|
||||
|
||||
ParserAutoComplete::DocumentData::DocumentData(String&& _text)
|
||||
ParserAutoComplete::DocumentData::DocumentData(String&& _text, const String& filename)
|
||||
: text(move(_text))
|
||||
, preprocessor(text.view())
|
||||
, parser(preprocessor.process().view())
|
||||
, parser(preprocessor.process().view(), filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue