comparison dmd/mtype.c @ 1640:9bf06e02070b

Merge DMD 1.057.
author Christian Kamm <kamm incasoftware de>
date Mon, 08 Mar 2010 21:39:20 +0100
parents 44b145be2ef5
children
comparison
equal deleted inserted replaced
1639:41145d30acb8 1640:9bf06e02070b
1 1
2 // Compiler implementation of the D programming language 2 // Compiler implementation of the D programming language
3 // Copyright (c) 1999-2009 by Digital Mars 3 // Copyright (c) 1999-2010 by Digital Mars
4 // All Rights Reserved 4 // All Rights Reserved
5 // written by Walter Bright 5 // written by Walter Bright
6 // http://www.digitalmars.com 6 // http://www.digitalmars.com
7 // License for redistribution is by either the Artistic License 7 // License for redistribution is by either the Artistic License
8 // in artistic.txt, or the GNU General Public License in gnu.txt. 8 // in artistic.txt, or the GNU General Public License in gnu.txt.
133 this->next = next; 133 this->next = next;
134 this->deco = NULL; 134 this->deco = NULL;
135 #if DMDV2 135 #if DMDV2
136 this->cto = NULL; 136 this->cto = NULL;
137 this->ito = NULL; 137 this->ito = NULL;
138 this->sto = NULL;
139 this->scto = NULL;
140 this->wto = NULL;
141 this->swto = NULL;
138 #endif 142 #endif
139 this->pto = NULL; 143 this->pto = NULL;
140 this->rto = NULL; 144 this->rto = NULL;
141 this->arrayof = NULL; 145 this->arrayof = NULL;
142 this->vtinfo = NULL; 146 this->vtinfo = NULL;
639 e = new IntegerExp(loc, size(loc), Type::tsize_t); 643 e = new IntegerExp(loc, size(loc), Type::tsize_t);
640 } 644 }
641 else if (ident == Id::size) 645 else if (ident == Id::size)
642 { 646 {
643 error(loc, ".size property should be replaced with .sizeof"); 647 error(loc, ".size property should be replaced with .sizeof");
644 e = new IntegerExp(loc, size(loc), Type::tsize_t); 648 e = new ErrorExp();
645 } 649 }
646 else if (ident == Id::alignof) 650 else if (ident == Id::alignof)
647 { 651 {
648 e = new IntegerExp(loc, alignsize(), Type::tsize_t); 652 e = new IntegerExp(loc, alignsize(), Type::tsize_t);
649 } 653 }
677 Scope sc; 681 Scope sc;
678 e = e->semantic(&sc); 682 e = e->semantic(&sc);
679 } 683 }
680 else 684 else
681 { 685 {
682 error(loc, "no property '%s' for type '%s'", ident->toChars(), toChars()); 686 Dsymbol *s = NULL;
683 e = new IntegerExp(loc, 1, Type::tint32); 687 if (ty == Tstruct || ty == Tclass || ty == Tenum || ty == Ttypedef)
688 s = toDsymbol(NULL);
689 if (s)
690 s = s->search_correct(ident);
691 if (s)
692 error(loc, "no property '%s' for type '%s', did you mean '%s'?", ident->toChars(), toChars(), s->toChars());
693 else
694 error(loc, "no property '%s' for type '%s'", ident->toChars(), toChars());
695 e = new ErrorExp();
684 } 696 }
685 return e; 697 return e;
686 } 698 }
687 699
688 Expression *Type::dotExp(Scope *sc, Expression *e, Identifier *ident) 700 Expression *Type::dotExp(Scope *sc, Expression *e, Identifier *ident)
783 va_end( ap ); 795 va_end( ap );
784 } 796 }
785 797
786 void Type::warning(Loc loc, const char *format, ...) 798 void Type::warning(Loc loc, const char *format, ...)
787 { 799 {
788 if (global.params.warnings && !global.gag) 800 va_list ap;
789 { 801 va_start(ap, format);
790 va_list ap; 802 ::vwarning(loc, format, ap);
791 va_start(ap, format); 803 va_end( ap );
792 ::vwarning(loc, format, ap);
793 va_end( ap );
794 }
795 } 804 }
796 805
797 Identifier *Type::getTypeInfoIdent(int internal) 806 Identifier *Type::getTypeInfoIdent(int internal)
798 { 807 {
799 // _init_10TypeInfo_%s 808 // _init_10TypeInfo_%s
4628 } 4637 }
4629 4638
4630 TemplateInstance *ti = s->isTemplateInstance(); 4639 TemplateInstance *ti = s->isTemplateInstance();
4631 if (ti) 4640 if (ti)
4632 { if (!ti->semanticRun) 4641 { if (!ti->semanticRun)
4642 {
4643 if (global.errors)
4644 return new ErrorExp(); // TemplateInstance::semantic() will fail anyway
4633 ti->semantic(sc); 4645 ti->semantic(sc);
4646 }
4634 s = ti->inst->toAlias(); 4647 s = ti->inst->toAlias();
4635 if (!s->isTemplateInstance()) 4648 if (!s->isTemplateInstance())
4636 goto L1; 4649 goto L1;
4637 Expression *de = new DotExp(e->loc, e, new ScopeExp(e->loc, ti)); 4650 Expression *de = new DotExp(e->loc, e, new ScopeExp(e->loc, ti));
4638 de->type = e->type; 4651 de->type = e->type;
5069 } 5082 }
5070 5083
5071 TemplateInstance *ti = s->isTemplateInstance(); 5084 TemplateInstance *ti = s->isTemplateInstance();
5072 if (ti) 5085 if (ti)
5073 { if (!ti->semanticRun) 5086 { if (!ti->semanticRun)
5087 {
5088 if (global.errors)
5089 return new ErrorExp(); // TemplateInstance::semantic() will fail anyway
5074 ti->semantic(sc); 5090 ti->semantic(sc);
5091 }
5075 s = ti->inst->toAlias(); 5092 s = ti->inst->toAlias();
5076 if (!s->isTemplateInstance()) 5093 if (!s->isTemplateInstance())
5077 goto L1; 5094 goto L1;
5078 Expression *de = new DotExp(e->loc, e, new ScopeExp(e->loc, ti)); 5095 Expression *de = new DotExp(e->loc, e, new ScopeExp(e->loc, ti));
5079 de->type = e->type; 5096 de->type = e->type;