mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-21 06:03:14 +01:00
Merge dmd-1.074 into ldc.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
// Compiler implementation of the D programming language
|
||||
// Copyright (c) 1999-2011 by Digital Mars
|
||||
// Copyright (c) 1999-2012 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -50,6 +50,7 @@ Dsymbol::Dsymbol()
|
||||
this->loc = 0;
|
||||
this->comment = NULL;
|
||||
this->scope = NULL;
|
||||
this->errors = false;
|
||||
#if IN_LLVM
|
||||
this->llvmInternal = LLVMnone;
|
||||
this->irsym = NULL;
|
||||
@@ -69,6 +70,7 @@ Dsymbol::Dsymbol(Identifier *ident)
|
||||
this->loc = 0;
|
||||
this->comment = NULL;
|
||||
this->scope = NULL;
|
||||
this->errors = false;
|
||||
#if IN_LLVM
|
||||
this->llvmInternal = LLVMnone;
|
||||
this->irsym = NULL;
|
||||
@@ -169,6 +171,10 @@ bool Dsymbol::hasStaticCtorOrDtor()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Dsymbol::setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion)
|
||||
{
|
||||
}
|
||||
|
||||
char *Dsymbol::toChars()
|
||||
{
|
||||
return ident ? ident->toChars() : (char *)"__anonymous";
|
||||
@@ -283,6 +289,23 @@ TemplateInstance *Dsymbol::inTemplateInstance()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Check if this function is a member of a template which has only been
|
||||
// instantiated speculatively, eg from inside is(typeof()).
|
||||
// Return the speculative template instance it is part of,
|
||||
// or NULL if not speculative.
|
||||
TemplateInstance *Dsymbol::isSpeculative()
|
||||
{
|
||||
Dsymbol * par = parent;
|
||||
while (par)
|
||||
{
|
||||
TemplateInstance *ti = par->isTemplateInstance();
|
||||
if (ti && ti->speculative)
|
||||
return ti;
|
||||
par = par->toParent();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int Dsymbol::isAnonymous()
|
||||
{
|
||||
return ident ? 0 : 1;
|
||||
@@ -367,11 +390,21 @@ Dsymbol *Dsymbol::search(Loc loc, Identifier *ident, int flags)
|
||||
|
||||
void *symbol_search_fp(void *arg, const char *seed)
|
||||
{
|
||||
/* If not in the lexer's string table, it certainly isn't in the symbol table.
|
||||
* Doing this first is a lot faster.
|
||||
*/
|
||||
size_t len = strlen(seed);
|
||||
if (!len)
|
||||
return NULL;
|
||||
StringValue *sv = Lexer::stringtable.lookup(seed, len);
|
||||
if (!sv)
|
||||
return NULL;
|
||||
Identifier *id = (Identifier *)sv->ptrvalue;
|
||||
assert(id);
|
||||
|
||||
Dsymbol *s = (Dsymbol *)arg;
|
||||
Identifier id(seed, 0);
|
||||
Module::clearCache();
|
||||
s = s->search(0, &id, 4|2);
|
||||
return s;
|
||||
return s->search(0, id, 4|2);
|
||||
}
|
||||
|
||||
Dsymbol *Dsymbol::search_correct(Identifier *ident)
|
||||
@@ -409,7 +442,13 @@ Dsymbol *Dsymbol::searchX(Loc loc, Scope *sc, Identifier *id)
|
||||
id = ti->name;
|
||||
sm = s->search(loc, id, 0);
|
||||
if (!sm)
|
||||
{ error("template identifier %s is not a member of %s %s",
|
||||
{
|
||||
sm = s->search_correct(id);
|
||||
if (sm)
|
||||
error("template identifier '%s' is not a member of '%s %s', did you mean '%s %s'?",
|
||||
id->toChars(), s->kind(), s->toChars(), sm->kind(), sm->toChars());
|
||||
else
|
||||
error("template identifier '%s' is not a member of '%s %s'",
|
||||
id->toChars(), s->kind(), s->toChars());
|
||||
return NULL;
|
||||
}
|
||||
@@ -495,6 +534,11 @@ int Dsymbol::isOverloadable()
|
||||
}
|
||||
#endif
|
||||
|
||||
int Dsymbol::hasOverloads()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
LabelDsymbol *Dsymbol::isLabel() // is this a LabelDsymbol()?
|
||||
{
|
||||
return NULL;
|
||||
@@ -518,6 +562,11 @@ int Dsymbol::needThis()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int Dsymbol::apply(Dsymbol_apply_ft_t fp, void *param)
|
||||
{
|
||||
return (*fp)(this, param);
|
||||
}
|
||||
|
||||
int Dsymbol::addMember(Scope *sc, ScopeDsymbol *sd, int memnum)
|
||||
{
|
||||
//printf("Dsymbol::addMember('%s')\n", toChars());
|
||||
@@ -634,19 +683,16 @@ void Dsymbol::checkDeprecated(Loc loc, Scope *sc)
|
||||
|
||||
Module *Dsymbol::getModule()
|
||||
{
|
||||
Module *m;
|
||||
Dsymbol *s;
|
||||
|
||||
//printf("Dsymbol::getModule()\n");
|
||||
TemplateDeclaration *td = getFuncTemplateDecl(this);
|
||||
if (td)
|
||||
return td->getModule();
|
||||
|
||||
s = this;
|
||||
Dsymbol *s = this;
|
||||
while (s)
|
||||
{
|
||||
//printf("\ts = '%s'\n", s->toChars());
|
||||
m = s->isModule();
|
||||
//printf("\ts = %s '%s'\n", s->kind(), s->toPrettyChars());
|
||||
Module *m = s->isModule();
|
||||
if (m)
|
||||
return m;
|
||||
s = s->parent;
|
||||
|
||||
Reference in New Issue
Block a user