diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-06-26 13:47:08 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-26 13:47:08 -0700 |
| commit | 0259ddb0a72d3b12278404847f6e30b63e97cfc3 (patch) | |
| tree | d73c230a8b2ddc06e0fa978945aa8a838b189236 /source/slang/compiler.h | |
| parent | 3f316dcbd9274efc74f817cf36f17a511ff2e21e (diff) | |
| parent | f6cb66feab3439f41ca87cb307f69b49654883ab (diff) | |
Merge pull request #43 from tfoleyNV/import-macros
Add support for `#import`
Diffstat (limited to 'source/slang/compiler.h')
| -rw-r--r-- | source/slang/compiler.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/source/slang/compiler.h b/source/slang/compiler.h index 3f45ea5c7..a6f3eee0e 100644 --- a/source/slang/compiler.h +++ b/source/slang/compiler.h @@ -150,21 +150,13 @@ namespace Slang // A directory to be searched when looking for files (e.g., `#include`) struct SearchDirectory { - enum Kind - { - Default, - AutoImport, - }; - SearchDirectory() = default; SearchDirectory(SearchDirectory const& other) = default; - SearchDirectory(String const& path, Kind kind) + SearchDirectory(String const& path) : path(path) - , kind(kind) {} String path; - Kind kind; }; class Session; @@ -211,9 +203,16 @@ namespace Slang RefPtr<ProgramLayout> layout; // Modules that have been dynamically loaded via `import` - Dictionary<String, RefPtr<ProgramSyntaxNode>> loadedModulesMap; + // + // This is a list of unique modules loaded, in the order they were encountered. List<RefPtr<ProgramSyntaxNode> > loadedModulesList; + // Map from the logical name of a module to its definition + Dictionary<String, RefPtr<ProgramSyntaxNode>> mapPathToLoadedModule; + + // Map from the path of a module file to its definition + Dictionary<String, RefPtr<ProgramSyntaxNode>> mapNameToLoadedModules; + CompileRequest(Session* session) : mSession(session) @@ -255,10 +254,9 @@ namespace Slang String const& source, CodePosition const& loc); - String autoImportModule( + void handlePoundImport( String const& path, - String const& source, - CodePosition const& loc); + TokenList const& tokens); RefPtr<ProgramSyntaxNode> findOrImportModule( String const& name, |
