Permalink
Browse files

Merge dmd-1.073.

  • Loading branch information...
1 parent 53f9964 commit a23b837ebd2d2ddc8053a55698d14fe89b3eaa75 @redstar redstar committed Feb 23, 2012
Showing with 2,252 additions and 1,330 deletions.
  1. +2 −2 dmd/access.c
  2. +2 −0 dmd/aggregate.h
  3. +165 −0 dmd/apply.c
  4. +1 −1 dmd/arrayop.c
  5. +9 −0 dmd/arraytypes.h
  6. +4 −0 dmd/attrib.c
  7. +4 −0 dmd/cast.c
  8. +17 −0 dmd/class.c
  9. +89 −51 dmd/constfold.c
  10. +1 −0 dmd/declaration.c
  11. +9 −11 dmd/declaration.h
  12. +76 −150 dmd/delegatize.c
  13. +6 −6 dmd/doc.c
  14. +13 −10 dmd/dsymbol.c
  15. +2 −2 dmd/dsymbol.h
  16. +213 −93 dmd/expression.c
  17. +38 −40 dmd/expression.h
  18. +79 −13 dmd/func.c
  19. +76 −91 dmd/import.c
  20. +6 −9 dmd/import.h
  21. +8 −6 dmd/init.c
  22. +349 −162 dmd/inline.c
  23. +650 −418 dmd/interpret.c
  24. +23 −12 dmd/lexer.c
  25. +36 −5 dmd/mars.c
  26. +2 −0 dmd/mars.h
  27. +13 −7 dmd/module.c
  28. +56 −48 dmd/mtype.c
  29. +31 −21 dmd/optimize.c
  30. +36 −21 dmd/parse.c
  31. +2 −9 dmd/root/port.c
  32. +34 −0 dmd/sideeffect.c
  33. +83 −93 dmd/statement.c
  34. +20 −8 dmd/statement.h
  35. +7 −2 dmd/staticassert.c
  36. +17 −11 dmd/struct.c
  37. +72 −27 dmd/template.c
  38. +1 −1 dmd/template.h
