Skip to content

Commit a59749c

Browse files
committed
Temporarily go back to the previous code to see about the autotester
1 parent 15965d6 commit a59749c

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

std/typecons.d

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -535,16 +535,26 @@ if (distinctFieldNames!(Specs))
535535
string injectNamedFields()
536536
{
537537
string decl = "";
538-
import std.conv : to;
539-
static foreach (i, val; fieldSpecs)
540-
{{
541-
auto si = to!string(i);
542-
decl ~= "alias _" ~ si ~ " = Identity!(field[" ~ si ~ "]);";
543-
if (val.name.length != 0)
538+
foreach (i, name; staticMap!(extractName, fieldSpecs))
539+
{
540+
import std.format : format;
541+
542+
decl ~= format("alias _%s = Identity!(field[%s]);", i, i);
543+
if (name.length != 0)
544544
{
545-
decl ~= "alias " ~ val.name ~ " = _" ~ si ~ ";";
545+
decl ~= format("alias %s = _%s;", name, i);
546546
}
547-
}}
547+
}
548+
// import std.conv : to;
549+
// static foreach (i, val; fieldSpecs)
550+
// {{
551+
// auto si = to!string(i);
552+
// decl ~= "alias _" ~ si ~ " = Identity!(field[" ~ si ~ "]);";
553+
// if (val.name.length != 0)
554+
// {
555+
// decl ~= "alias " ~ val.name ~ " = _" ~ si ~ ";";
556+
// }
557+
// }}
548558
return decl;
549559
}
550560

0 commit comments

Comments
 (0)