From 6992a16220e18518734e7b618a9b953b23059632 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Fri, 22 Apr 2011 18:26:44 +0200 Subject: [PATCH] Merged DMD commit 9a4c24659dd76f64cf9faf5f5d159c9c365d1b91: lots of 64 bit mods The original commit contained a few front-end changes which are merged here. Also bumps the DMDFE version to 1.066. --- dmd/expression.c | 15 ++++++++++++--- dmd/mars.c | 2 +- dmd/mtype.c | 14 +++++++++----- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/dmd/expression.c b/dmd/expression.c index f9e95cb1..61555d1f 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -1571,6 +1571,7 @@ void IntegerExp::toMangleBuffer(OutBuffer *buf) ErrorExp::ErrorExp() : IntegerExp(0, 0, Type::terror) { + op = TOKerror; } void ErrorExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) @@ -4948,14 +4949,16 @@ Expression *BinExp::semantic(Scope *sc) !(op == TOKassign && e1->op == TOKdottd)) // a.template = e2 { error("%s has no value", e1->toChars()); - e1->type = Type::terror; + e1 = new ErrorExp(); } e2 = e2->semantic(sc); if (!e2->type) { error("%s has no value", e2->toChars()); - e2->type = Type::terror; + e2 = new ErrorExp(); } + if (e1->op == TOKerror || e2->op == TOKerror) + return new ErrorExp(); return this; } @@ -7902,6 +7905,8 @@ Expression *IndexExp::semantic(Scope *sc) if (!e1->type) e1 = e1->semantic(sc); assert(e1->type); // semantic() should already be run on it + if (e1->op == TOKerror) + goto Lerr; e = this; // Note that unlike C we do not implement the int[ptr] @@ -8007,6 +8012,8 @@ Expression *IndexExp::semantic(Scope *sc) } default: + if (e1->op == TOKerror) + goto Lerr; error("%s must be an array or pointer type, not %s", e1->toChars(), e1->type->toChars()); case Terror: @@ -8212,7 +8219,9 @@ Expression *AssignExp::semantic(Scope *sc) } } - BinExp::semantic(sc); + Expression *e = BinExp::semantic(sc); + if (e->op == TOKerror) + return e; if (e1->op == TOKdottd) { // Rewrite a.b=e2, when b is a template, as a.b(e2) diff --git a/dmd/mars.c b/dmd/mars.c index 7ae9a688..a90c0930 100644 --- a/dmd/mars.c +++ b/dmd/mars.c @@ -59,7 +59,7 @@ Global::Global() copyright = "Copyright (c) 1999-2010 by Digital Mars and Tomas Lindquist Olsen"; written = "written by Walter Bright and Tomas Lindquist Olsen"; - version = "v1.064"; + version = "v1.066"; ldc_version = "LDC trunk"; llvm_version = "LLVM 2.9"; global.structalign = 8; diff --git a/dmd/mtype.c b/dmd/mtype.c index 0a33579c..db3de6b9 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -253,7 +253,7 @@ void Type::init() Tfloat32, Tfloat64, Tfloat80, Timaginary32, Timaginary64, Timaginary80, Tcomplex32, Tcomplex64, Tcomplex80, - Tbit, Tbool, + Tbool, Tascii, Twchar, Tdchar }; for (i = 0; i < sizeof(basetab) / sizeof(basetab[0]); i++) @@ -690,10 +690,13 @@ Expression *Type::getProperty(Loc loc, Identifier *ident) s = toDsymbol(NULL); if (s) s = s->search_correct(ident); - if (s) - error(loc, "no property '%s' for type '%s', did you mean '%s'?", ident->toChars(), toChars(), s->toChars()); - else - error(loc, "no property '%s' for type '%s'", ident->toChars(), toChars()); + if (this != Type::terror) + { + if (s) + error(loc, "no property '%s' for type '%s', did you mean '%s'?", ident->toChars(), toChars(), s->toChars()); + else + error(loc, "no property '%s' for type '%s'", ident->toChars(), toChars()); + } e = new ErrorExp(); } return e; @@ -1012,6 +1015,7 @@ TypeBasic::TypeBasic(TY ty) case Tbit: d = Token::toChars(TOKbit); c = "bit"; flags |= TFLAGSintegral | TFLAGSunsigned; +assert(0); break; case Tbool: d = "bool";