"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dmd/traits.d" between
dmd-2.093.0.tar.gz and dmd-2.093.1.tar.gz

About: DMD (Digital Mars D) is the D reference compiler. D is an object-oriented, imperative, multi-paradigm system programming language.

traits.d  (dmd-2.093.0):traits.d  (dmd-2.093.1)
skipping to change at line 1187 skipping to change at line 1187
if (!TemplateInstance.semanticTiargs(e.loc, sc, e.args, 3)) if (!TemplateInstance.semanticTiargs(e.loc, sc, e.args, 3))
return new ErrorExp(); return new ErrorExp();
if (dim != 1) if (dim != 1)
return dimError(1); return dimError(1);
auto o = (*e.args)[0]; auto o = (*e.args)[0];
auto po = isParameter(o); auto po = isParameter(o);
auto s = getDsymbolWithoutExpCtx(o); auto s = getDsymbolWithoutExpCtx(o);
UserAttributeDeclaration udad = null; UserAttributeDeclaration udad = null;
Scope* sc2 = sc;
if (po) if (po)
{ {
udad = po.userAttribDecl; udad = po.userAttribDecl;
} }
else if (s) else if (s)
{ {
if (s.isImport()) if (s.isImport())
{ {
s = s.isImport().mod; s = s.isImport().mod;
} }
//printf("getAttributes %s, attrs = %p, scope = %p\n", s.toChars(), s.userAttribDecl, s.scope); //printf("getAttributes %s, attrs = %p, scope = %p\n", s.toChars(), s.userAttribDecl, s.scope);
udad = s.userAttribDecl; udad = s.userAttribDecl;
// Use the symbol scope when possible
if (s._scope)
sc2 = s._scope;
else if (auto m = s.getModule()) // needed for some top level symbol
s
sc2 = m._scope;
} }
else else
{ {
version (none) version (none)
{ {
Expression x = isExpression(o); Expression x = isExpression(o);
Type t = isType(o); Type t = isType(o);
if (x) if (x)
printf("e = %s %s\n", Token.toChars(x.op), x.toChars()); printf("e = %s %s\n", Token.toChars(x.op), x.toChars());
if (t) if (t)
printf("t = %d %s\n", t.ty, t.toChars()); printf("t = %d %s\n", t.ty, t.toChars());
} }
e.error("first argument is not a symbol"); e.error("first argument is not a symbol");
return new ErrorExp(); return new ErrorExp();
} }
auto exps = udad ? udad.getAttributes() : new Expressions(); auto exps = udad ? udad.getAttributes() : new Expressions();
auto tup = new TupleExp(e.loc, exps); auto tup = new TupleExp(e.loc, exps);
return tup.expressionSemantic(sc2); return tup.expressionSemantic(sc);
} }
if (e.ident == Id.getFunctionAttributes) if (e.ident == Id.getFunctionAttributes)
{ {
/* Extract all function attributes as a tuple (const/shared/inout/pure/n othrow/etc) except UDAs. /* Extract all function attributes as a tuple (const/shared/inout/pure/n othrow/etc) except UDAs.
* https://dlang.org/spec/traits.html#getFunctionAttributes * https://dlang.org/spec/traits.html#getFunctionAttributes
*/ */
if (dim != 1) if (dim != 1)
return dimError(1); return dimError(1);
FuncDeclaration fd; FuncDeclaration fd;
skipping to change at line 1436 skipping to change at line 1429
else else
{ {
auto s = getDsymbol(o); auto s = getDsymbol(o);
Declaration d; Declaration d;
AggregateDeclaration agg; AggregateDeclaration agg;
if (!s || ((d = s.isDeclaration()) is null && (agg = s.isAggregateDe claration()) is null)) if (!s || ((d = s.isDeclaration()) is null && (agg = s.isAggregateDe claration()) is null))
{ {
e.error("argument to `__traits(getLinkage, %s)` is not a declara tion", o.toChars()); e.error("argument to `__traits(getLinkage, %s)` is not a declara tion", o.toChars());
return new ErrorExp(); return new ErrorExp();
} }
if (d !is null) if (d !is null)
link = d.linkage; link = d.linkage;
else final switch (agg.classKind) else
{ {
case ClassKind.d: // Resolves forward references
link = LINK.d; if (agg.sizeok != Sizeok.done)
break; {
case ClassKind.cpp: agg.size(e.loc);
link = LINK.cpp; if (agg.sizeok != Sizeok.done)
break; {
case ClassKind.objc: e.error("%s `%s` is forward referenced", agg.kind(), agg
link = LINK.objc; .toChars());
break; return new ErrorExp();
}
}
final switch (agg.classKind)
{
case ClassKind.d:
link = LINK.d;
break;
case ClassKind.cpp:
link = LINK.cpp;
break;
case ClassKind.objc:
link = LINK.objc;
break;
}
} }
} }
auto linkage = linkageToChars(link); auto linkage = linkageToChars(link);
auto se = new StringExp(e.loc, linkage.toDString()); auto se = new StringExp(e.loc, linkage.toDString());
return se.expressionSemantic(sc); return se.expressionSemantic(sc);
} }
if (e.ident == Id.allMembers || if (e.ident == Id.allMembers ||
e.ident == Id.derivedMembers) e.ident == Id.derivedMembers)
{ {
if (dim != 1) if (dim != 1)
 End of changes. 6 change blocks. 
19 lines changed or deleted 27 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)