summaryrefslogtreecommitdiffstats
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-26 09:32:40 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-26 12:06:54 -0700
commit7d3bfe403362b294cc2a1f2607d51dfcd447aafd (patch)
tree4dac8dcdb29a0d8e74f78f12c0bbe63e669b2b0c /source/slang/slang.cpp
parent3f316dcbd9274efc74f817cf36f17a511ff2e21e (diff)
Replace "auto-import" with `#import`
Right now `#import` only differs from `#include` in that it takes a string literal for a file name instead of a raw identifier (to which `.slang` gets appended). The next step is to make `#import` respect preprocessor state, while `__import` doesn't.
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp34
1 files changed, 3 insertions, 31 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index fc18ea1cf..76cb502c0 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -103,21 +103,7 @@ struct IncludeHandlerImpl : IncludeHandler
request->mDependencyFilePaths.Add(path);
- // HACK(tfoley): We might have found the file in the same directory,
- // but what if this is also inside an auto-import path?
- for (auto & dir : request->searchDirectories)
- {
- // Only consider auto-import paths
- if(dir.kind != SearchDirectory::Kind::AutoImport)
- continue;
-
- String otherPath = Path::Combine(dir.path, pathToInclude);
-
- if(otherPath == path)
- return IncludeResult::FoundAutoImportFile;
- }
-
- return IncludeResult::FoundIncludeFile;
+ return IncludeResult::Found;
}
for (auto & dir : request->searchDirectories)
@@ -130,14 +116,7 @@ struct IncludeHandlerImpl : IncludeHandler
request->mDependencyFilePaths.Add(path);
- switch( dir.kind )
- {
- case SearchDirectory::Kind::Default:
- return IncludeResult::FoundIncludeFile;
-
- case SearchDirectory::Kind::AutoImport:
- return IncludeResult::FoundAutoImportFile;
- }
+ return IncludeResult::Found;
}
}
return IncludeResult::NotFound;
@@ -674,14 +653,7 @@ SLANG_API void spAddSearchPath(
SlangCompileRequest* request,
const char* path)
{
- REQ(request)->searchDirectories.Add(Slang::SearchDirectory(path, Slang::SearchDirectory::Kind::Default));
-}
-
-SLANG_API void spAddAutoImportPath(
- SlangCompileRequest* request,
- const char* path)
-{
- REQ(request)->searchDirectories.Add(Slang::SearchDirectory(path, Slang::SearchDirectory::Kind::AutoImport));
+ REQ(request)->searchDirectories.Add(Slang::SearchDirectory(path));
}
SLANG_API void spAddPreprocessorDefine(