mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
refactor Type.resolve()
This commit is contained in:
parent
ce4f53a108
commit
3ca7686e77
6 changed files with 82 additions and 82 deletions
|
@ -6623,7 +6623,7 @@ void aliasSemantic(AliasDeclaration ds, Scope* sc)
|
||||||
sc2.stc |= ds.storage_class & (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.shared_ | STC.disable);
|
sc2.stc |= ds.storage_class & (STC.ref_ | STC.nothrow_ | STC.nogc | STC.pure_ | STC.shared_ | STC.disable);
|
||||||
}
|
}
|
||||||
ds.type = ds.type.addSTC(ds.storage_class);
|
ds.type = ds.type.addSTC(ds.storage_class);
|
||||||
ds.type.resolve(ds.loc, sc2, &e, &t, &s);
|
ds.type.resolve(ds.loc, sc2, e, t, s);
|
||||||
if (sc2 != sc)
|
if (sc2 != sc)
|
||||||
sc2.pop();
|
sc2.pop();
|
||||||
|
|
||||||
|
|
|
@ -1983,11 +1983,11 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol
|
||||||
* instantiation scope 'sc' and the one
|
* instantiation scope 'sc' and the one
|
||||||
* belonging to the template itself. */
|
* belonging to the template itself. */
|
||||||
sco = sc;
|
sco = sc;
|
||||||
taa.index.resolve(instLoc, sco, &e, &t, &s);
|
taa.index.resolve(instLoc, sco, e, t, s);
|
||||||
if (!e)
|
if (!e)
|
||||||
{
|
{
|
||||||
sco = paramscope;
|
sco = paramscope;
|
||||||
taa.index.resolve(instLoc, sco, &e, &t, &s);
|
taa.index.resolve(instLoc, sco, e, t, s);
|
||||||
}
|
}
|
||||||
global.endGagging(errors);
|
global.endGagging(errors);
|
||||||
|
|
||||||
|
@ -3847,7 +3847,7 @@ MATCH deduceType(RootObject o, Scope* sc, Type tparam, TemplateParameters* param
|
||||||
Expression e;
|
Expression e;
|
||||||
Type tx;
|
Type tx;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
taa.index.resolve(Loc.initial, sc, &e, &tx, &s);
|
taa.index.resolve(Loc.initial, sc, e, tx, s);
|
||||||
edim = s ? getValue(s) : getValue(e);
|
edim = s ? getValue(s) : getValue(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4058,7 +4058,7 @@ MATCH deduceType(RootObject o, Scope* sc, Type tparam, TemplateParameters* param
|
||||||
Type tx;
|
Type tx;
|
||||||
Expression e;
|
Expression e;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
tid.resolve(tp.loc, sc, &e, &tx, &s);
|
tid.resolve(tp.loc, sc, e, tx, s);
|
||||||
Pool!TypeIdentifier.dispose(tid);
|
Pool!TypeIdentifier.dispose(tid);
|
||||||
if (tx)
|
if (tx)
|
||||||
{
|
{
|
||||||
|
@ -4242,7 +4242,7 @@ MATCH deduceType(RootObject o, Scope* sc, Type tparam, TemplateParameters* param
|
||||||
L1:
|
L1:
|
||||||
if (j == IDX_NOTFOUND)
|
if (j == IDX_NOTFOUND)
|
||||||
{
|
{
|
||||||
t2.resolve((cast(TypeIdentifier)t2).loc, sc, &e2, &t2, &s2);
|
t2.resolve((cast(TypeIdentifier)t2).loc, sc, e2, t2, s2);
|
||||||
if (e2)
|
if (e2)
|
||||||
goto Le;
|
goto Le;
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
|
@ -4261,7 +4261,7 @@ MATCH deduceType(RootObject o, Scope* sc, Type tparam, TemplateParameters* param
|
||||||
j = templateParameterLookup(t2, parameters);
|
j = templateParameterLookup(t2, parameters);
|
||||||
if (j == IDX_NOTFOUND)
|
if (j == IDX_NOTFOUND)
|
||||||
{
|
{
|
||||||
t2.resolve((cast(TypeIdentifier)t2).loc, sc, &e2, &t2, &s2);
|
t2.resolve((cast(TypeIdentifier)t2).loc, sc, e2, t2, s2);
|
||||||
if (s2)
|
if (s2)
|
||||||
goto Ls;
|
goto Ls;
|
||||||
goto Lnomatch;
|
goto Lnomatch;
|
||||||
|
@ -6581,7 +6581,7 @@ extern (C++) class TemplateInstance : ScopeDsymbol
|
||||||
//printf("type %s\n", ta.toChars());
|
//printf("type %s\n", ta.toChars());
|
||||||
|
|
||||||
// It might really be an Expression or an Alias
|
// It might really be an Expression or an Alias
|
||||||
ta.resolve(loc, sc, &ea, &ta, &sa, (flags & 1) != 0);
|
ta.resolve(loc, sc, ea, ta, sa, (flags & 1) != 0);
|
||||||
if (ea)
|
if (ea)
|
||||||
goto Lexpr;
|
goto Lexpr;
|
||||||
if (sa)
|
if (sa)
|
||||||
|
@ -7642,7 +7642,7 @@ extern (C++) final class TemplateMixin : TemplateInstance
|
||||||
Expression e;
|
Expression e;
|
||||||
Type t;
|
Type t;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
tqual.resolve(loc, sc, &e, &t, &s);
|
tqual.resolve(loc, sc, e, t, s);
|
||||||
if (!s)
|
if (!s)
|
||||||
{
|
{
|
||||||
error("is not defined");
|
error("is not defined");
|
||||||
|
|
|
@ -3215,7 +3215,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
Type t;
|
Type t;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
|
|
||||||
dmd.typesem.resolve(exp.type, exp.loc, sc, &e, &t, &s, true);
|
dmd.typesem.resolve(exp.type, exp.loc, sc, e, t, s, true);
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
// `(Type)` is actually `(var)` so if `(var)` is a member requiring `this`
|
// `(Type)` is actually `(var)` so if `(var)` is a member requiring `this`
|
||||||
|
@ -5275,7 +5275,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
|
|
||||||
if (ta)
|
if (ta)
|
||||||
{
|
{
|
||||||
dmd.typesem.resolve(ta, exp.loc, sc, &ea, &ta, &sa, true);
|
dmd.typesem.resolve(ta, exp.loc, sc, ea, ta, sa, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ea)
|
if (ea)
|
||||||
|
|
|
@ -5390,7 +5390,7 @@ extern (C++) final class TypeTraits : Type
|
||||||
Type t;
|
Type t;
|
||||||
Expression e;
|
Expression e;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
resolve(this, loc, sc, &e, &t, &s);
|
resolve(this, loc, sc, e, t, s);
|
||||||
if (t && t.ty != Terror)
|
if (t && t.ty != Terror)
|
||||||
s = t.toDsymbol(sc);
|
s = t.toDsymbol(sc);
|
||||||
else if (e)
|
else if (e)
|
||||||
|
@ -5442,7 +5442,7 @@ extern (C++) final class TypeMixin : Type
|
||||||
Type t;
|
Type t;
|
||||||
Expression e;
|
Expression e;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
resolve(this, loc, sc, &e, &t, &s);
|
resolve(this, loc, sc, e, t, s);
|
||||||
if (t)
|
if (t)
|
||||||
s = t.toDsymbol(sc);
|
s = t.toDsymbol(sc);
|
||||||
else if (e)
|
else if (e)
|
||||||
|
@ -5578,7 +5578,7 @@ extern (C++) final class TypeIdentifier : TypeQualified
|
||||||
Type t;
|
Type t;
|
||||||
Expression e;
|
Expression e;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
resolve(this, loc, sc, &e, &t, &s);
|
resolve(this, loc, sc, e, t, s);
|
||||||
if (t && t.ty != Tident)
|
if (t && t.ty != Tident)
|
||||||
s = t.toDsymbol(sc);
|
s = t.toDsymbol(sc);
|
||||||
if (e)
|
if (e)
|
||||||
|
@ -5626,7 +5626,7 @@ extern (C++) final class TypeInstance : TypeQualified
|
||||||
Expression e;
|
Expression e;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
//printf("TypeInstance::semantic(%s)\n", toChars());
|
//printf("TypeInstance::semantic(%s)\n", toChars());
|
||||||
resolve(this, loc, sc, &e, &t, &s);
|
resolve(this, loc, sc, e, t, s);
|
||||||
if (t && t.ty != Tinstance)
|
if (t && t.ty != Tinstance)
|
||||||
s = t.toDsymbol(sc);
|
s = t.toDsymbol(sc);
|
||||||
return s;
|
return s;
|
||||||
|
@ -5671,7 +5671,7 @@ extern (C++) final class TypeTypeof : TypeQualified
|
||||||
Expression e;
|
Expression e;
|
||||||
Type t;
|
Type t;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
resolve(this, loc, sc, &e, &t, &s);
|
resolve(this, loc, sc, e, t, s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5716,7 +5716,7 @@ extern (C++) final class TypeReturn : TypeQualified
|
||||||
Expression e;
|
Expression e;
|
||||||
Type t;
|
Type t;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
resolve(this, loc, sc, &e, &t, &s);
|
resolve(this, loc, sc, e, t, s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1729,7 +1729,7 @@ Expression semanticTraits(TraitsExp e, Scope* sc)
|
||||||
if (!ex && t)
|
if (!ex && t)
|
||||||
{
|
{
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
t.resolve(e.loc, sc2, &ex, &t, &s);
|
t.resolve(e.loc, sc2, ex, t, s);
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
t.typeSemantic(e.loc, sc2);
|
t.typeSemantic(e.loc, sc2);
|
||||||
|
|
|
@ -135,7 +135,7 @@ private void resolveTupleIndex(const ref Loc loc, Scope* sc, Dsymbol s, out Expr
|
||||||
|
|
||||||
// Convert oindex to Expression, then try to resolve to constant.
|
// Convert oindex to Expression, then try to resolve to constant.
|
||||||
if (tindex)
|
if (tindex)
|
||||||
tindex.resolve(loc, sc, &eindex, &tindex, &sindex);
|
tindex.resolve(loc, sc, eindex, tindex, sindex);
|
||||||
if (sindex)
|
if (sindex)
|
||||||
eindex = symbolToExp(sindex, loc, sc, false);
|
eindex = symbolToExp(sindex, loc, sc, false);
|
||||||
if (!eindex)
|
if (!eindex)
|
||||||
|
@ -702,7 +702,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
Type t;
|
Type t;
|
||||||
Expression e;
|
Expression e;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
mtype.next.resolve(loc, sc, &e, &t, &s);
|
mtype.next.resolve(loc, sc, e, t, s);
|
||||||
|
|
||||||
if (auto tup = s ? s.isTupleDeclaration() : null)
|
if (auto tup = s ? s.isTupleDeclaration() : null)
|
||||||
{
|
{
|
||||||
|
@ -895,7 +895,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
Expression e;
|
Expression e;
|
||||||
Type t;
|
Type t;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
mtype.index.resolve(loc, sc, &e, &t, &s);
|
mtype.index.resolve(loc, sc, e, t, s);
|
||||||
|
|
||||||
//https://issues.dlang.org/show_bug.cgi?id=15478
|
//https://issues.dlang.org/show_bug.cgi?id=15478
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -1646,7 +1646,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
Expression e;
|
Expression e;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
//printf("TypeIdentifier::semantic(%s)\n", mtype.toChars());
|
//printf("TypeIdentifier::semantic(%s)\n", mtype.toChars());
|
||||||
mtype.resolve(loc, sc, &e, &t, &s);
|
mtype.resolve(loc, sc, e, t, s);
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
//printf("\tit's a type %d, %s, %s\n", t.ty, t.toChars(), t.deco);
|
//printf("\tit's a type %d, %s, %s\n", t.ty, t.toChars(), t.deco);
|
||||||
|
@ -1701,7 +1701,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
//printf("TypeInstance::semantic(%p, %s)\n", this, toChars());
|
//printf("TypeInstance::semantic(%p, %s)\n", this, toChars());
|
||||||
{
|
{
|
||||||
const errors = global.errors;
|
const errors = global.errors;
|
||||||
mtype.resolve(loc, sc, &e, &t, &s);
|
mtype.resolve(loc, sc, e, t, s);
|
||||||
// if we had an error evaluating the symbol, suppress further errors
|
// if we had an error evaluating the symbol, suppress further errors
|
||||||
if (!t && errors != global.errors)
|
if (!t && errors != global.errors)
|
||||||
return error();
|
return error();
|
||||||
|
@ -1728,7 +1728,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
Expression e;
|
Expression e;
|
||||||
Type t;
|
Type t;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
mtype.resolve(loc, sc, &e, &t, &s);
|
mtype.resolve(loc, sc, e, t, s);
|
||||||
if (s && (t = s.getType()) !is null)
|
if (s && (t = s.getType()) !is null)
|
||||||
t = t.addMod(mtype.mod);
|
t = t.addMod(mtype.mod);
|
||||||
if (!t)
|
if (!t)
|
||||||
|
@ -1852,7 +1852,7 @@ extern(C++) Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
Expression e;
|
Expression e;
|
||||||
Type t;
|
Type t;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
mtype.resolve(loc, sc, &e, &t, &s);
|
mtype.resolve(loc, sc, e, t, s);
|
||||||
if (s && (t = s.getType()) !is null)
|
if (s && (t = s.getType()) !is null)
|
||||||
t = t.addMod(mtype.mod);
|
t = t.addMod(mtype.mod);
|
||||||
if (!t)
|
if (!t)
|
||||||
|
@ -2584,27 +2584,27 @@ private void resolveExp(Expression exp, out Type t, out Expression e, out Dsymbo
|
||||||
* ps = is set if t is a symbol
|
* ps = is set if t is a symbol
|
||||||
* intypeid = true if in type id
|
* intypeid = true if in type id
|
||||||
*/
|
*/
|
||||||
void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Dsymbol* ps, bool intypeid = false)
|
void resolve(Type mt, const ref Loc loc, Scope* sc, out Expression pe, out Type pt, out Dsymbol ps, bool intypeid = false)
|
||||||
{
|
{
|
||||||
void returnExp(Expression e)
|
void returnExp(Expression e)
|
||||||
{
|
{
|
||||||
*pt = null;
|
pe = e;
|
||||||
*pe = e;
|
pt = null;
|
||||||
*ps = null;
|
ps = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void returnType(Type t)
|
void returnType(Type t)
|
||||||
{
|
{
|
||||||
*pt = t;
|
pe = null;
|
||||||
*pe = null;
|
pt = t;
|
||||||
*ps = null;
|
ps = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void returnSymbol(Dsymbol s)
|
void returnSymbol(Dsymbol s)
|
||||||
{
|
{
|
||||||
*pt = null;
|
pe = null;
|
||||||
*pe = null;
|
pt = null;
|
||||||
*ps = s;
|
ps = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void returnError()
|
void returnError()
|
||||||
|
@ -2624,17 +2624,17 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
{
|
{
|
||||||
//printf("TypeSArray::resolve() %s\n", mt.toChars());
|
//printf("TypeSArray::resolve() %s\n", mt.toChars());
|
||||||
mt.next.resolve(loc, sc, pe, pt, ps, intypeid);
|
mt.next.resolve(loc, sc, pe, pt, ps, intypeid);
|
||||||
//printf("s = %p, e = %p, t = %p\n", *ps, *pe, *pt);
|
//printf("s = %p, e = %p, t = %p\n", ps, pe, pt);
|
||||||
if (*pe)
|
if (pe)
|
||||||
{
|
{
|
||||||
// It's really an index expression
|
// It's really an index expression
|
||||||
if (Dsymbol s = getDsymbol(*pe))
|
if (Dsymbol s = getDsymbol(pe))
|
||||||
*pe = new DsymbolExp(loc, s);
|
pe = new DsymbolExp(loc, s);
|
||||||
returnExp(new ArrayExp(loc, *pe, mt.dim));
|
returnExp(new ArrayExp(loc, pe, mt.dim));
|
||||||
}
|
}
|
||||||
else if (*ps)
|
else if (ps)
|
||||||
{
|
{
|
||||||
Dsymbol s = *ps;
|
Dsymbol s = ps;
|
||||||
if (auto tup = s.isTupleDeclaration())
|
if (auto tup = s.isTupleDeclaration())
|
||||||
{
|
{
|
||||||
mt.dim = semanticLength(sc, tup, mt.dim);
|
mt.dim = semanticLength(sc, tup, mt.dim);
|
||||||
|
@ -2681,8 +2681,8 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((*pt).ty != Terror)
|
if (pt.ty != Terror)
|
||||||
mt.next = *pt; // prevent re-running semantic() on 'next'
|
mt.next = pt; // prevent re-running semantic() on 'next'
|
||||||
visitType(mt);
|
visitType(mt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2692,27 +2692,27 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
{
|
{
|
||||||
//printf("TypeDArray::resolve() %s\n", mt.toChars());
|
//printf("TypeDArray::resolve() %s\n", mt.toChars());
|
||||||
mt.next.resolve(loc, sc, pe, pt, ps, intypeid);
|
mt.next.resolve(loc, sc, pe, pt, ps, intypeid);
|
||||||
//printf("s = %p, e = %p, t = %p\n", *ps, *pe, *pt);
|
//printf("s = %p, e = %p, t = %p\n", ps, pe, pt);
|
||||||
if (*pe)
|
if (pe)
|
||||||
{
|
{
|
||||||
// It's really a slice expression
|
// It's really a slice expression
|
||||||
if (Dsymbol s = getDsymbol(*pe))
|
if (Dsymbol s = getDsymbol(pe))
|
||||||
*pe = new DsymbolExp(loc, s);
|
pe = new DsymbolExp(loc, s);
|
||||||
returnExp(new ArrayExp(loc, *pe));
|
returnExp(new ArrayExp(loc, pe));
|
||||||
}
|
}
|
||||||
else if (*ps)
|
else if (ps)
|
||||||
{
|
{
|
||||||
if (auto tup = (*ps).isTupleDeclaration())
|
if (auto tup = ps.isTupleDeclaration())
|
||||||
{
|
{
|
||||||
// keep *ps
|
// keep ps
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
visitType(mt);
|
visitType(mt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((*pt).ty != Terror)
|
if (pt.ty != Terror)
|
||||||
mt.next = *pt; // prevent re-running semantic() on 'next'
|
mt.next = pt; // prevent re-running semantic() on 'next'
|
||||||
visitType(mt);
|
visitType(mt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2727,7 +2727,7 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
Expression e;
|
Expression e;
|
||||||
Type t;
|
Type t;
|
||||||
Dsymbol s;
|
Dsymbol s;
|
||||||
mt.index.resolve(loc, sc, &e, &t, &s, intypeid);
|
mt.index.resolve(loc, sc, e, t, s, intypeid);
|
||||||
if (e)
|
if (e)
|
||||||
{
|
{
|
||||||
// It was an expression -
|
// It was an expression -
|
||||||
|
@ -2748,8 +2748,8 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
* Takes an array of Identifiers and figures out if
|
* Takes an array of Identifiers and figures out if
|
||||||
* it represents a Type or an Expression.
|
* it represents a Type or an Expression.
|
||||||
* Output:
|
* Output:
|
||||||
* if expression, *pe is set
|
* if expression, pe is set
|
||||||
* if type, *pt is set
|
* if type, pt is set
|
||||||
*/
|
*/
|
||||||
void visitIdentifier(TypeIdentifier mt)
|
void visitIdentifier(TypeIdentifier mt)
|
||||||
{
|
{
|
||||||
|
@ -2839,9 +2839,9 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mt.resolveHelper(loc, sc, s, scopesym, *pe, *pt, *ps, intypeid);
|
mt.resolveHelper(loc, sc, s, scopesym, pe, pt, ps, intypeid);
|
||||||
if (*pt)
|
if (pt)
|
||||||
(*pt) = (*pt).addMod(mt.mod);
|
pt = pt.addMod(mt.mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
void visitInstance(TypeInstance mt)
|
void visitInstance(TypeInstance mt)
|
||||||
|
@ -2853,10 +2853,10 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
if (!global.gag && mt.tempinst.errors)
|
if (!global.gag && mt.tempinst.errors)
|
||||||
return returnError();
|
return returnError();
|
||||||
|
|
||||||
mt.resolveHelper(loc, sc, mt.tempinst, null, *pe, *pt, *ps, intypeid);
|
mt.resolveHelper(loc, sc, mt.tempinst, null, pe, pt, ps, intypeid);
|
||||||
if (*pt)
|
if (pt)
|
||||||
*pt = (*pt).addMod(mt.mod);
|
pt = pt.addMod(mt.mod);
|
||||||
//if (*pt) printf("*pt = %d '%s'\n", (*pt).ty, (*pt).toChars());
|
//if (pt) printf("pt = %d '%s'\n", pt.ty, pt.toChars());
|
||||||
}
|
}
|
||||||
|
|
||||||
void visitTypeof(TypeTypeof mt)
|
void visitTypeof(TypeTypeof mt)
|
||||||
|
@ -2956,15 +2956,15 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Dsymbol s = t.toDsymbol(sc))
|
if (Dsymbol s = t.toDsymbol(sc))
|
||||||
mt.resolveHelper(loc, sc, s, null, *pe, *pt, *ps, intypeid);
|
mt.resolveHelper(loc, sc, s, null, pe, pt, ps, intypeid);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto e = typeToExpressionHelper(mt, new TypeExp(loc, t));
|
auto e = typeToExpressionHelper(mt, new TypeExp(loc, t));
|
||||||
e = e.expressionSemantic(sc);
|
e = e.expressionSemantic(sc);
|
||||||
resolveExp(e, *pt, *pe, *ps);
|
resolveExp(e, pt, pe, ps);
|
||||||
}
|
}
|
||||||
if (*pt)
|
if (pt)
|
||||||
(*pt) = (*pt).addMod(mt.mod);
|
pt = pt.addMod(mt.mod);
|
||||||
}
|
}
|
||||||
mt.inuse--;
|
mt.inuse--;
|
||||||
}
|
}
|
||||||
|
@ -2996,31 +2996,31 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Dsymbol s = t.toDsymbol(sc))
|
if (Dsymbol s = t.toDsymbol(sc))
|
||||||
mt.resolveHelper(loc, sc, s, null, *pe, *pt, *ps, intypeid);
|
mt.resolveHelper(loc, sc, s, null, pe, pt, ps, intypeid);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto e = typeToExpressionHelper(mt, new TypeExp(loc, t));
|
auto e = typeToExpressionHelper(mt, new TypeExp(loc, t));
|
||||||
e = e.expressionSemantic(sc);
|
e = e.expressionSemantic(sc);
|
||||||
resolveExp(e, *pt, *pe, *ps);
|
resolveExp(e, pt, pe, ps);
|
||||||
}
|
}
|
||||||
if (*pt)
|
if (pt)
|
||||||
(*pt) = (*pt).addMod(mt.mod);
|
pt = pt.addMod(mt.mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void visitSlice(TypeSlice mt)
|
void visitSlice(TypeSlice mt)
|
||||||
{
|
{
|
||||||
mt.next.resolve(loc, sc, pe, pt, ps, intypeid);
|
mt.next.resolve(loc, sc, pe, pt, ps, intypeid);
|
||||||
if (*pe)
|
if (pe)
|
||||||
{
|
{
|
||||||
// It's really a slice expression
|
// It's really a slice expression
|
||||||
if (Dsymbol s = getDsymbol(*pe))
|
if (Dsymbol s = getDsymbol(pe))
|
||||||
*pe = new DsymbolExp(loc, s);
|
pe = new DsymbolExp(loc, s);
|
||||||
return returnExp(new ArrayExp(loc, *pe, new IntervalExp(loc, mt.lwr, mt.upr)));
|
return returnExp(new ArrayExp(loc, pe, new IntervalExp(loc, mt.lwr, mt.upr)));
|
||||||
}
|
}
|
||||||
else if (*ps)
|
else if (ps)
|
||||||
{
|
{
|
||||||
Dsymbol s = *ps;
|
Dsymbol s = ps;
|
||||||
TupleDeclaration td = s.isTupleDeclaration();
|
TupleDeclaration td = s.isTupleDeclaration();
|
||||||
if (td)
|
if (td)
|
||||||
{
|
{
|
||||||
|
@ -3066,8 +3066,8 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((*pt).ty != Terror)
|
if (pt.ty != Terror)
|
||||||
mt.next = *pt; // prevent re-running semantic() on 'next'
|
mt.next = pt; // prevent re-running semantic() on 'next'
|
||||||
visitType(mt);
|
visitType(mt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3079,8 +3079,8 @@ void resolve(Type mt, const ref Loc loc, Scope* sc, Expression* pe, Type* pt, Ds
|
||||||
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)
|
if (pt)
|
||||||
(*pt) = (*pt).addMod(mt.mod);
|
pt = pt.addMod(mt.mod);
|
||||||
}
|
}
|
||||||
else if (auto e = o.isExpression())
|
else if (auto e = o.isExpression())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue