Line |
Branch |
Exec |
Source |
1 |
|
|
// Copyright (c) 2021-2024 ChilliBits. All rights reserved. |
2 |
|
|
|
3 |
|
|
#pragma once |
4 |
|
|
|
5 |
|
|
#include <CompilerPass.h> |
6 |
|
|
#include <ast/ASTVisitor.h> |
7 |
|
|
#include <global/GlobalResourceManager.h> |
8 |
|
|
|
9 |
|
|
namespace spice::compiler { |
10 |
|
|
|
11 |
|
|
/** |
12 |
|
|
* Jobs: |
13 |
|
|
* - Visit the import statements of a source file and register the imported files as dependencies to the current one |
14 |
|
|
*/ |
15 |
|
|
class ImportCollector final : CompilerPass, public ASTVisitor { |
16 |
|
|
public: |
17 |
|
|
// Constructors |
18 |
|
894 |
ImportCollector(GlobalResourceManager &resourceManager, SourceFile *sourcefile) : CompilerPass(resourceManager, sourcefile) {} |
19 |
|
|
|
20 |
|
|
// Public methods |
21 |
|
|
std::any visitEntry(EntryNode *node) override; |
22 |
|
|
std::any visitImportDef(ImportDefNode *node) override; |
23 |
|
|
std::any visitModAttr(ModAttrNode *node) override; |
24 |
|
|
}; |
25 |
|
|
|
26 |
|
|
} // namespace spice::compiler |
27 |
|
|
|