"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dmd/typesem.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.

typesem.d  (dmd-2.093.0):typesem.d  (dmd-2.093.1)
skipping to change at line 534 skipping to change at line 534
if (n == tn) if (n == tn)
return t; return t;
TypeNext tr = cast(TypeNext)t.copy(); TypeNext tr = cast(TypeNext)t.copy();
tr.next = n; tr.next = n;
return tr; return tr;
} }
} }
/****************************************** /******************************************
* We've mistakenly parsed `t` as a type. * We've mistakenly parsed `t` as a type.
* Redo `t` as an Expression. * Redo `t` as an Expression only if there are no type modifiers.
* Params: * Params:
* t = mistaken type * t = mistaken type
* Returns: * Returns:
* t redone as Expression, null if cannot * t redone as Expression, null if cannot
*/ */
Expression typeToExpression(Type t) Expression typeToExpression(Type t)
{ {
static Expression visitSArray(TypeSArray t) static Expression visitSArray(TypeSArray t)
{ {
if (auto e = t.next.typeToExpression()) if (auto e = t.next.typeToExpression())
skipping to change at line 575 skipping to change at line 575
{ {
return typeToExpressionHelper(t, new ScopeExp(t.loc, t.tempinst)); return typeToExpressionHelper(t, new ScopeExp(t.loc, t.tempinst));
} }
// easy way to enable 'auto v = new int[mixin("exp")];' in 2.088+ // easy way to enable 'auto v = new int[mixin("exp")];' in 2.088+
static Expression visitMixin(TypeMixin t) static Expression visitMixin(TypeMixin t)
{ {
return new TypeExp(t.loc, t); return new TypeExp(t.loc, t);
} }
if (t.mod)
return null;
switch (t.ty) switch (t.ty)
{ {
case Tsarray: return visitSArray(cast(TypeSArray) t); case Tsarray: return visitSArray(cast(TypeSArray) t);
case Taarray: return visitAArray(cast(TypeAArray) t); case Taarray: return visitAArray(cast(TypeAArray) t);
case Tident: return visitIdentifier(cast(TypeIdentifier) t); case Tident: return visitIdentifier(cast(TypeIdentifier) t);
case Tinstance: return visitInstance(cast(TypeInstance) t); case Tinstance: return visitInstance(cast(TypeInstance) t);
case Tmixin: return visitMixin(cast(TypeMixin) t); case Tmixin: return visitMixin(cast(TypeMixin) t);
default: return null; default: return null;
} }
} }
skipping to change at line 1915 skipping to change at line 1917
Type t = new TypeTuple(args); Type t = new TypeTuple(args);
return t.typeSemantic(loc, sc); return t.typeSemantic(loc, sc);
} }
Type visitMixin(TypeMixin mtype) Type visitMixin(TypeMixin mtype)
{ {
//printf("TypeMixin::semantic() %s\n", toChars()); //printf("TypeMixin::semantic() %s\n", toChars());
auto o = mtype.compileTypeMixin(loc, sc); auto o = mtype.compileTypeMixin(loc, sc);
if (auto t = o.isType()) if (auto t = o.isType())
{ {
return t.typeSemantic(loc, sc); return t.typeSemantic(loc, sc).addMod(mtype.mod);
} }
else if (auto e = o.isExpression()) else if (auto e = o.isExpression())
{ {
e = e.expressionSemantic(sc); e = e.expressionSemantic(sc);
if (auto et = e.isTypeExp()) if (auto et = e.isTypeExp())
return et.type; return et.type.addMod(mtype.mod);
else else
{ {
if (!global.errors) if (!global.errors)
.error(e.loc, "`%s` does not give a valid type", o.toChars); .error(e.loc, "`%s` does not give a valid type", o.toChars);
} }
} }
return error(); return error();
} }
switch (t.ty) switch (t.ty)
skipping to change at line 3051 skipping to change at line 3053
} }
} }
void visitMixin(TypeMixin mt) void visitMixin(TypeMixin mt)
{ {
auto o = mt.compileTypeMixin(loc, sc); auto o = mt.compileTypeMixin(loc, sc);
if (auto t = o.isType()) if (auto t = o.isType())
{ {
resolve(t, loc, sc, pe, pt, ps, intypeid); resolve(t, loc, sc, pe, pt, ps, intypeid);
if (*pt)
(*pt) = (*pt).addMod(mt.mod);
} }
else if (auto e = o.isExpression()) else if (auto e = o.isExpression())
{ {
e = e.expressionSemantic(sc); e = e.expressionSemantic(sc);
if (auto et = e.isTypeExp()) if (auto et = e.isTypeExp())
return returnType(et.type); return returnType(et.type.addMod(mt.mod));
else else
returnExp(e); returnExp(e);
} }
else else
returnError(); returnError();
} }
void visitTraits(TypeTraits tt) void visitTraits(TypeTraits tt)
{ {
if (Type t = typeSemantic(tt, loc, sc)) if (Type t = typeSemantic(tt, loc, sc))
 End of changes. 6 change blocks. 
4 lines changed or deleted 8 lines changed or added

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