mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-05-04 09:21:30 +02:00
Merge v2.056
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright (c) 1999-2010 by Digital Mars
|
||||
// Copyright (c) 1999-2011 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "rmem.h"
|
||||
|
||||
#include "stringtable.h"
|
||||
#include "aav.h"
|
||||
|
||||
#include "expression.h"
|
||||
#include "statement.h"
|
||||
@@ -31,7 +31,7 @@ extern int binary(const char *p , const char **tab, int high);
|
||||
* Hash table of array op functions already generated or known about.
|
||||
*/
|
||||
|
||||
StringTable arrayfuncs;
|
||||
AA *arrayfuncs;
|
||||
#endif
|
||||
|
||||
/**********************************************
|
||||
@@ -126,16 +126,17 @@ Expression *BinExp::arrayOp(Scope *sc)
|
||||
|
||||
size_t namelen = buf.offset;
|
||||
buf.writeByte(0);
|
||||
char *name = (char *)buf.extractData();
|
||||
char *name = buf.toChars();
|
||||
Identifier *ident = Lexer::idPool(name);
|
||||
|
||||
/* Look up name in hash table
|
||||
*/
|
||||
#if IN_LLVM
|
||||
StringValue *sv = sc->module->arrayfuncs.update(name, namelen);
|
||||
FuncDeclaration **pfd = (FuncDeclaration **)_aaGet(&sc->module->arrayfuncs, ident);
|
||||
#else
|
||||
StringValue *sv = arrayfuncs.update(name, namelen);
|
||||
FuncDeclaration **pfd = (FuncDeclaration **)_aaGet(&arrayfuncs, ident);
|
||||
#endif
|
||||
FuncDeclaration *fd = (FuncDeclaration *)sv->ptrvalue;
|
||||
FuncDeclaration *fd = (FuncDeclaration *)*pfd;
|
||||
if (!fd)
|
||||
{
|
||||
#if IN_DMD
|
||||
@@ -326,7 +327,7 @@ Expression *BinExp::arrayOp(Scope *sc)
|
||||
|
||||
Parameters *fparams = new Parameters();
|
||||
Expression *loopbody = buildArrayLoop(fparams);
|
||||
Parameter *p = fparams->tdata()[0 /*fparams->dim - 1*/];
|
||||
Parameter *p = (*fparams)[0 /*fparams->dim - 1*/];
|
||||
#if DMDV1
|
||||
// for (size_t i = 0; i < p.length; i++)
|
||||
Initializer *init = new ExpInitializer(0, new IntegerExp(0, 0, Type::tsize_t));
|
||||
@@ -352,7 +353,7 @@ Expression *BinExp::arrayOp(Scope *sc)
|
||||
*/
|
||||
TypeFunction *ftype = new TypeFunction(fparams, type, 0, LINKc);
|
||||
//printf("ftype: %s\n", ftype->toChars());
|
||||
fd = new FuncDeclaration(loc, 0, Lexer::idPool(name), STCundefined, ftype);
|
||||
fd = new FuncDeclaration(loc, 0, ident, STCundefined, ftype);
|
||||
fd->fbody = fbody;
|
||||
fd->protection = PROTpublic;
|
||||
fd->linkage = LINKd;
|
||||
@@ -373,10 +374,10 @@ Expression *BinExp::arrayOp(Scope *sc)
|
||||
else
|
||||
{ /* In library, refer to it.
|
||||
*/
|
||||
fd = FuncDeclaration::genCfunc(type, name);
|
||||
fd = FuncDeclaration::genCfunc(type, ident);
|
||||
}
|
||||
#endif
|
||||
sv->ptrvalue = fd; // cache symbol in hash table
|
||||
*pfd = fd; // cache symbol in hash table
|
||||
}
|
||||
|
||||
/* Call the function fd(arguments)
|
||||
@@ -537,7 +538,7 @@ Expression *AssignExp::buildArrayLoop(Parameters *fparams)
|
||||
ex2 = new CastExp(0, ex2, e1->type->nextOf());
|
||||
#endif
|
||||
Expression *ex1 = e1->buildArrayLoop(fparams);
|
||||
Parameter *param = fparams->tdata()[0];
|
||||
Parameter *param = (*fparams)[0];
|
||||
param->storageClass = 0;
|
||||
Expression *e = new AssignExp(0, ex1, ex2);
|
||||
return e;
|
||||
@@ -550,7 +551,7 @@ Expression *Str##AssignExp::buildArrayLoop(Parameters *fparams) \
|
||||
*/ \
|
||||
Expression *ex2 = e2->buildArrayLoop(fparams); \
|
||||
Expression *ex1 = e1->buildArrayLoop(fparams); \
|
||||
Parameter *param = fparams->tdata()[0]; \
|
||||
Parameter *param = (*fparams)[0]; \
|
||||
param->storageClass = 0; \
|
||||
Expression *e = new Str##AssignExp(0, ex1, ex2); \
|
||||
return e; \
|
||||
|
||||
Reference in New Issue
Block a user