From 896957b31a014b8ff071ff52a80e7ad3c5472b97 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 29 Jun 2016 01:33:40 +0200 Subject: [PATCH] cesyms, rewrite import ident merging in D --- cesyms/cesyms.d | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cesyms/cesyms.d b/cesyms/cesyms.d index f5764411..4247c21e 100644 --- a/cesyms/cesyms.d +++ b/cesyms/cesyms.d @@ -22,7 +22,7 @@ Usage */ module cesyms; -import std.stdio, std.path, std.file, std.array, std.string; +import std.stdio, std.path, std.file, std.array, std.string, std.algorithm; import std.getopt, std.json, std.conv, std.format; import dparse.lexer, dparse.ast, dparse.parser, dparse.rollback_allocator; import std.traits; @@ -383,13 +383,8 @@ class SymbolListBuilder(ListFmt Fmt): ASTVisitor if (!si.identifierChain.identifiers.length) continue; - string[] modules; - foreach (ident; si.identifierChain.identifiers) - { - modules ~= ident.text; - modules ~= "."; - } - otherVisitorImpl(decl, SymbolType._import, modules[0 .. $ - 1].join, + otherVisitorImpl(decl, SymbolType._import, + si.identifierChain.identifiers.map!(a => a.text).join("."), si.identifierChain.identifiers[0].line, si.identifierChain.identifiers[0].column); }