diff --git a/README.md b/README.md index c7a060d..5f83d4c 100644 --- a/README.md +++ b/README.md @@ -151,8 +151,6 @@ The server will attempt to read the file ```~/.config/dcd``` on Posix systems, o If it exists, each line of the file is interpreted as a path that should be searched when looking for module imports. - - Keep in mind that DCD treats import paths the same way that the compiler does. For example, a configuration file like this will not work as expected: diff --git a/conversion/first.d b/conversion/first.d index f29d0f9..5479813 100644 --- a/conversion/first.d +++ b/conversion/first.d @@ -405,6 +405,15 @@ final class FirstPass : ASTVisitor versionCondition.accept(this); } + override void visit(const TemplateMixinExpression tme) + { + // TODO: support typeof here + if (tme.mixinTemplateName.symbol is null) + return; + currentSymbol.mixinTemplates.insert(iotcToStringArray(symbolAllocator, + tme.mixinTemplateName.symbol.identifierOrTemplateChain)); + } + alias visit = ASTVisitor.visit; /// Module scope diff --git a/conversion/third.d b/conversion/third.d index a76e9a2..83f214f 100644 --- a/conversion/third.d +++ b/conversion/third.d @@ -149,9 +149,30 @@ private: } } - void resolveMixinTemplates(SemanticSymbol*) + void resolveMixinTemplates(SemanticSymbol* currentSymbol) { - // TODO: + foreach (mix; currentSymbol.mixinTemplates[]) + { + import stupidlog; + Log.trace(mix); + auto symbols = moduleScope.getSymbolsByNameAndCursor(mix[0], + currentSymbol.acSymbol.location); + if (symbols.length == 0) + continue; + auto symbol = symbols[0]; + foreach (m; mix[1 .. $]) + { + auto s = symbol.getPartsByName(m); + if (s.length == 0) + { + symbol = null; + break; + } + else + symbol = s[0]; + } + currentSymbol.acSymbol.parts.insert(symbol.parts[]); + } } ACSymbol* resolveInitializerType(I)(ref const I initializer, size_t location) diff --git a/semantic.d b/semantic.d index f599db1..aeca837 100644 --- a/semantic.d +++ b/semantic.d @@ -77,7 +77,7 @@ public: UnrolledList!(string) aliasThis; /// MixinTemplates - UnrolledList!(string) mixinTemplates; + UnrolledList!(string[]) mixinTemplates; /// Protection level for this symobol IdType protection;