1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:27:43 +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:
Itamar 2021-02-20 12:23:53 +02:00 committed by Andreas Kling
parent c4139be461
commit d3ff82ba80
5 changed files with 86 additions and 73 deletions

View file

@ -38,9 +38,10 @@
namespace Cpp {
Parser::Parser(const StringView& program)
Parser::Parser(const StringView& program, const String& filename)
: m_program(program)
, m_lines(m_program.split_view("\n", true))
, m_filename(filename)
{
Lexer lexer(m_program);
for (auto& token : lexer.lex()) {