Skip to content

Commit

Permalink
Move lexer's string table into Identifier and clean up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
yebblies committed Jan 4, 2015
1 parent e129e84 commit 2d0115b
Show file tree
Hide file tree
Showing 45 changed files with 426 additions and 425 deletions.
1 change: 1 addition & 0 deletions src/aliasthis.c
Expand Up @@ -20,6 +20,7 @@
#include "dsymbol.h"
#include "mtype.h"
#include "declaration.h"
#include "tokens.h"

Expression *resolveAliasThis(Scope *sc, Expression *e)
{
Expand Down
3 changes: 2 additions & 1 deletion src/arrayop.c
Expand Up @@ -25,6 +25,7 @@
#include "id.h"
#include "module.h"
#include "init.h"
#include "tokens.h"

void buildArrayIdent(Expression *e, OutBuffer *buf, Expressions *arguments);
Expression *buildArrayLoop(Expression *e, Parameters *fparams);
Expand Down Expand Up @@ -206,7 +207,7 @@ Expression *arrayOp(BinExp *e, Scope *sc)
buf.writestring(e->type->toBasetype()->nextOf()->toBasetype()->mutableOf()->deco);

char *name = buf.peekString();
Identifier *ident = Lexer::idPool(name);
Identifier *ident = Identifier::idPool(name);

FuncDeclaration **pFd = (FuncDeclaration **)dmd_aaGet(&arrayfuncs, (void *)ident);
FuncDeclaration *fd = *pFd;
Expand Down
1 change: 1 addition & 0 deletions src/builtin.c
Expand Up @@ -25,6 +25,7 @@
#include "id.h"
#include "module.h"
#include "root/port.h"
#include "tokens.h"

StringTable builtins;

Expand Down
1 change: 1 addition & 0 deletions src/canthrow.c
Expand Up @@ -23,6 +23,7 @@
#include "aggregate.h"
#include "scope.h"
#include "attrib.h"
#include "tokens.h"

bool Dsymbol_canThrow(Dsymbol *s, FuncDeclaration *func, bool mustNotThrow);
bool walkPostorder(Expression *e, StoppableVisitor *v);
Expand Down
1 change: 1 addition & 0 deletions src/cast.c
Expand Up @@ -24,6 +24,7 @@
#include "scope.h"
#include "id.h"
#include "init.h"
#include "tokens.h"

bool isCommutative(Expression *e);

Expand Down
15 changes: 8 additions & 7 deletions src/clone.c
Expand Up @@ -23,6 +23,7 @@
#include "statement.h"
#include "init.h"
#include "template.h"
#include "tokens.h"


/*******************************************
Expand Down Expand Up @@ -250,7 +251,7 @@ FuncDeclaration *buildOpAssign(StructDeclaration *sd, Scope *sc)
* tmp = this; this = s; tmp.dtor();
*/
//printf("\tswap copy\n");
Identifier *idtmp = Lexer::uniqueId("__swap");
Identifier *idtmp = Identifier::generateId("__swap");
VarDeclaration *tmp = NULL;
AssignExp *ec = NULL;
if (sd->dtor)
Expand Down Expand Up @@ -494,7 +495,7 @@ FuncDeclaration *buildXopEquals(StructDeclaration *sd, Scope *sc)
if (!sd->xerreq)
{
// object._xopEquals
Identifier *id = Lexer::idPool("_xopEquals");
Identifier *id = Identifier::idPool("_xopEquals");
Expression *e = new IdentifierExp(sd->loc, Id::empty);
e = new DotIdExp(sd->loc, e, Id::object);
e = new DotIdExp(sd->loc, e, id);
Expand Down Expand Up @@ -620,7 +621,7 @@ FuncDeclaration *buildXopCmp(StructDeclaration *sd, Scope *sc)
if (!sd->xerrcmp)
{
// object._xopCmp
Identifier *id = Lexer::idPool("_xopCmp");
Identifier *id = Identifier::idPool("_xopCmp");
Expression *e = new IdentifierExp(sd->loc, Id::empty);
e = new DotIdExp(sd->loc, e, Id::object);
e = new DotIdExp(sd->loc, e, id);
Expand Down Expand Up @@ -857,7 +858,7 @@ FuncDeclaration *buildPostBlit(StructDeclaration *sd, Scope *sc)
if (e || (stc & STCdisable))
{
//printf("Building __fieldPostBlit()\n");
PostBlitDeclaration *dd = new PostBlitDeclaration(declLoc, Loc(), stc, Lexer::idPool("__fieldPostBlit"));
PostBlitDeclaration *dd = new PostBlitDeclaration(declLoc, Loc(), stc, Identifier::idPool("__fieldPostBlit"));
dd->fbody = new ExpStatement(loc, e);
sd->postblits.shift(dd);
sd->members->push(dd);
Expand Down Expand Up @@ -889,7 +890,7 @@ FuncDeclaration *buildPostBlit(StructDeclaration *sd, Scope *sc)
ex = new CallExp(loc, ex);
e = Expression::combine(e, ex);
}
PostBlitDeclaration *dd = new PostBlitDeclaration(declLoc, Loc(), stc, Lexer::idPool("__aggrPostBlit"));
PostBlitDeclaration *dd = new PostBlitDeclaration(declLoc, Loc(), stc, Identifier::idPool("__aggrPostBlit"));
dd->fbody = new ExpStatement(loc, e);
sd->members->push(dd);
dd->semantic(sc);
Expand Down Expand Up @@ -970,7 +971,7 @@ FuncDeclaration *buildDtor(AggregateDeclaration *ad, Scope *sc)
if (e || (stc & STCdisable))
{
//printf("Building __fieldDtor()\n");
DtorDeclaration *dd = new DtorDeclaration(declLoc, Loc(), stc, Lexer::idPool("__fieldDtor"));
DtorDeclaration *dd = new DtorDeclaration(declLoc, Loc(), stc, Identifier::idPool("__fieldDtor"));
dd->fbody = new ExpStatement(loc, e);
ad->dtors.shift(dd);
ad->members->push(dd);
Expand Down Expand Up @@ -1002,7 +1003,7 @@ FuncDeclaration *buildDtor(AggregateDeclaration *ad, Scope *sc)
ex = new CallExp(loc, ex);
e = Expression::combine(ex, e);
}
DtorDeclaration *dd = new DtorDeclaration(declLoc, Loc(), stc, Lexer::idPool("__aggrDtor"));
DtorDeclaration *dd = new DtorDeclaration(declLoc, Loc(), stc, Identifier::idPool("__aggrDtor"));
dd->fbody = new ExpStatement(loc, e);
ad->members->push(dd);
dd->semantic(sc);
Expand Down
4 changes: 2 additions & 2 deletions src/cond.c
Expand Up @@ -21,10 +21,10 @@
#include "cond.h"
#include "module.h"
#include "template.h"
#include "lexer.h"
#include "mtype.h"
#include "scope.h"
#include "arraytypes.h"
#include "tokens.h"

int findCondition(Strings *ids, Identifier *ident)
{
Expand Down Expand Up @@ -293,7 +293,7 @@ int VersionCondition::include(Scope *sc, ScopeDsymbol *sds)
}
else if (level <= global.params.versionlevel || level <= mod->versionlevel)
inc = 1;
if (!definedInModule && (!ident || (!isPredefined(ident->toChars()) && ident != Lexer::idPool(Token::toChars(TOKunittest)) && ident != Lexer::idPool(Token::toChars(TOKassert)))))
if (!definedInModule && (!ident || (!isPredefined(ident->toChars()) && ident != Identifier::idPool(Token::toChars(TOKunittest)) && ident != Identifier::idPool(Token::toChars(TOKassert)))))
printDepsConditional(sc, this, "depsVersion ");
}
return (inc == 1);
Expand Down
1 change: 1 addition & 0 deletions src/ctfe.h
Expand Up @@ -17,6 +17,7 @@
#endif /* __DMC__ */

#include "arraytypes.h"
#include "tokens.h"

/**
Global status of the CTFE engine. Mostly used for performance diagnostics
Expand Down
4 changes: 2 additions & 2 deletions src/declaration.c
Expand Up @@ -953,7 +953,7 @@ void VarDeclaration::semantic(Scope *sc)
}
else if (isAliasThisTuple(e))
{
Identifier *id = Lexer::uniqueId("__tup");
Identifier *id = Identifier::generateId("__tup");
ExpInitializer *ei = new ExpInitializer(e->loc, e);
VarDeclaration *v = new VarDeclaration(loc, NULL, id, ei);
v->storage_class = STCtemp | STCctfe | STCref | STCforeach;
Expand Down Expand Up @@ -1024,7 +1024,7 @@ void VarDeclaration::semantic(Scope *sc)
OutBuffer buf;
buf.printf("__%s_field_%llu", ident->toChars(), (ulonglong)i);
const char *name = buf.extractString();
Identifier *id = Lexer::idPool(name);
Identifier *id = Identifier::idPool(name);

Initializer *ti;
if (ie)
Expand Down
1 change: 0 additions & 1 deletion src/declaration.h
Expand Up @@ -17,7 +17,6 @@
#endif /* __DMC__ */

#include "dsymbol.h"
#include "lexer.h"
#include "mtype.h"

class Expression;
Expand Down
1 change: 1 addition & 0 deletions src/delegatize.c
Expand Up @@ -21,6 +21,7 @@
#include "aggregate.h"
#include "scope.h"
#include "init.h"
#include "tokens.h"

/********************************************
* Convert from expression to delegate that returns the expression,
Expand Down
2 changes: 1 addition & 1 deletion src/doc.c
Expand Up @@ -566,7 +566,7 @@ static void emitAnchor(OutBuffer *buf, Dsymbol *s, Scope *sc)
{
OutBuffer anc;
emitAnchorName(&anc, s, skipNonQualScopes(sc));
ident = Lexer::idPool(anc.peekString());
ident = Identifier::idPool(anc.peekString());
}
size_t *count = (size_t*)dmd_aaGet(&sc->anchorCounts, (void *)ident);
TemplateDeclaration *td = getEponymousParentTemplate(s);
Expand Down
7 changes: 3 additions & 4 deletions src/dsymbol.c
Expand Up @@ -33,6 +33,7 @@
#include "template.h"
#include "attrib.h"
#include "enum.h"
#include "lexer.h"


/****************************** Dsymbol ******************************/
Expand Down Expand Up @@ -423,11 +424,9 @@ void *symbol_search_fp(void *arg, const char *seed, int* cost)
size_t len = strlen(seed);
if (!len)
return NULL;
StringValue *sv = Lexer::stringtable.lookup(seed, len);
if (!sv)
Identifier *id = Identifier::lookup(seed, len);
if (!id)
return NULL;
Identifier *id = (Identifier *)sv->ptrvalue;
assert(id);

*cost = 0;
Dsymbol *s = (Dsymbol *)arg;
Expand Down
1 change: 0 additions & 1 deletion src/e2ir.c
Expand Up @@ -16,7 +16,6 @@
#include "port.h"
#include "target.h"

#include "lexer.h"
#include "expression.h"
#include "mtype.h"
#include "dsymbol.h"
Expand Down
1 change: 1 addition & 0 deletions src/enum.h
Expand Up @@ -18,6 +18,7 @@

#include "root.h"
#include "dsymbol.h"
#include "tokens.h"

class Identifier;
class Type;
Expand Down

0 comments on commit 2d0115b

Please sign in to comment.