mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-10-14 02:07:00 +02:00
Fix white space.
This commit is contained in:
+98
-98
@@ -1,6 +1,6 @@
|
||||
|
||||
// Compiler implementation of the D programming language
|
||||
// Copyright (c) 1999-2011 by Digital Mars
|
||||
// Copyright (c) 1999-2011 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -111,7 +111,7 @@ void Declaration::checkModify(Loc loc, Scope *sc, Type *t)
|
||||
if (fd &&
|
||||
((fd->isCtorDeclaration() && storage_class & STCfield) ||
|
||||
(fd->isStaticCtorDeclaration() && !(storage_class & STCfield))) &&
|
||||
fd->toParent2() == toParent()
|
||||
fd->toParent2() == toParent()
|
||||
)
|
||||
{
|
||||
VarDeclaration *v = isVarDeclaration();
|
||||
@@ -194,7 +194,7 @@ Type *TupleDeclaration::getType()
|
||||
/* It's only a type tuple if all the Object's are types
|
||||
*/
|
||||
for (size_t i = 0; i < objects->dim; i++)
|
||||
{ Object *o = (*objects)[i];
|
||||
{ Object *o = (*objects)[i];
|
||||
|
||||
if (o->dyncast() != DYNCAST_TYPE)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ Type *TupleDeclaration::getType()
|
||||
#else
|
||||
Parameter *arg = new Parameter(STCin, t, NULL, NULL);
|
||||
#endif
|
||||
(*args)[i] = arg;
|
||||
(*args)[i] = arg;
|
||||
if (!t->deco)
|
||||
hasdeco = 0;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ int TupleDeclaration::needThis()
|
||||
{
|
||||
//printf("TupleDeclaration::needThis(%s)\n", toChars());
|
||||
for (size_t i = 0; i < objects->dim; i++)
|
||||
{ Object *o = (*objects)[i];
|
||||
{ Object *o = (*objects)[i];
|
||||
if (o->dyncast() == DYNCAST_EXPRESSION)
|
||||
{ Expression *e = (Expression *)o;
|
||||
if (e->op == TOKdsymbol)
|
||||
@@ -282,7 +282,7 @@ Dsymbol *TypedefDeclaration::syntaxCopy(Dsymbol *s)
|
||||
assert(!s);
|
||||
TypedefDeclaration *st;
|
||||
st = new TypedefDeclaration(loc, ident, basetype, init);
|
||||
|
||||
|
||||
// Syntax copy for header file
|
||||
if (!htype) // Don't overwrite original
|
||||
{ if (type) // Make copy for both old and new instances
|
||||
@@ -300,43 +300,43 @@ Dsymbol *TypedefDeclaration::syntaxCopy(Dsymbol *s)
|
||||
}
|
||||
else
|
||||
st->hbasetype = hbasetype->syntaxCopy();
|
||||
|
||||
|
||||
return st;
|
||||
}
|
||||
|
||||
void TypedefDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
//printf("TypedefDeclaration::semantic(%s) sem = %d\n", toChars(), sem);
|
||||
if (sem == SemanticStart)
|
||||
{ sem = SemanticIn;
|
||||
parent = sc->parent;
|
||||
int errors = global.errors;
|
||||
Type *savedbasetype = basetype;
|
||||
if (sem == SemanticStart)
|
||||
{ sem = SemanticIn;
|
||||
parent = sc->parent;
|
||||
int errors = global.errors;
|
||||
Type *savedbasetype = basetype;
|
||||
basetype = basetype->semantic(loc, sc);
|
||||
if (errors != global.errors)
|
||||
{
|
||||
basetype = savedbasetype;
|
||||
sem = SemanticStart;
|
||||
return;
|
||||
}
|
||||
sem = SemanticDone;
|
||||
if (errors != global.errors)
|
||||
{
|
||||
basetype = savedbasetype;
|
||||
sem = SemanticStart;
|
||||
return;
|
||||
}
|
||||
sem = SemanticDone;
|
||||
#if DMDV2
|
||||
type = type->addStorageClass(storage_class);
|
||||
#endif
|
||||
Type *savedtype = type;
|
||||
Type *savedtype = type;
|
||||
type = type->semantic(loc, sc);
|
||||
if (sc->parent->isFuncDeclaration() && init)
|
||||
semantic2(sc);
|
||||
if (errors != global.errors)
|
||||
{
|
||||
basetype = savedbasetype;
|
||||
type = savedtype;
|
||||
sem = SemanticStart;
|
||||
return;
|
||||
}
|
||||
if (errors != global.errors)
|
||||
{
|
||||
basetype = savedbasetype;
|
||||
type = savedtype;
|
||||
sem = SemanticStart;
|
||||
return;
|
||||
}
|
||||
storage_class |= sc->stc & STCdeprecated;
|
||||
}
|
||||
else if (sem == SemanticIn)
|
||||
else if (sem == SemanticIn)
|
||||
{
|
||||
error("circular definition");
|
||||
}
|
||||
@@ -345,18 +345,18 @@ void TypedefDeclaration::semantic(Scope *sc)
|
||||
void TypedefDeclaration::semantic2(Scope *sc)
|
||||
{
|
||||
//printf("TypedefDeclaration::semantic2(%s) sem = %d\n", toChars(), sem);
|
||||
if (sem == SemanticDone)
|
||||
{ sem = Semantic2Done;
|
||||
if (sem == SemanticDone)
|
||||
{ sem = Semantic2Done;
|
||||
if (init)
|
||||
{
|
||||
Initializer *savedinit = init;
|
||||
int errors = global.errors;
|
||||
init = init->semantic(sc, basetype, WANTinterpret);
|
||||
if (errors != global.errors)
|
||||
{
|
||||
init = savedinit;
|
||||
return;
|
||||
}
|
||||
Initializer *savedinit = init;
|
||||
int errors = global.errors;
|
||||
init = init->semantic(sc, basetype, WANTinterpret);
|
||||
if (errors != global.errors)
|
||||
{
|
||||
init = savedinit;
|
||||
return;
|
||||
}
|
||||
|
||||
ExpInitializer *ie = init->isExpInitializer();
|
||||
if (ie)
|
||||
@@ -470,7 +470,7 @@ void AliasDeclaration::semantic(Scope *sc)
|
||||
#endif
|
||||
|
||||
storage_class |= sc->stc & STCdeprecated;
|
||||
protection = sc->protection;
|
||||
protection = sc->protection;
|
||||
|
||||
// Given:
|
||||
// alias foo.bar.abc def;
|
||||
@@ -481,9 +481,9 @@ void AliasDeclaration::semantic(Scope *sc)
|
||||
// type. If it is a symbol, then aliassym is set and type is NULL -
|
||||
// toAlias() will return aliasssym.
|
||||
|
||||
int errors = global.errors;
|
||||
Type *savedtype = type;
|
||||
|
||||
int errors = global.errors;
|
||||
Type *savedtype = type;
|
||||
|
||||
Dsymbol *s;
|
||||
Type *t;
|
||||
Expression *e;
|
||||
@@ -496,7 +496,7 @@ void AliasDeclaration::semantic(Scope *sc)
|
||||
s = type->toDsymbol(sc);
|
||||
if (s
|
||||
#if DMDV2
|
||||
&& ((s->getType() && type->equals(s->getType())) || s->isEnumMember())
|
||||
&& ((s->getType() && type->equals(s->getType())) || s->isEnumMember())
|
||||
#endif
|
||||
)
|
||||
goto L2; // it's a symbolic alias
|
||||
@@ -536,15 +536,15 @@ void AliasDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
else if (t)
|
||||
{
|
||||
type = t->semantic(loc, sc);
|
||||
//printf("\talias resolved to type %s\n", type->toChars());
|
||||
type = t->semantic(loc, sc);
|
||||
//printf("\talias resolved to type %s\n", type->toChars());
|
||||
}
|
||||
if (overnext)
|
||||
ScopeDsymbol::multiplyDefined(0, this, overnext);
|
||||
this->inSemantic = 0;
|
||||
|
||||
if (errors != global.errors)
|
||||
type = savedtype;
|
||||
|
||||
if (errors != global.errors)
|
||||
type = savedtype;
|
||||
return;
|
||||
|
||||
L2:
|
||||
@@ -558,7 +558,7 @@ void AliasDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
else
|
||||
{
|
||||
Dsymbol *savedovernext = overnext;
|
||||
Dsymbol *savedovernext = overnext;
|
||||
FuncDeclaration *f = s->toAlias()->isFuncDeclaration();
|
||||
if (f)
|
||||
{
|
||||
@@ -574,25 +574,25 @@ void AliasDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
}
|
||||
if (overnext)
|
||||
ScopeDsymbol::multiplyDefined(0, this, overnext);
|
||||
ScopeDsymbol::multiplyDefined(0, this, overnext);
|
||||
if (s == this)
|
||||
{
|
||||
assert(global.errors);
|
||||
s = NULL;
|
||||
}
|
||||
if (errors != global.errors)
|
||||
{
|
||||
type = savedtype;
|
||||
overnext = savedovernext;
|
||||
aliassym = NULL;
|
||||
inSemantic = 0;
|
||||
return;
|
||||
}
|
||||
if (errors != global.errors)
|
||||
{
|
||||
type = savedtype;
|
||||
overnext = savedovernext;
|
||||
aliassym = NULL;
|
||||
inSemantic = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!type || type->ty != Terror)
|
||||
{ //printf("setting aliassym %s to %s %s\n", toChars(), s->kind(), s->toChars());
|
||||
if (!type || type->ty != Terror)
|
||||
{ //printf("setting aliassym %s to %s %s\n", toChars(), s->kind(), s->toChars());
|
||||
aliassym = s;
|
||||
}
|
||||
}
|
||||
this->inSemantic = 0;
|
||||
}
|
||||
|
||||
@@ -654,7 +654,7 @@ Dsymbol *AliasDeclaration::toAlias()
|
||||
//static int count; if (++count == 75) exit(0); //*(char*)0=0;
|
||||
if (inSemantic)
|
||||
{ error("recursive alias declaration");
|
||||
aliassym = new AliasDeclaration(loc, ident, Type::terror);
|
||||
aliassym = new AliasDeclaration(loc, ident, Type::terror);
|
||||
type = Type::terror;
|
||||
}
|
||||
else if (!aliassym && scope)
|
||||
@@ -666,7 +666,7 @@ Dsymbol *AliasDeclaration::toAlias()
|
||||
void AliasDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs)
|
||||
{
|
||||
buf->writestring("alias ");
|
||||
#if 0
|
||||
#if 0
|
||||
if (hgs->hdrgen)
|
||||
{
|
||||
if (haliassym)
|
||||
@@ -724,11 +724,11 @@ VarDeclaration::VarDeclaration(Loc loc, Type *type, Identifier *id, Initializer
|
||||
aliassym = NULL;
|
||||
onstack = 0;
|
||||
canassign = 0;
|
||||
ctfeAdrOnStack = (size_t)(-1);
|
||||
#if DMDV2
|
||||
rundtor = NULL;
|
||||
edtor = NULL;
|
||||
#endif
|
||||
ctfeAdrOnStack = (size_t)(-1);
|
||||
#if DMDV2
|
||||
rundtor = NULL;
|
||||
edtor = NULL;
|
||||
#endif
|
||||
|
||||
#if IN_LLVM
|
||||
aggrIndex = 0;
|
||||
@@ -794,11 +794,11 @@ void VarDeclaration::semantic(Scope *sc)
|
||||
//if (strcmp(toChars(), "mul") == 0) halt();
|
||||
#endif
|
||||
|
||||
if (scope)
|
||||
{ sc = scope;
|
||||
scope = NULL;
|
||||
}
|
||||
|
||||
if (scope)
|
||||
{ sc = scope;
|
||||
scope = NULL;
|
||||
}
|
||||
|
||||
storage_class |= sc->stc;
|
||||
if (storage_class & STCextern && init)
|
||||
error("extern symbols cannot have initializers");
|
||||
@@ -813,7 +813,7 @@ void VarDeclaration::semantic(Scope *sc)
|
||||
if (!type)
|
||||
{ inuse++;
|
||||
type = init->inferType(sc);
|
||||
type = type->semantic(loc, sc);
|
||||
type = type->semantic(loc, sc);
|
||||
inuse--;
|
||||
inferred = 1;
|
||||
|
||||
@@ -990,10 +990,10 @@ void VarDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
|
||||
// If it's a member template
|
||||
AggregateDeclaration *ad2 = ti->tempdecl->isMember();
|
||||
if (ad2 && storage_class != STCundefined)
|
||||
AggregateDeclaration *ad2 = ti->tempdecl->isMember();
|
||||
if (ad2 && storage_class != STCundefined)
|
||||
{
|
||||
error("cannot use template to add field to aggregate '%s'", ad2->toChars());
|
||||
error("cannot use template to add field to aggregate '%s'", ad2->toChars());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1102,7 +1102,7 @@ void VarDeclaration::semantic(Scope *sc)
|
||||
Expression *e = init->toExpression();
|
||||
if (!e)
|
||||
{
|
||||
init = init->semantic(sc, type, 0); // Don't need to interpret
|
||||
init = init->semantic(sc, type, 0); // Don't need to interpret
|
||||
e = init->toExpression();
|
||||
if (!e)
|
||||
{ error("is not a static and cannot have static initializer");
|
||||
@@ -1121,7 +1121,7 @@ void VarDeclaration::semantic(Scope *sc)
|
||||
ei->exp = ei->exp->semantic(sc);
|
||||
if (!ei->exp->implicitConvTo(type))
|
||||
{
|
||||
dinteger_t dim = ((TypeSArray *)t)->dim->toInteger();
|
||||
dinteger_t dim = ((TypeSArray *)t)->dim->toInteger();
|
||||
// If multidimensional static array, treat as one large array
|
||||
while (1)
|
||||
{
|
||||
@@ -1203,7 +1203,7 @@ void VarDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
else
|
||||
{
|
||||
init = init->semantic(sc, type, WANTinterpret);
|
||||
init = init->semantic(sc, type, WANTinterpret);
|
||||
if (fd && isConst() && !isStatic())
|
||||
{ // Make it static
|
||||
storage_class |= STCstatic;
|
||||
@@ -1221,7 +1221,7 @@ void VarDeclaration::semantic(Scope *sc)
|
||||
|
||||
if (!global.errors && !inferred)
|
||||
{
|
||||
unsigned errors = global.startGagging();
|
||||
unsigned errors = global.startGagging();
|
||||
Expression *e;
|
||||
Initializer *i2 = init;
|
||||
inuse++;
|
||||
@@ -1233,10 +1233,10 @@ void VarDeclaration::semantic(Scope *sc)
|
||||
}
|
||||
else if (si || ai)
|
||||
{ i2 = init->syntaxCopy();
|
||||
i2 = i2->semantic(sc, type, WANTinterpret);
|
||||
i2 = i2->semantic(sc, type, WANTinterpret);
|
||||
}
|
||||
inuse--;
|
||||
if (global.endGagging(errors)) // if errors happened
|
||||
if (global.endGagging(errors)) // if errors happened
|
||||
{
|
||||
#if DMDV2
|
||||
/* Save scope for later use, to try again
|
||||
@@ -1311,7 +1311,7 @@ void VarDeclaration::semantic2(Scope *sc)
|
||||
printf("type = %p\n", ei->exp->type);
|
||||
}
|
||||
#endif
|
||||
init = init->semantic(sc, type, WANTinterpret);
|
||||
init = init->semantic(sc, type, WANTinterpret);
|
||||
inuse--;
|
||||
}
|
||||
}
|
||||
@@ -1419,12 +1419,12 @@ void VarDeclaration::checkNestedReference(Scope *sc, Loc loc)
|
||||
// The current function
|
||||
FuncDeclaration *fdthis = sc->parent->isFuncDeclaration();
|
||||
|
||||
if (fdv && fdthis && fdv != fdthis && fdthis->ident != Id::ensure)
|
||||
if (fdv && fdthis && fdv != fdthis && fdthis->ident != Id::ensure)
|
||||
{
|
||||
/* __ensure is always called directly,
|
||||
* so it never becomes closure.
|
||||
*/
|
||||
|
||||
/* __ensure is always called directly,
|
||||
* so it never becomes closure.
|
||||
*/
|
||||
|
||||
if (loc.filename)
|
||||
fdthis->getLevel(loc, fdv);
|
||||
nestedref = 1;
|
||||
@@ -1535,15 +1535,15 @@ Expression *VarDeclaration::callScopeDtor(Scope *sc)
|
||||
return e;
|
||||
}
|
||||
|
||||
/******************************************
|
||||
*/
|
||||
|
||||
void ObjectNotFound(Identifier *id)
|
||||
{
|
||||
Type::error(0, "%s not found. object.d may be incorrectly installed or corrupt.", id->toChars());
|
||||
fatal();
|
||||
}
|
||||
|
||||
/******************************************
|
||||
*/
|
||||
|
||||
void ObjectNotFound(Identifier *id)
|
||||
{
|
||||
Type::error(0, "%s not found. object.d may be incorrectly installed or corrupt.", id->toChars());
|
||||
fatal();
|
||||
}
|
||||
|
||||
|
||||
/********************************* ClassInfoDeclaration ****************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user