View
@@ -1,5 +1,5 @@
-// 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
@@ -91,7 +91,7 @@ enum PROT ClassDeclaration::getAccess(Dsymbol *smember)
break;
case PROTprivate:
- access = PROTnone; // private members of base class not accessible
+ access_ret = PROTnone; // private members of base class not accessible
break;
case PROTpackage:
View
@@ -105,6 +105,7 @@ struct AggregateDeclaration : ScopeDsymbol
int isDeprecated(); // is aggregate deprecated?
FuncDeclaration *buildDtor(Scope *sc);
int isNested();
+ int isExport();
void emitComment(Scope *sc);
void toJsonBuffer(OutBuffer *buf);
@@ -275,6 +276,7 @@ struct ClassDeclaration : AggregateDeclaration
virtual int isBaseInfoComplete();
Dsymbol *search(Loc, Identifier *ident, int flags);
+ Dsymbol *searchBase(Loc, Identifier *ident);
#if DMDV2
int isFuncHidden(FuncDeclaration *fd);
#endif
View
@@ -0,0 +1,165 @@
+
+// Compiler implementation of the D programming language
+// Copyright (c) 1999-2011 by Digital Mars
+// All Rights Reserved
+// written by Walter Bright
+// http://www.digitalmars.com
+// License for redistribution is by either the Artistic License
+// in artistic.txt, or the GNU General Public License in gnu.txt.
+// See the included readme.txt for details.
+
+#include <stdio.h>
+#include <assert.h>
+
+#include "mars.h"
+#include "expression.h"
+
+
+/**************************************
+ * An Expression tree walker that will visit each Expression e in the tree,
+ * in depth-first evaluation order, and call fp(e,param) on it.
+ * fp() signals whether the walking continues with its return value:
+ * Returns:
+ * 0 continue
+ * 1 done
+ * It's a bit slower than using virtual functions, but more encapsulated and less brittle.
+ * Creating an iterator for this would be much more complex.
+ */
+
+typedef int (*fp_t)(Expression *, void *);
+
+int Expression::apply(fp_t fp, void *param)
+{
+ return (*fp)(this, param);
+}
+
+/******************************
+ * Perform apply() on an array of Expressions.
+ */
+
+int arrayExpressionApply(Expressions *a, fp_t fp, void *param)
+{
+ //printf("arrayExpressionApply(%p)\n", a);
+ if (a)
+ {
+ for (size_t i = 0; i < a->dim; i++)
+ { Expression *e = (*a)[i];
+
+ if (e)
+ {
+ if (e->apply(fp, param))
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+int NewExp::apply(int (*fp)(Expression *, void *), void *param)
+{
+ //printf("NewExp::apply(): %s\n", toChars());
+
+ return ((thisexp ? thisexp->apply(fp, param) : 0) ||
+ arrayExpressionApply(newargs, fp, param) ||
+ arrayExpressionApply(arguments, fp, param) ||
+ (*fp)(this, param));
+}
+
+int NewAnonClassExp::apply(int (*fp)(Expression *, void *), void *param)
+{
+ //printf("NewAnonClassExp::apply(): %s\n", toChars());
+
+ return ((thisexp ? thisexp->apply(fp, param) : 0) ||
+ arrayExpressionApply(newargs, fp, param) ||
+ arrayExpressionApply(arguments, fp, param) ||
+ (*fp)(this, param));
+}
+
+int UnaExp::apply(fp_t fp, void *param)
+{
+ return e1->apply(fp, param) ||
+ (*fp)(this, param);
+}
+
+int BinExp::apply(fp_t fp, void *param)
+{
+ return e1->apply(fp, param) ||
+ e2->apply(fp, param) ||
+ (*fp)(this, param);
+}
+
+int AssertExp::apply(fp_t fp, void *param)
+{
+ //printf("CallExp::apply(fp_t fp, void *param): %s\n", toChars());
+ return e1->apply(fp, param) ||
+ (msg ? msg->apply(fp, param) : 0) ||
+ (*fp)(this, param);
+}
+
+
+int CallExp::apply(fp_t fp, void *param)
+{
+ //printf("CallExp::apply(fp_t fp, void *param): %s\n", toChars());
+ return e1->apply(fp, param) ||
+ arrayExpressionApply(arguments, fp, param) ||
+ (*fp)(this, param);
+}
+
+
+int ArrayExp::apply(fp_t fp, void *param)
+{
+ //printf("ArrayExp::apply(fp_t fp, void *param): %s\n", toChars());
+ return e1->apply(fp, param) ||
+ arrayExpressionApply(arguments, fp, param) ||
+ (*fp)(this, param);
+}
+
+
+int SliceExp::apply(fp_t fp, void *param)
+{
+ return e1->apply(fp, param) ||
+ (lwr ? lwr->apply(fp, param) : 0) ||
+ (upr ? upr->apply(fp, param) : 0) ||
+ (*fp)(this, param);
+}
+
+
+int ArrayLiteralExp::apply(fp_t fp, void *param)
+{
+ return arrayExpressionApply(elements, fp, param) ||
+ (*fp)(this, param);
+}
+
+
+int AssocArrayLiteralExp::apply(fp_t fp, void *param)
+{
+ return arrayExpressionApply(keys, fp, param) ||
+ arrayExpressionApply(values, fp, param) ||
+ (*fp)(this, param);
+}
+
+
+int StructLiteralExp::apply(fp_t fp, void *param)
+{
+ return arrayExpressionApply(elements, fp, param) ||
+ (*fp)(this, param);
+}
+
+
+int TupleExp::apply(fp_t fp, void *param)
+{
+ return arrayExpressionApply(exps, fp, param) ||
+ (*fp)(this, param);
+}
+
+
+int CondExp::apply(fp_t fp, void *param)
+{
+ return econd->apply(fp, param) ||
+ e1->apply(fp, param) ||
+ e2->apply(fp, param) ||
+ (*fp)(this, param);
+}
+
+
+
View
@@ -551,7 +551,7 @@ Expression *Str##AssignExp::buildArrayLoop(Parameters *fparams) \
Expression *ex1 = e1->buildArrayLoop(fparams); \
Parameter *param = (*fparams)[0]; \
param->storageClass = 0; \
- Expression *e = new Str##AssignExp(0, ex1, ex2); \
+ Expression *e = new Str##AssignExp(loc, ex1, ex2); \
return e; \
}
View
@@ -53,12 +53,21 @@ typedef ArrayBase<struct VarDeclaration> VarDeclarations;
typedef ArrayBase<struct Type> Types;
typedef ArrayBase<struct ScopeDsymbol> ScopeDsymbols;
+
+typedef ArrayBase<struct Catch> Catches;
+
typedef ArrayBase<struct StaticDtorDeclaration> StaticDtorDeclarations;
typedef ArrayBase<struct SharedStaticDtorDeclaration> SharedStaticDtorDeclarations;
typedef ArrayBase<struct Module> Modules;
typedef ArrayBase<struct CaseStatement> CaseStatements;
+
+typedef ArrayBase<struct CompoundStatement> CompoundStatements;
+
+typedef ArrayBase<struct GotoCaseStatement> GotoCaseStatements;
+
typedef ArrayBase<struct TemplateInstance> TemplateInstances;
+typedef ArrayBase<struct block> Blocks;
typedef ArrayBase<struct Symbol> Symbols;
View
@@ -1142,6 +1142,7 @@ void PragmaDeclaration::semantic(Scope *sc)
else
error("unrecognized pragma(%s)", ident->toChars());
+Ldecl:
if (decl)
{
for (unsigned i = 0; i < decl->dim; i++)
@@ -1159,7 +1160,10 @@ void PragmaDeclaration::semantic(Scope *sc)
Lnodecl:
if (decl)
+ {
error("pragma is missing closing ';'");
+ goto Ldecl; // do them anyway, to avoid segfaults.
+ }
}
int PragmaDeclaration::oneMember(Dsymbol **ps)
View
@@ -1451,10 +1451,14 @@ Expression *BinExp::typeCombine(Scope *sc)
}
else if ((t1->ty == Tsarray || t1->ty == Tarray) && t1->implicitConvTo(t2))
{
+ if (t1->ty == Tsarray && e2->op == TOKarrayliteral)
+ goto Lt1;
goto Lt2;
}
else if ((t2->ty == Tsarray || t2->ty == Tarray) && t2->implicitConvTo(t1))
{
+ if (t2->ty == Tsarray && e1->op == TOKarrayliteral)
+ goto Lt2;
goto Lt1;
}
else if (t1->ty == Tclass || t2->ty == Tclass)
View
@@ -898,6 +898,23 @@ Dsymbol *ClassDeclaration::search(Loc loc, Identifier *ident, int flags)
return s;
}
+Dsymbol *ClassDeclaration::searchBase(Loc loc, Identifier *ident)
+{
+ // Search bases classes in depth-first, left to right order
+
+ for (size_t i = 0; i < baseclasses->dim; i++)
+ {
+ BaseClass *b = (*baseclasses)[i];
+ Dsymbol *cdb = b->type->isClassHandle();
+ if (cdb->ident->equals(ident))
+ return cdb;
+ cdb = ((ClassDeclaration *)cdb)->searchBase(loc, ident);
+ if (cdb)
+ return cdb;
+ }
+ return NULL;
+}
+
/**********************************************************
* fd is in the vtbl[] for this class.
* Return 1 if function is hidden (not findable through search).
Oops, something went wrong.

0 comments on commit a23b837

Please sign in to comment.