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