From b6bc0837ba6e7fb42280bf6289f4dab633c88392 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 29 Jan 2018 16:32:52 -0800 Subject: 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. --- source/slang/slang.cpp | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) (limited to 'source/slang/slang.cpp') 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 CompileRequest::loadModule( return translationUnit->SyntaxNode; } -void CompileRequest::handlePoundImport( - String const& path, - TokenList const& tokens) -{ - RefPtr translationUnit = new TranslationUnitRequest(); - translationUnit->compileRequest = this; - - translationUnit->compileFlags = this->compileFlags & (SLANG_COMPILE_FLAG_USE_IR); - - // Imported code is always native Slang code - RefPtr languageScope = mSession->slangLanguageScope; - - RefPtr 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 CompileRequest::findOrImportModule( Name* name, SourceLoc const& loc) @@ -664,7 +625,7 @@ RefPtr 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; -- cgit v1.2.3