Skip to content

Commit

Permalink
Merge pull request #3115 from yebblies/toStringExp
Browse files Browse the repository at this point in the history
[DDMD] Rename toString to toStringExp to avoid conflict with D's toString
  • Loading branch information
yebblies committed Jan 19, 2014
2 parents 44a3a4c + 4ce8b38 commit 5f12359
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions src/attrib.c
Expand Up @@ -575,7 +575,7 @@ void DeprecatedDeclaration::setScope(Scope *sc)
{
assert(msg);
char *depmsg = NULL;
StringExp *se = msg->toString();
StringExp *se = msg->toStringExp();
if (se)
depmsg = (char *)se->string;
else
Expand Down Expand Up @@ -1018,7 +1018,7 @@ void PragmaDeclaration::semantic(Scope *sc)
{ errorSupplemental(loc, "while evaluating pragma(msg, %s)", (*args)[i]->toChars());
return;
}
StringExp *se = e->toString();
StringExp *se = e->toStringExp();
if (se)
{
se = se->toUTF8(sc);
Expand Down Expand Up @@ -1048,7 +1048,7 @@ void PragmaDeclaration::semantic(Scope *sc)
(*args)[0] = e;
if (e->op == TOKerror)
goto Lnodecl;
StringExp *se = e->toString();
StringExp *se = e->toStringExp();
if (!se)
error("string expected for library name, not '%s'", e->toChars());
else
Expand Down Expand Up @@ -1111,7 +1111,7 @@ void PragmaDeclaration::semantic(Scope *sc)
if (e->op == TOKerror)
goto Lnodecl;

StringExp *se = e->toString();
StringExp *se = e->toStringExp();

if (!se)
{
Expand Down Expand Up @@ -1213,7 +1213,7 @@ void PragmaDeclaration::semantic(Scope *sc)

if (ident == Id::mangle)
{
StringExp *e = (*args)[0]->toString();
StringExp *e = (*args)[0]->toStringExp();

char *name = (char *)mem.malloc(e->len + 1);
memcpy(name, e->string, e->len);
Expand Down Expand Up @@ -1595,7 +1595,7 @@ void CompileDeclaration::compileIt(Scope *sc)
exp = resolveProperties(sc, exp);
sc = sc->endCTFE();
exp = exp->ctfeInterpret();
StringExp *se = exp->toString();
StringExp *se = exp->toStringExp();
if (!se)
{
exp->error("argument to mixin must be a string, not (%s)", exp->toChars());
Expand Down
2 changes: 1 addition & 1 deletion src/ctfeexpr.c
Expand Up @@ -162,7 +162,7 @@ char *ThrownExceptionExp::toChars()
void ThrownExceptionExp::generateUncaughtError()
{
Expression *e = (*thrown->value->elements)[0];
StringExp* se = e->toString();
StringExp* se = e->toStringExp();
thrown->error("Uncaught CTFE exception %s(%s)", thrown->type->toChars(), se ? se->toChars() : e->toChars());

/* Also give the line where the throw statement was. We won't have it
Expand Down
10 changes: 5 additions & 5 deletions src/expression.c
Expand Up @@ -2112,7 +2112,7 @@ complex_t Expression::toComplex()
return (complex_t)0.0;
}

StringExp *Expression::toString()
StringExp *Expression::toStringExp()
{
return NULL;
}
Expand Down Expand Up @@ -3852,7 +3852,7 @@ int NullExp::isBool(int result)
return result ? false : true;
}

StringExp *NullExp::toString()
StringExp *NullExp::toStringExp()
{
if (implicitConvTo(Type::tstring))
{
Expand Down Expand Up @@ -4057,7 +4057,7 @@ size_t StringExp::length()
return result;
}

StringExp *StringExp::toString()
StringExp *StringExp::toStringExp()
{
return this;
}
Expand Down Expand Up @@ -4367,7 +4367,7 @@ int ArrayLiteralExp::isBool(int result)
return result ? (dim != 0) : (dim == 0);
}

StringExp *ArrayLiteralExp::toString()
StringExp *ArrayLiteralExp::toStringExp()
{
TY telem = type->nextOf()->toBasetype()->ty;

Expand Down Expand Up @@ -7207,7 +7207,7 @@ Expression *CompileExp::semantic(Scope *sc)
return new ErrorExp();
}
e1 = e1->ctfeInterpret();
StringExp *se = e1->toString();
StringExp *se = e1->toStringExp();
if (!se)
{ error("argument to mixin must be a string, not (%s)", e1->toChars());
return new ErrorExp();
Expand Down
8 changes: 4 additions & 4 deletions src/expression.h
Expand Up @@ -146,7 +146,7 @@ class Expression : public RootObject
virtual real_t toReal();
virtual real_t toImaginary();
virtual complex_t toComplex();
virtual StringExp *toString();
virtual StringExp *toStringExp();
virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
virtual void toMangleBuffer(OutBuffer *buf);
virtual int isLvalue();
Expand Down Expand Up @@ -382,7 +382,7 @@ class NullExp : public Expression
Expression *semantic(Scope *sc);
int isBool(int result);
int isConst();
StringExp *toString();
StringExp *toStringExp();
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
void toMangleBuffer(OutBuffer *buf);
MATCH implicitConvTo(Type *t);
Expand Down Expand Up @@ -411,7 +411,7 @@ class StringExp : public Expression
Expression *semantic(Scope *sc);
Expression *interpret(InterState *istate, CtfeGoal goal = ctfeNeedRvalue);
size_t length();
StringExp *toString();
StringExp *toStringExp();
StringExp *toUTF8(Scope *sc);
Expression *implicitCastTo(Scope *sc, Type *t);
MATCH implicitConvTo(Type *t);
Expand Down Expand Up @@ -476,7 +476,7 @@ class ArrayLiteralExp : public Expression
Expression *semantic(Scope *sc);
int isBool(int result);
elem *toElem(IRState *irs);
StringExp *toString();
StringExp *toStringExp();
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
void toMangleBuffer(OutBuffer *buf);
Expression *optimize(int result, bool keepLvalue = false);
Expand Down
6 changes: 3 additions & 3 deletions src/statement.c
Expand Up @@ -521,7 +521,7 @@ Statements *CompileStatement::flatten(Scope *sc)
Statements *a = new Statements();
if (exp->op != TOKerror)
{
StringExp *se = exp->toString();
StringExp *se = exp->toStringExp();
if (!se)
error("argument to mixin must be a string, not (%s)", exp->toChars());
else
Expand Down Expand Up @@ -2931,7 +2931,7 @@ Statement *PragmaStatement::semantic(Scope *sc)
{ errorSupplemental(loc, "while evaluating pragma(msg, %s)", (*args)[i]->toChars());
goto Lerror;
}
StringExp *se = e->toString();
StringExp *se = e->toStringExp();
if (se)
{
fprintf(stderr, "%.*s", (int)se->len, (char *)se->string);
Expand Down Expand Up @@ -2962,7 +2962,7 @@ Statement *PragmaStatement::semantic(Scope *sc)

e = e->ctfeInterpret();
(*args)[0] = e;
StringExp *se = e->toString();
StringExp *se = e->toStringExp();
if (!se)
error("string expected for library name, not '%s'", e->toChars());
else if (global.params.verbose)
Expand Down
2 changes: 1 addition & 1 deletion src/staticassert.c
Expand Up @@ -90,7 +90,7 @@ void StaticAssert::semantic2(Scope *sc)
sc = sc->endCTFE();
msg = msg->ctfeInterpret();
hgs.console = 1;
StringExp * s = msg->toString();
StringExp * s = msg->toStringExp();
if (s)
{ s->postfix = 0; // Don't display a trailing 'c'
msg = s;
Expand Down
2 changes: 1 addition & 1 deletion src/traits.c
Expand Up @@ -429,7 +429,7 @@ Expression *TraitsExp::semantic(Scope *sc)
goto Lfalse;
}
e = e->ctfeInterpret();
StringExp *se = e->toString();
StringExp *se = e->toStringExp();
if (!se || se->length() == 0)
{ error("string expected as second argument of __traits %s instead of %s", ident->toChars(), e->toChars());
goto Lfalse;
Expand Down

0 comments on commit 5f12359

Please sign in to comment.