mirror of
https://github.com/dlang/dmd.git
synced 2025-04-28 06:00:13 +03:00
Rename Id.index to Id.opIndex etc. (#20771)
This commit is contained in:
parent
3166ce1646
commit
e5bd2d06aa
12 changed files with 75 additions and 75 deletions
|
@ -101,7 +101,7 @@ StorageClass mergeFuncAttrs(StorageClass s1, const FuncDeclaration f) pure @safe
|
||||||
*/
|
*/
|
||||||
FuncDeclaration hasIdentityOpAssign(AggregateDeclaration ad, Scope* sc)
|
FuncDeclaration hasIdentityOpAssign(AggregateDeclaration ad, Scope* sc)
|
||||||
{
|
{
|
||||||
Dsymbol assign = search_function(ad, Id.assign);
|
Dsymbol assign = search_function(ad, Id.opAssign);
|
||||||
if (!assign)
|
if (!assign)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ FuncDeclaration buildOpAssign(StructDeclaration sd, Scope* sc)
|
||||||
auto fparams = new Parameters();
|
auto fparams = new Parameters();
|
||||||
fparams.push(new Parameter(loc, STC.nodtor, sd.type, Id.p, null, null));
|
fparams.push(new Parameter(loc, STC.nodtor, sd.type, Id.p, null, null));
|
||||||
auto tf = new TypeFunction(ParameterList(fparams), sd.handleType(), LINK.d, stc | STC.ref_);
|
auto tf = new TypeFunction(ParameterList(fparams), sd.handleType(), LINK.d, stc | STC.ref_);
|
||||||
auto fop = new FuncDeclaration(declLoc, Loc.initial, Id.assign, stc, tf);
|
auto fop = new FuncDeclaration(declLoc, Loc.initial, Id.opAssign, stc, tf);
|
||||||
fop.storage_class |= STC.inference;
|
fop.storage_class |= STC.inference;
|
||||||
fop.isGenerated = true;
|
fop.isGenerated = true;
|
||||||
Expression e;
|
Expression e;
|
||||||
|
@ -482,7 +482,7 @@ bool needOpEquals(StructDeclaration sd)
|
||||||
private FuncDeclaration hasIdentityOpEquals(AggregateDeclaration ad, Scope* sc)
|
private FuncDeclaration hasIdentityOpEquals(AggregateDeclaration ad, Scope* sc)
|
||||||
{
|
{
|
||||||
FuncDeclaration f;
|
FuncDeclaration f;
|
||||||
Dsymbol eq = search_function(ad, Id.eq);
|
Dsymbol eq = search_function(ad, Id.opEquals);
|
||||||
if (!eq)
|
if (!eq)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ FuncDeclaration buildXopEquals(StructDeclaration sd, Scope* sc)
|
||||||
return null; // bitwise comparison would work
|
return null; // bitwise comparison would work
|
||||||
|
|
||||||
//printf("StructDeclaration::buildXopEquals() %s\n", sd.toChars());
|
//printf("StructDeclaration::buildXopEquals() %s\n", sd.toChars());
|
||||||
if (Dsymbol eq = search_function(sd, Id.eq))
|
if (Dsymbol eq = search_function(sd, Id.opEquals))
|
||||||
{
|
{
|
||||||
if (FuncDeclaration fd = eq.isFuncDeclaration())
|
if (FuncDeclaration fd = eq.isFuncDeclaration())
|
||||||
{
|
{
|
||||||
|
@ -639,7 +639,7 @@ FuncDeclaration buildXopEquals(StructDeclaration sd, Scope* sc)
|
||||||
FuncDeclaration buildXopCmp(StructDeclaration sd, Scope* sc)
|
FuncDeclaration buildXopCmp(StructDeclaration sd, Scope* sc)
|
||||||
{
|
{
|
||||||
//printf("StructDeclaration::buildXopCmp() %s\n", toChars());
|
//printf("StructDeclaration::buildXopCmp() %s\n", toChars());
|
||||||
if (Dsymbol cmp = search_function(sd, Id.cmp))
|
if (Dsymbol cmp = search_function(sd, Id.opCmp))
|
||||||
{
|
{
|
||||||
if (FuncDeclaration fd = cmp.isFuncDeclaration())
|
if (FuncDeclaration fd = cmp.isFuncDeclaration())
|
||||||
{
|
{
|
||||||
|
@ -667,7 +667,7 @@ FuncDeclaration buildXopCmp(StructDeclaration sd, Scope* sc)
|
||||||
* Consider 'alias this', but except opDispatch.
|
* Consider 'alias this', but except opDispatch.
|
||||||
*/
|
*/
|
||||||
Expression e = new DsymbolExp(sd.loc, sd);
|
Expression e = new DsymbolExp(sd.loc, sd);
|
||||||
e = new DotIdExp(sd.loc, e, Id.cmp);
|
e = new DotIdExp(sd.loc, e, Id.opCmp);
|
||||||
Scope* sc2 = sc.push();
|
Scope* sc2 = sc.push();
|
||||||
e = e.trySemantic(sc2);
|
e = e.trySemantic(sc2);
|
||||||
sc2.pop();
|
sc2.pop();
|
||||||
|
@ -688,7 +688,7 @@ FuncDeclaration buildXopCmp(StructDeclaration sd, Scope* sc)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!s || s.ident != Id.cmp)
|
if (!s || s.ident != Id.opCmp)
|
||||||
e = null; // there's no valid member 'opCmp'
|
e = null; // there's no valid member 'opCmp'
|
||||||
}
|
}
|
||||||
if (!e)
|
if (!e)
|
||||||
|
@ -736,7 +736,7 @@ FuncDeclaration buildXopCmp(StructDeclaration sd, Scope* sc)
|
||||||
fop.parent = sd;
|
fop.parent = sd;
|
||||||
Expression e1 = new IdentifierExp(loc, Id.This);
|
Expression e1 = new IdentifierExp(loc, Id.This);
|
||||||
Expression e2 = new IdentifierExp(loc, Id.p);
|
Expression e2 = new IdentifierExp(loc, Id.p);
|
||||||
Expression e = new CallExp(loc, new DotIdExp(loc, e1, Id.cmp), e2);
|
Expression e = new CallExp(loc, new DotIdExp(loc, e1, Id.opCmp), e2);
|
||||||
fop.fbody = new ReturnStatement(loc, e);
|
fop.fbody = new ReturnStatement(loc, e);
|
||||||
const errors = global.startGagging(); // Do not report errors
|
const errors = global.startGagging(); // Do not report errors
|
||||||
Scope* sc2 = sc.push();
|
Scope* sc2 = sc.push();
|
||||||
|
|
|
@ -3061,7 +3061,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
|
||||||
|
|
||||||
if (sd.ctor)
|
if (sd.ctor)
|
||||||
{
|
{
|
||||||
Dsymbol scall = sd.search(Loc.initial, Id.call);
|
Dsymbol scall = sd.search(Loc.initial, Id.opCall);
|
||||||
if (scall)
|
if (scall)
|
||||||
{
|
{
|
||||||
const xerrors = global.startGagging();
|
const xerrors = global.startGagging();
|
||||||
|
|
|
@ -663,7 +663,7 @@ Expression resolveOpDollar(Scope* sc, ArrayExp ae, Expression* pe0)
|
||||||
assert(!ae.lengthVar);
|
assert(!ae.lengthVar);
|
||||||
*pe0 = null;
|
*pe0 = null;
|
||||||
AggregateDeclaration ad = isAggregate(ae.e1.type);
|
AggregateDeclaration ad = isAggregate(ae.e1.type);
|
||||||
Dsymbol slice = search_function(ad, Id.slice);
|
Dsymbol slice = search_function(ad, Id.opSlice);
|
||||||
//printf("slice = %s %s\n", slice.kind(), slice.toChars());
|
//printf("slice = %s %s\n", slice.kind(), slice.toChars());
|
||||||
Expression fallback()
|
Expression fallback()
|
||||||
{
|
{
|
||||||
|
@ -6206,7 +6206,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// No constructor, look for overload of opCall
|
// No constructor, look for overload of opCall
|
||||||
if (search_function(sd, Id.call))
|
if (search_function(sd, Id.opCall))
|
||||||
goto L1;
|
goto L1;
|
||||||
// overload of opCall, therefore it's a call
|
// overload of opCall, therefore it's a call
|
||||||
if (exp.e1.op != EXP.type)
|
if (exp.e1.op != EXP.type)
|
||||||
|
@ -6247,7 +6247,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
{
|
{
|
||||||
L1:
|
L1:
|
||||||
// Rewrite as e1.call(arguments)
|
// Rewrite as e1.call(arguments)
|
||||||
Expression e = new DotIdExp(exp.loc, exp.e1, Id.call);
|
Expression e = new DotIdExp(exp.loc, exp.e1, Id.opCall);
|
||||||
e = new CallExp(exp.loc, e, exp.arguments, exp.names);
|
e = new CallExp(exp.loc, e, exp.arguments, exp.names);
|
||||||
e = e.expressionSemantic(sc);
|
e = e.expressionSemantic(sc);
|
||||||
result = e;
|
result = e;
|
||||||
|
@ -7933,7 +7933,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
{
|
{
|
||||||
const callExpIdent = callExpFunc.ident;
|
const callExpIdent = callExpFunc.ident;
|
||||||
isEqualsCallExpression = callExpIdent == Id.__equals ||
|
isEqualsCallExpression = callExpIdent == Id.__equals ||
|
||||||
callExpIdent == Id.eq;
|
callExpIdent == Id.opEquals;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (op == EXP.equal || op == EXP.notEqual ||
|
if (op == EXP.equal || op == EXP.notEqual ||
|
||||||
|
@ -9451,8 +9451,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
error(exp.loc, "upper and lower bounds are needed to slice a pointer");
|
error(exp.loc, "upper and lower bounds are needed to slice a pointer");
|
||||||
if (auto ad = isAggregate(tp.next.toBasetype()))
|
if (auto ad = isAggregate(tp.next.toBasetype()))
|
||||||
{
|
{
|
||||||
auto s = search_function(ad, Id.index);
|
auto s = search_function(ad, Id.opIndex);
|
||||||
if (!s) s = search_function(ad, Id.slice);
|
if (!s) s = search_function(ad, Id.opSlice);
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
auto fd = s.isFuncDeclaration();
|
auto fd = s.isFuncDeclaration();
|
||||||
|
@ -10305,7 +10305,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
AggregateDeclaration ad = isAggregate(t1b);
|
AggregateDeclaration ad = isAggregate(t1b);
|
||||||
if (!ad)
|
if (!ad)
|
||||||
break;
|
break;
|
||||||
if (search_function(ad, Id.indexass))
|
if (search_function(ad, Id.opIndexAssign))
|
||||||
{
|
{
|
||||||
// Deal with $
|
// Deal with $
|
||||||
res = resolveOpDollar(sc, ae, &e0);
|
res = resolveOpDollar(sc, ae, &e0);
|
||||||
|
@ -10324,7 +10324,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
*/
|
*/
|
||||||
Expressions* a = ae.arguments.copy();
|
Expressions* a = ae.arguments.copy();
|
||||||
a.insert(0, exp.e2);
|
a.insert(0, exp.e2);
|
||||||
res = new DotIdExp(exp.loc, ae.e1, Id.indexass);
|
res = new DotIdExp(exp.loc, ae.e1, Id.opIndexAssign);
|
||||||
res = new CallExp(exp.loc, res, a);
|
res = new CallExp(exp.loc, res, a);
|
||||||
if (maybeSlice) // a[] = e2 might be: a.opSliceAssign(e2)
|
if (maybeSlice) // a[] = e2 might be: a.opSliceAssign(e2)
|
||||||
res = res.trySemantic(sc);
|
res = res.trySemantic(sc);
|
||||||
|
@ -10335,7 +10335,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
}
|
}
|
||||||
|
|
||||||
Lfallback:
|
Lfallback:
|
||||||
if (maybeSlice && search_function(ad, Id.sliceass))
|
if (maybeSlice && search_function(ad, Id.opSliceAssign))
|
||||||
{
|
{
|
||||||
// Deal with $
|
// Deal with $
|
||||||
res = resolveOpDollar(sc, ae, ie, &e0);
|
res = resolveOpDollar(sc, ae, ie, &e0);
|
||||||
|
@ -10358,7 +10358,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
a.push(ie.lwr);
|
a.push(ie.lwr);
|
||||||
a.push(ie.upr);
|
a.push(ie.upr);
|
||||||
}
|
}
|
||||||
res = new DotIdExp(exp.loc, ae.e1, Id.sliceass);
|
res = new DotIdExp(exp.loc, ae.e1, Id.opSliceAssign);
|
||||||
res = new CallExp(exp.loc, res, a);
|
res = new CallExp(exp.loc, res, a);
|
||||||
res = res.expressionSemantic(sc);
|
res = res.expressionSemantic(sc);
|
||||||
return setResult(Expression.combine(e0, res));
|
return setResult(Expression.combine(e0, res));
|
||||||
|
@ -10893,14 +10893,14 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
result = e;
|
result = e;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (search_function(sd, Id.call))
|
if (search_function(sd, Id.opCall))
|
||||||
{
|
{
|
||||||
/* Look for static opCall
|
/* Look for static opCall
|
||||||
* https://issues.dlang.org/show_bug.cgi?id=2702
|
* https://issues.dlang.org/show_bug.cgi?id=2702
|
||||||
* Rewrite as:
|
* Rewrite as:
|
||||||
* e1 = typeof(e1).opCall(arguments)
|
* e1 = typeof(e1).opCall(arguments)
|
||||||
*/
|
*/
|
||||||
e2x = typeDotIdExp(e2x.loc, e1x.type, Id.call);
|
e2x = typeDotIdExp(e2x.loc, e1x.type, Id.opCall);
|
||||||
e2x = new CallExp(exp.loc, e2x, exp.e2);
|
e2x = new CallExp(exp.loc, e2x, exp.e2);
|
||||||
|
|
||||||
e2x = e2x.expressionSemantic(sc);
|
e2x = e2x.expressionSemantic(sc);
|
||||||
|
@ -11410,7 +11410,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
if (e2x.op == EXP.error && exp.op == EXP.construct && t1.ty == Tstruct)
|
if (e2x.op == EXP.error && exp.op == EXP.construct && t1.ty == Tstruct)
|
||||||
{
|
{
|
||||||
scope sd = (cast(TypeStruct)t1).sym;
|
scope sd = (cast(TypeStruct)t1).sym;
|
||||||
Dsymbol opAssign = search_function(sd, Id.assign);
|
Dsymbol opAssign = search_function(sd, Id.opAssign);
|
||||||
|
|
||||||
// and the struct defines an opAssign
|
// and the struct defines an opAssign
|
||||||
if (opAssign)
|
if (opAssign)
|
||||||
|
@ -16359,7 +16359,7 @@ Expression toBoolean(Expression exp, Scope* sc)
|
||||||
/* Don't really need to check for opCast first, but by doing so we
|
/* Don't really need to check for opCast first, but by doing so we
|
||||||
* get better error messages if it isn't there.
|
* get better error messages if it isn't there.
|
||||||
*/
|
*/
|
||||||
if (Dsymbol fd = search_function(ad, Id._cast))
|
if (Dsymbol fd = search_function(ad, Id.opCast))
|
||||||
{
|
{
|
||||||
e = new CastExp(exp.loc, e, Type.tbool);
|
e = new CastExp(exp.loc, e, Type.tbool);
|
||||||
e = e.expressionSemantic(sc);
|
e = e.expressionSemantic(sc);
|
||||||
|
|
|
@ -8819,15 +8819,15 @@ struct Id final
|
||||||
static Identifier* system;
|
static Identifier* system;
|
||||||
static Identifier* disable;
|
static Identifier* disable;
|
||||||
static Identifier* _dollar;
|
static Identifier* _dollar;
|
||||||
static Identifier* eq;
|
static Identifier* opEquals;
|
||||||
static Identifier* cmp;
|
static Identifier* opCmp;
|
||||||
static Identifier* assign;
|
static Identifier* opAssign;
|
||||||
static Identifier* index;
|
static Identifier* opIndex;
|
||||||
static Identifier* indexass;
|
static Identifier* opIndexAssign;
|
||||||
static Identifier* slice;
|
static Identifier* opSlice;
|
||||||
static Identifier* sliceass;
|
static Identifier* opSliceAssign;
|
||||||
static Identifier* call;
|
static Identifier* opCall;
|
||||||
static Identifier* _cast;
|
static Identifier* opCast;
|
||||||
static Identifier* opDot;
|
static Identifier* opDot;
|
||||||
static Identifier* opDispatch;
|
static Identifier* opDispatch;
|
||||||
static Identifier* opDollar;
|
static Identifier* opDollar;
|
||||||
|
|
|
@ -223,15 +223,15 @@ immutable Msgtable[] msgtable =
|
||||||
{ "__LOCAL_SIZE" },
|
{ "__LOCAL_SIZE" },
|
||||||
|
|
||||||
// For operator overloads
|
// For operator overloads
|
||||||
{ "eq", "opEquals" },
|
{ "opEquals" },
|
||||||
{ "cmp", "opCmp" },
|
{ "opCmp" },
|
||||||
{ "assign", "opAssign" },
|
{ "opAssign" },
|
||||||
{ "index", "opIndex" },
|
{ "opIndex" },
|
||||||
{ "indexass", "opIndexAssign" },
|
{ "opIndexAssign" },
|
||||||
{ "slice", "opSlice" },
|
{ "opSlice" },
|
||||||
{ "sliceass", "opSliceAssign" },
|
{ "opSliceAssign" },
|
||||||
{ "call", "opCall" },
|
{ "opCall" },
|
||||||
{ "_cast", "opCast" },
|
{ "opCast" },
|
||||||
{ "opDot" },
|
{ "opDot" },
|
||||||
{ "opDispatch" },
|
{ "opDispatch" },
|
||||||
{ "opDollar" },
|
{ "opDollar" },
|
||||||
|
|
|
@ -489,7 +489,7 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn
|
||||||
else
|
else
|
||||||
i.exp = e.optimize(WANTvalue);
|
i.exp = e.optimize(WANTvalue);
|
||||||
}
|
}
|
||||||
else if (search_function(sd, Id.call))
|
else if (search_function(sd, Id.opCall))
|
||||||
{
|
{
|
||||||
/* https://issues.dlang.org/show_bug.cgi?id=1547
|
/* https://issues.dlang.org/show_bug.cgi?id=1547
|
||||||
*
|
*
|
||||||
|
@ -499,7 +499,7 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn
|
||||||
* i.exp = typeof(sd).opCall(arguments)
|
* i.exp = typeof(sd).opCall(arguments)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Expression e = typeDotIdExp(i.loc, sd.type, Id.call);
|
Expression e = typeDotIdExp(i.loc, sd.type, Id.opCall);
|
||||||
e = new CallExp(i.loc, e, i.exp);
|
e = new CallExp(i.loc, e, i.exp);
|
||||||
e = e.expressionSemantic(sc);
|
e = e.expressionSemantic(sc);
|
||||||
e = resolveProperties(sc, e);
|
e = resolveProperties(sc, e);
|
||||||
|
|
|
@ -60,11 +60,11 @@ package CppOperator isCppOperator(const scope Identifier id)
|
||||||
{
|
{
|
||||||
with (Id) with (CppOperator)
|
with (Id) with (CppOperator)
|
||||||
{
|
{
|
||||||
return (id == _cast) ? Cast :
|
return (id == opCast) ? Cast :
|
||||||
(id == assign) ? Assign :
|
(id == opAssign) ? Assign :
|
||||||
(id == eq) ? Eq :
|
(id == opEquals) ? Eq :
|
||||||
(id == index) ? Index :
|
(id == opIndex) ? Index :
|
||||||
(id == call) ? Call :
|
(id == opCall) ? Call :
|
||||||
(id == opUnary) ? Unary :
|
(id == opUnary) ? Unary :
|
||||||
(id == opBinary) ? Binary :
|
(id == opBinary) ? Binary :
|
||||||
(id == opOpAssign) ? OpAssign :
|
(id == opOpAssign) ? OpAssign :
|
||||||
|
@ -1102,13 +1102,13 @@ private final class CppMangleVisitor : Visitor
|
||||||
buf.writestring(ctor.isCpCtor ? "C2" : "C1");
|
buf.writestring(ctor.isCpCtor ? "C2" : "C1");
|
||||||
else if (d.isAggregateDtor())
|
else if (d.isAggregateDtor())
|
||||||
buf.writestring("D1");
|
buf.writestring("D1");
|
||||||
else if (d.ident && d.ident == Id.assign)
|
else if (d.ident && d.ident == Id.opAssign)
|
||||||
buf.writestring("aS");
|
buf.writestring("aS");
|
||||||
else if (d.ident && d.ident == Id.eq)
|
else if (d.ident && d.ident == Id.opEquals)
|
||||||
buf.writestring("eq");
|
buf.writestring("eq");
|
||||||
else if (d.ident && d.ident == Id.index)
|
else if (d.ident && d.ident == Id.opIndex)
|
||||||
buf.writestring("ix");
|
buf.writestring("ix");
|
||||||
else if (d.ident && d.ident == Id.call)
|
else if (d.ident && d.ident == Id.opCall)
|
||||||
buf.writestring("cl");
|
buf.writestring("cl");
|
||||||
else
|
else
|
||||||
source_name(d, true);
|
source_name(d, true);
|
||||||
|
|
|
@ -1080,13 +1080,13 @@ string mangleSpecialName(Dsymbol sym)
|
||||||
mangle = "?1";
|
mangle = "?1";
|
||||||
else if (!sym.ident)
|
else if (!sym.ident)
|
||||||
return null;
|
return null;
|
||||||
else if (sym.ident == Id.assign)
|
else if (sym.ident == Id.opAssign)
|
||||||
mangle = "?4";
|
mangle = "?4";
|
||||||
else if (sym.ident == Id.eq)
|
else if (sym.ident == Id.opEquals)
|
||||||
mangle = "?8";
|
mangle = "?8";
|
||||||
else if (sym.ident == Id.index)
|
else if (sym.ident == Id.opIndex)
|
||||||
mangle = "?A";
|
mangle = "?A";
|
||||||
else if (sym.ident == Id.call)
|
else if (sym.ident == Id.opCall)
|
||||||
mangle = "?R";
|
mangle = "?R";
|
||||||
else if (sym.ident == Id.cppdtor)
|
else if (sym.ident == Id.cppdtor)
|
||||||
mangle = "?_G";
|
mangle = "?_G";
|
||||||
|
|
|
@ -111,10 +111,10 @@ private bool isAssignmentOpId(Identifier id)
|
||||||
{
|
{
|
||||||
import dmd.id : Id;
|
import dmd.id : Id;
|
||||||
|
|
||||||
return id == Id.assign
|
return id == Id.opAssign
|
||||||
|| id == Id.indexass
|
|| id == Id.opIndexAssign
|
||||||
|| id == Id.slice
|
|| id == Id.opSlice
|
||||||
|| id == Id.sliceass
|
|| id == Id.opSliceAssign
|
||||||
|| id == Id.opOpAssign
|
|| id == Id.opOpAssign
|
||||||
|| id == Id.opIndexOpAssign
|
|| id == Id.opIndexOpAssign
|
||||||
|| id == Id.opSliceOpAssign;
|
|| id == Id.opSliceOpAssign;
|
||||||
|
|
|
@ -355,7 +355,7 @@ Expression opOverloadArray(ArrayExp ae, Scope* sc)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (search_function(ad, Id.index))
|
if (search_function(ad, Id.opIndex))
|
||||||
{
|
{
|
||||||
// Deal with $
|
// Deal with $
|
||||||
result = resolveOpDollar(sc, ae, &e0);
|
result = resolveOpDollar(sc, ae, &e0);
|
||||||
|
@ -367,7 +367,7 @@ Expression opOverloadArray(ArrayExp ae, Scope* sc)
|
||||||
* e1.opIndex(arguments)
|
* e1.opIndex(arguments)
|
||||||
*/
|
*/
|
||||||
Expressions* a = ae.arguments.copy();
|
Expressions* a = ae.arguments.copy();
|
||||||
result = new DotIdExp(ae.loc, ae.e1, Id.index);
|
result = new DotIdExp(ae.loc, ae.e1, Id.opIndex);
|
||||||
result = new CallExp(ae.loc, result, a);
|
result = new CallExp(ae.loc, result, a);
|
||||||
if (maybeSlice) // a[] might be: a.opSlice()
|
if (maybeSlice) // a[] might be: a.opSlice()
|
||||||
result = result.trySemantic(sc);
|
result = result.trySemantic(sc);
|
||||||
|
@ -386,7 +386,7 @@ Expression opOverloadArray(ArrayExp ae, Scope* sc)
|
||||||
result = Expression.combine(e0, result);
|
result = Expression.combine(e0, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (maybeSlice && search_function(ad, Id.slice))
|
if (maybeSlice && search_function(ad, Id.opSlice))
|
||||||
{
|
{
|
||||||
// Deal with $
|
// Deal with $
|
||||||
result = resolveOpDollar(sc, ae, ie, &e0);
|
result = resolveOpDollar(sc, ae, ie, &e0);
|
||||||
|
@ -407,7 +407,7 @@ Expression opOverloadArray(ArrayExp ae, Scope* sc)
|
||||||
a.push(ie.lwr);
|
a.push(ie.lwr);
|
||||||
a.push(ie.upr);
|
a.push(ie.upr);
|
||||||
}
|
}
|
||||||
result = new DotIdExp(ae.loc, ae.e1, Id.slice);
|
result = new DotIdExp(ae.loc, ae.e1, Id.opSlice);
|
||||||
result = new CallExp(ae.loc, result, a);
|
result = new CallExp(ae.loc, result, a);
|
||||||
result = result.expressionSemantic(sc);
|
result = result.expressionSemantic(sc);
|
||||||
result = Expression.combine(e0, result);
|
result = Expression.combine(e0, result);
|
||||||
|
@ -444,7 +444,7 @@ Expression opOverloadCast(CastExp e, Scope* sc, Type att = null)
|
||||||
/* Rewrite as:
|
/* Rewrite as:
|
||||||
* e1.opCast!(T)()
|
* e1.opCast!(T)()
|
||||||
*/
|
*/
|
||||||
fd = search_function(ad, Id._cast);
|
fd = search_function(ad, Id.opCast);
|
||||||
if (fd)
|
if (fd)
|
||||||
{
|
{
|
||||||
version (all)
|
version (all)
|
||||||
|
@ -554,7 +554,7 @@ Expression opOverloadAssign(AssignExp e, Scope* sc)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dsymbol s = search_function(ad1, Id.assign);
|
Dsymbol s = search_function(ad1, Id.opAssign);
|
||||||
|
|
||||||
bool choseReverse;
|
bool choseReverse;
|
||||||
if (auto result = pickBestBinaryOverload(sc, null, s, null, e, choseReverse))
|
if (auto result = pickBestBinaryOverload(sc, null, s, null, e, choseReverse))
|
||||||
|
@ -658,7 +658,7 @@ Expression opOverloadEqual(EqualExp e, Scope* sc)
|
||||||
|
|
||||||
Expression result = new IdentifierExp(e.loc, Id.empty);
|
Expression result = new IdentifierExp(e.loc, Id.empty);
|
||||||
result = new DotIdExp(e.loc, result, Id.object);
|
result = new DotIdExp(e.loc, result, Id.object);
|
||||||
result = new DotIdExp(e.loc, result, Id.eq);
|
result = new DotIdExp(e.loc, result, Id.opEquals);
|
||||||
result = new CallExp(e.loc, result, e1x, e2x);
|
result = new CallExp(e.loc, result, e1x, e2x);
|
||||||
if (e.op == EXP.notEqual)
|
if (e.op == EXP.notEqual)
|
||||||
result = new NotExp(e.loc, result);
|
result = new NotExp(e.loc, result);
|
||||||
|
@ -668,7 +668,7 @@ Expression opOverloadEqual(EqualExp e, Scope* sc)
|
||||||
}
|
}
|
||||||
|
|
||||||
EXP cmpOp;
|
EXP cmpOp;
|
||||||
if (Expression result = compare_overload(e, sc, Id.eq, cmpOp))
|
if (Expression result = compare_overload(e, sc, Id.opEquals, cmpOp))
|
||||||
{
|
{
|
||||||
if (lastComma(result).op == EXP.call && e.op == EXP.notEqual)
|
if (lastComma(result).op == EXP.call && e.op == EXP.notEqual)
|
||||||
{
|
{
|
||||||
|
@ -783,7 +783,7 @@ Expression opOverloadCmp(CmpExp exp, Scope* sc)
|
||||||
{
|
{
|
||||||
//printf("CmpExp:: () (%s)\n", e.toChars());
|
//printf("CmpExp:: () (%s)\n", e.toChars());
|
||||||
EXP cmpOp = exp.op;
|
EXP cmpOp = exp.op;
|
||||||
auto e = compare_overload(exp, sc, Id.cmp, cmpOp);
|
auto e = compare_overload(exp, sc, Id.opCmp, cmpOp);
|
||||||
if (!e)
|
if (!e)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
|
||||||
//{ static int x; if (++x == 2) *(char*)0=0; }
|
//{ static int x; if (++x == 2) *(char*)0=0; }
|
||||||
//printf("\tlinkage = %d\n", sc.linkage);
|
//printf("\tlinkage = %d\n", sc.linkage);
|
||||||
|
|
||||||
if (funcdecl.ident == Id.assign && !funcdecl.inuse)
|
if (funcdecl.ident == Id.opAssign && !funcdecl.inuse)
|
||||||
{
|
{
|
||||||
if (funcdecl.storage_class & STC.inference)
|
if (funcdecl.storage_class & STC.inference)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2025,7 +2025,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
}
|
}
|
||||||
else if (sd.xeq == sd.xerreq)
|
else if (sd.xeq == sd.xerreq)
|
||||||
{
|
{
|
||||||
if (search_function(sd, Id.eq))
|
if (search_function(sd, Id.opEquals))
|
||||||
{
|
{
|
||||||
.error(loc, "%sAA key type `%s` does not have `bool opEquals(ref const %s) const`", s, sd.toChars(), sd.toChars());
|
.error(loc, "%sAA key type `%s` does not have `bool opEquals(ref const %s) const`", s, sd.toChars(), sd.toChars());
|
||||||
}
|
}
|
||||||
|
@ -2037,7 +2037,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
}
|
}
|
||||||
else if (!sd.xhash)
|
else if (!sd.xhash)
|
||||||
{
|
{
|
||||||
if (search_function(sd, Id.eq))
|
if (search_function(sd, Id.opEquals))
|
||||||
{
|
{
|
||||||
.error(loc, "%sAA key type `%s` should have `extern (D) size_t toHash() const nothrow @safe` if `opEquals` defined", s, sd.toChars());
|
.error(loc, "%sAA key type `%s` should have `extern (D) size_t toHash() const nothrow @safe` if `opEquals` defined", s, sd.toChars());
|
||||||
}
|
}
|
||||||
|
@ -2075,9 +2075,9 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc)
|
||||||
__gshared FuncDeclaration fcmp = null;
|
__gshared FuncDeclaration fcmp = null;
|
||||||
__gshared FuncDeclaration fhash = null;
|
__gshared FuncDeclaration fhash = null;
|
||||||
if (!feq)
|
if (!feq)
|
||||||
feq = search_function(ClassDeclaration.object, Id.eq).isFuncDeclaration();
|
feq = search_function(ClassDeclaration.object, Id.opEquals).isFuncDeclaration();
|
||||||
if (!fcmp)
|
if (!fcmp)
|
||||||
fcmp = search_function(ClassDeclaration.object, Id.cmp).isFuncDeclaration();
|
fcmp = search_function(ClassDeclaration.object, Id.opCmp).isFuncDeclaration();
|
||||||
if (!fhash)
|
if (!fhash)
|
||||||
fhash = search_function(ClassDeclaration.object, Id.tohash).isFuncDeclaration();
|
fhash = search_function(ClassDeclaration.object, Id.tohash).isFuncDeclaration();
|
||||||
assert(fcmp && feq && fhash);
|
assert(fcmp && feq && fhash);
|
||||||
|
@ -3417,7 +3417,7 @@ Expression getProperty(Type t, Scope* scope_, const ref Loc loc, Identifier iden
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
error(loc, "no property `%s` for type `%s`, did you mean `%s`?", ident.toChars(), mt.toChars(), s.toPrettyChars());
|
error(loc, "no property `%s` for type `%s`, did you mean `%s`?", ident.toChars(), mt.toChars(), s.toPrettyChars());
|
||||||
else if (ident == Id.call && mt.ty == Tclass)
|
else if (ident == Id.opCall && mt.ty == Tclass)
|
||||||
error(loc, "no property `%s` for type `%s`, did you mean `new %s`?", ident.toChars(), mt.toChars(), mt.toPrettyChars());
|
error(loc, "no property `%s` for type `%s`, did you mean `new %s`?", ident.toChars(), mt.toChars(), mt.toPrettyChars());
|
||||||
|
|
||||||
else if (const n = importHint(ident.toString()))
|
else if (const n = importHint(ident.toString()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue