diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-01-29 16:32:52 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-29 16:32:52 -0800 |
| commit | b6bc0837ba6e7fb42280bf6289f4dab633c88392 (patch) | |
| tree | 1a802fe0f95eaed5d844a55acb666a4791442051 /source/slang/slang.cpp | |
| parent | 06f0effb848c6b938e03da8a61e44b3d032380e8 (diff) | |
Remove #import directive (#389)
Fixes #380
The `#import` directive was a stopgap measure to allow a macro-heavy shader library to incrementally adopt `import`, but it has turned out to cause as many problems as it fixes (not least because users have never been able to form a good mental model around which kind of import to do when).
This change yanks support for the feature.
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 773b1dd09..688593529 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -559,45 +559,6 @@ RefPtr<ModuleDecl> CompileRequest::loadModule( return translationUnit->SyntaxNode; } -void CompileRequest::handlePoundImport( - String const& path, - TokenList const& tokens) -{ - RefPtr<TranslationUnitRequest> translationUnit = new TranslationUnitRequest(); - translationUnit->compileRequest = this; - - translationUnit->compileFlags = this->compileFlags & (SLANG_COMPILE_FLAG_USE_IR); - - // Imported code is always native Slang code - RefPtr<Scope> languageScope = mSession->slangLanguageScope; - - RefPtr<ModuleDecl> translationUnitSyntax = new ModuleDecl(); - translationUnit->SyntaxNode = translationUnitSyntax; - - parseSourceFile( - translationUnit.Ptr(), - tokens, - &mSink, - languageScope); - - // TODO: handle errors - - // TODO: It is a bit broken here that we use the module path, - // as the "name" when registering things, but this saves - // us the trouble of trying to special-case things when - // checking an `import` down the road. - // - // Ideally we'd construct a suitable name by effectively - // running the name->path logic in reverse (e.g., replacing - // `-` with `_` and `/` with `.`). - Name* name = getNamePool()->getName(path); - - loadParsedModule( - translationUnit, - name, - path); -} - RefPtr<ModuleDecl> CompileRequest::findOrImportModule( Name* name, SourceLoc const& loc) @@ -664,7 +625,7 @@ RefPtr<ModuleDecl> CompileRequest::findOrImportModule( break; } - // Maybe this was loaded previously via `#import` + // Maybe this was loaded previously at a different relative name? if (mapPathToLoadedModule.TryGetValue(foundPath, loadedModule)) return loadedModule->moduleDecl; |
