Changeset 459
- Timestamp:
- 04/12/07 03:10:35 (2 years ago)
- Files:
-
- trunk/rebuild/access.c (modified) (1 diff)
- trunk/rebuild/aggregate.h (modified) (1 diff)
- trunk/rebuild/arraytypes.h (modified) (1 diff)
- trunk/rebuild/attrib.c (modified) (1 diff)
- trunk/rebuild/attrib.h (modified) (1 diff)
- trunk/rebuild/cast.c (modified) (2 diffs)
- trunk/rebuild/class.c (modified) (3 diffs)
- trunk/rebuild/complex_t.h (modified) (1 diff)
- trunk/rebuild/cond.c (modified) (1 diff)
- trunk/rebuild/cond.h (modified) (1 diff)
- trunk/rebuild/constfold.c (modified) (2 diffs)
- trunk/rebuild/declaration.c (modified) (10 diffs)
- trunk/rebuild/declaration.h (modified) (4 diffs)
- trunk/rebuild/delegatize.c (modified) (1 diff)
- trunk/rebuild/doc.c (modified) (1 diff)
- trunk/rebuild/doc.h (modified) (1 diff)
- trunk/rebuild/dsymbol.c (modified) (4 diffs)
- trunk/rebuild/dsymbol.h (modified) (2 diffs)
- trunk/rebuild/dump.c (modified) (1 diff)
- trunk/rebuild/entity.c (modified) (1 diff)
- trunk/rebuild/enum.c (modified) (1 diff)
- trunk/rebuild/enum.h (modified) (1 diff)
- trunk/rebuild/expression.c (modified) (22 diffs)
- trunk/rebuild/expression.h (modified) (1 diff)
- trunk/rebuild/func.c (modified) (6 diffs)
- trunk/rebuild/hdrgen.c (modified) (1 diff)
- trunk/rebuild/hdrgen.h (modified) (1 diff)
- trunk/rebuild/html.c (modified) (1 diff)
- trunk/rebuild/html.h (modified) (1 diff)
- trunk/rebuild/identifier.c (modified) (1 diff)
- trunk/rebuild/identifier.h (modified) (1 diff)
- trunk/rebuild/idgen.c (modified) (1 diff)
- trunk/rebuild/impcnvgen.c (modified) (1 diff)
- trunk/rebuild/import.c (modified) (1 diff)
- trunk/rebuild/import.h (modified) (1 diff)
- trunk/rebuild/inifile.c (modified) (1 diff)
- trunk/rebuild/init.c (modified) (3 diffs)
- trunk/rebuild/init.h (modified) (1 diff)
- trunk/rebuild/inline.c (modified) (3 diffs)
- trunk/rebuild/interpret.c (modified) (18 diffs)
- trunk/rebuild/lexer.c (modified) (3 diffs)
- trunk/rebuild/lexer.h (modified) (2 diffs)
- trunk/rebuild/link.c (modified) (1 diff)
- trunk/rebuild/macro.c (modified) (1 diff)
- trunk/rebuild/macro.h (modified) (1 diff)
- trunk/rebuild/mangle.c (modified) (1 diff)
- trunk/rebuild/mars.c (modified) (4 diffs)
- trunk/rebuild/mars.h (modified) (1 diff)
- trunk/rebuild/module.c (modified) (1 diff)
- trunk/rebuild/module.h (modified) (1 diff)
- trunk/rebuild/mtype.c (modified) (26 diffs)
- trunk/rebuild/mtype.h (modified) (2 diffs)
- trunk/rebuild/opover.c (modified) (2 diffs)
- trunk/rebuild/optimize.c (modified) (3 diffs)
- trunk/rebuild/parse.c (modified) (22 diffs)
- trunk/rebuild/parse.h (modified) (3 diffs)
- trunk/rebuild/scope.c (modified) (3 diffs)
- trunk/rebuild/scope.h (modified) (2 diffs)
- trunk/rebuild/statement.c (modified) (14 diffs)
- trunk/rebuild/statement.h (modified) (1 diff)
- trunk/rebuild/staticassert.c (modified) (1 diff)
- trunk/rebuild/staticassert.h (modified) (1 diff)
- trunk/rebuild/struct.c (modified) (3 diffs)
- trunk/rebuild/template.c (modified) (30 diffs)
- trunk/rebuild/template.h (modified) (5 diffs)
- trunk/rebuild/total.h (modified) (1 diff)
- trunk/rebuild/unialpha.c (modified) (1 diff)
- trunk/rebuild/utf.c (modified) (1 diff)
- trunk/rebuild/utf.h (modified) (1 diff)
- trunk/rebuild/version.c (modified) (1 diff)
- trunk/rebuild/version.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rebuild/access.c
r297 r459 3 3 // All Rights Reserved 4 4 // written by Walter Bright 5 // www.digitalmars.com5 // http://www.digitalmars.com 6 6 // License for redistribution is by either the Artistic License 7 7 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/aggregate.h
r446 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/arraytypes.h
r363 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/attrib.c
r416 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/attrib.h
r317 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/cast.c
r311 r459 3 3 // All Rights Reserved 4 4 // written by Walter Bright 5 // www.digitalmars.com5 // http://www.digitalmars.com 6 6 // License for redistribution is by either the Artistic License 7 7 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 899 899 Type *tb = t->toBasetype(); 900 900 if ((tb->ty == Tarray || tb->ty == Tsarray) && 901 (typeb->ty == Tarray || typeb->ty == Tsarray)) 901 (typeb->ty == Tarray || typeb->ty == Tsarray) && 902 tb->next->toBasetype()->ty != Tvoid) 902 903 { 903 904 if (tb->ty == Tsarray) trunk/rebuild/class.c
r446 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 395 395 if (baseClass) 396 396 { 397 if (baseClass->storage_class & STCfinal) 398 error("cannot inherit from final class %s", baseClass->toChars()); 399 397 400 interfaces_dim--; 398 401 interfaces++; … … 482 485 483 486 sc = sc->push(this); 484 sc->stc &= ~(STCauto | STCscope | STCstatic | STCabstract | STCdeprecated); 487 sc->stc &= ~(STCfinal | STCauto | STCscope | STCstatic | 488 STCabstract | STCdeprecated); 485 489 sc->parent = this; 486 490 sc->inunion = 0; trunk/rebuild/complex_t.h
r272 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright and Burton Radons 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/cond.c
r416 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/cond.h
r272 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/constfold.c
r416 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 1076 1076 } 1077 1077 } 1078 else if (e1->type->toBasetype()->ty == Tarray && e2->op == TOKint64) 1079 { 1080 uinteger_t i = e2->toInteger(); 1081 1082 if (e1->op == TOKarrayliteral && !e1->checkSideEffect(2)) 1083 { ArrayLiteralExp *ale = (ArrayLiteralExp *)e1; 1084 if (i >= ale->elements->dim) 1085 { e2->error("array index %ju is out of bounds %s[0 .. %u]", i, e1->toChars(), ale->elements->dim); 1086 } 1087 else 1088 { e = (Expression *)ale->elements->data[i]; 1089 e->type = type; 1090 } 1091 } 1092 } 1078 1093 return e; 1079 1094 } trunk/rebuild/declaration.c
r446 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 138 138 char *name = (char *)buf.extractData(); 139 139 Identifier *id = new Identifier(name, TOKidentifier); 140 Argument *arg = new Argument( In, t, id, NULL);140 Argument *arg = new Argument(STCin, t, id, NULL); 141 141 #else 142 Argument *arg = new Argument( In, t, NULL, NULL);142 Argument *arg = new Argument(STCin, t, NULL, NULL); 143 143 #endif 144 144 args->data[i] = (void *)arg; … … 373 373 374 374 Dsymbol *s; 375 376 if (type->ty == Tident) 377 { 378 TypeIdentifier *ti = (TypeIdentifier *)type; 379 380 s = ti->toDsymbol(sc); 381 if (s) 382 goto L2; // it's a symbolic alias 383 } 384 else if (type->ty == Tinstance) 385 { 386 // Handle forms like: 387 // alias instance TFoo(int).bar.abc def; 388 389 TypeInstance *ti = (TypeInstance *)type; 390 391 s = ti->tempinst; 392 if (s) 393 { 394 s->semantic(sc); 395 s = s->toAlias(); 396 if (sc->parent->isFuncDeclaration()) 397 s->semantic2(sc); 398 399 for (int i = 0; i < ti->idents.dim; i++) 400 { Identifier *id; 401 402 id = (Identifier *)ti->idents.data[i]; 403 s = s->search(loc, id, 0); 404 if (!s) // failed to find a symbol 405 goto L1; // it must be a type 406 s = s->toAlias(); 407 } 375 Type *t; 376 Expression *e; 377 378 /* This section is needed because resolve() will: 379 * const x = 3; 380 * alias x y; 381 * try to alias y to 3. 382 */ 383 s = type->toDsymbol(sc); 384 if (s) 385 goto L2; // it's a symbolic alias 386 387 //printf("alias type is %s\n", type->toChars()); 388 type->resolve(loc, sc, &e, &t, &s); 389 if (s) 390 { 391 goto L2; 392 } 393 else if (e) 394 { 395 // Try to convert Expression to Dsymbol 396 if (e->op == TOKvar) 397 { s = ((VarExp *)e)->var; 408 398 goto L2; 409 399 } 410 } 411 L1: 400 else if (e->op == TOKfunction) 401 { s = ((FuncExp *)e)->fd; 402 goto L2; 403 } 404 else 405 { //error("cannot alias an expression %s", e->toChars()); 406 t = e->type; 407 } 408 } 409 else if (t) 410 type = t; 412 411 if (overnext) 413 412 ScopeDsymbol::multiplyDefined(0, this, overnext); 414 type = type->semantic(loc, sc);415 413 this->inSemantic = 0; 416 414 return; 417 415 418 416 L2: 417 //printf("alias is a symbol %s %s\n", s->kind(), s->toChars()); 419 418 type = NULL; 420 419 VarDeclaration *v = s->isVarDeclaration(); … … 426 425 else 427 426 { 428 FuncDeclaration *f = s-> isFuncDeclaration();427 FuncDeclaration *f = s->toAlias()->isFuncDeclaration(); 429 428 if (f) 430 429 { … … 480 479 Dsymbol *AliasDeclaration::toAlias() 481 480 { 482 //printf("AliasDeclaration::toAlias('%s', this = %p, aliassym = %p, kind = '%s')\n", toChars(), this, aliassym, aliassym ->kind());481 //printf("AliasDeclaration::toAlias('%s', this = %p, aliassym = %p, kind = '%s')\n", toChars(), this, aliassym, aliassym ? aliassym->kind() : ""); 483 482 assert(this != aliassym); 484 483 //static int count; if (++count == 10) *(char*)0=0; … … 549 548 aliassym = NULL; 550 549 onstack = 0; 550 canassign = 0; 551 551 value = NULL; 552 552 } … … 692 692 storage_class = (storage_class & ~STCconst) | STCctorinit; 693 693 694 if (isConst() )694 if (isConst() || isFinal()) 695 695 { 696 696 } … … 752 752 if (type->isauto() && !noauto) 753 753 { 754 if (storage_class & (STCfield | STCout| STCstatic) || !fd)755 { 756 //error("globals, statics, fields, inoutand out parameters cannot be auto");757 } 754 /* if (storage_class & (STCfield | STCout | STCref | STCstatic) || !fd) 755 { 756 error("globals, statics, fields, ref and out parameters cannot be auto"); 757 } */ 758 758 759 759 if (!(storage_class & (STCauto | STCscope))) … … 869 869 } 870 870 ei->exp = new AssignExp(loc, e1, ei->exp); 871 ei->exp->op = TOKconstruct; 872 canassign++; 871 873 ei->exp = ei->exp->semantic(sc); 874 canassign--; 872 875 ei->exp->optimize(WANTvalue); 873 876 } … … 881 884 } 882 885 } 883 else if (isConst() )886 else if (isConst() || isFinal()) 884 887 { 885 888 /* Because we may need the results of a const declaration in a trunk/rebuild/declaration.h
r416 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 61 61 STCtemplateparameter = 0x40000, // template parameter 62 62 STCscope = 0x80000, // template parameter 63 STCinvariant = 0x100000, 64 STCref = 0x200000, 63 65 }; 64 66 … … 111 113 int isIn() { return storage_class & STCin; } 112 114 int isOut() { return storage_class & STCout; } 113 int is InOut() { return (storage_class & (STCin | STCout)) == (STCin | STCout); }115 int isRef() { return storage_class & STCref; } 114 116 115 117 enum PROT prot(); … … 209 211 int onstack; // 1: it has been allocated on the stack 210 212 // 2: on stack, run destructor anyway 213 int canassign; // it can be assigned to 211 214 Dsymbol *aliassym; // if redone as alias to another symbol 212 215 Expression *value; // when interpreting, this is the value trunk/rebuild/delegatize.c
r272 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/doc.c
r446 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/doc.h
r272 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/dsymbol.c
r446 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 28 28 #include "init.h" 29 29 #include "import.h" 30 #include "template.h" 30 31 31 32 /****************************** Dsymbol ******************************/ … … 264 265 //printf("Dsymbol::search(this=%p,%s, ident='%s')\n", this, toChars(), ident->toChars()); 265 266 return NULL; 266 // error("%s.%s is undefined",toChars(), ident->toChars()); 267 // return this; 267 } 268 269 /*************************************** 270 * Search for identifier id as a member of 'this'. 271 * id may be a template instance. 272 * Returns: 273 * symbol found, NULL if not 274 */ 275 276 Dsymbol *Dsymbol::searchX(Loc loc, Scope *sc, Identifier *id) 277 { 278 //printf("Dsymbol::searchX(this=%p,%s, ident='%s')\n", this, toChars(), ident->toChars()); 279 Dsymbol *s = toAlias(); 280 Dsymbol *sm; 281 282 switch (id->dyncast()) 283 { 284 case DYNCAST_IDENTIFIER: 285 sm = s->search(loc, id, 0); 286 break; 287 288 case DYNCAST_DSYMBOL: 289 { // It's a template instance 290 //printf("\ttemplate instance id\n"); 291 Dsymbol *st = (Dsymbol *)id; 292 TemplateInstance *ti = st->isTemplateInstance(); 293 id = ti->name; 294 sm = s->search(loc, id, 0); 295 if (!sm) 296 { error("template identifier %s is not a member of %s %s", 297 id->toChars(), s->kind(), s->toChars()); 298 return NULL; 299 } 300 sm = sm->toAlias(); 301 TemplateDeclaration *td = sm->isTemplateDeclaration(); 302 if (!td) 303 { 304 error("%s is not a template, it is a %s", id->toChars(), sm->kind()); 305 return NULL; 306 } 307 ti->tempdecl = td; 308 if (!ti->semanticdone) 309 ti->semantic(sc); 310 sm = ti->toAlias(); 311 break; 312 } 313 314 default: 315 assert(0); 316 } 317 return sm; 268 318 } 269 319 … … 680 730 else 681 731 { 682 s1->error(loc, "conflicts with %s at %s", 732 s1->error(loc, "conflicts with %s %s at %s", 733 s2->kind(), 683 734 s2->toPrettyChars(), 684 735 s2->locToChars()); 685 736 } */ 686 //*(char*)0=0;687 737 } 688 738 trunk/rebuild/dsymbol.h
r311 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 124 124 virtual void inlineScan(); 125 125 virtual Dsymbol *search(Loc loc, Identifier *ident, int flags); 126 Dsymbol *searchX(Loc loc, Scope *sc, Identifier *id); 126 127 virtual int overloadInsert(Dsymbol *s); 127 128 #ifdef _DH trunk/rebuild/dump.c
r272 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/entity.c
r297 r459 3 3 // All Rights Reserved 4 4 // written by Walter Bright 5 // www.digitalmars.com5 // http://www.digitalmars.com 6 6 // License for redistribution is by either the Artistic License 7 7 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/enum.c
r272 r459 3 3 // All Rights Reserved 4 4 // written by Walter Bright 5 // www.digitalmars.com5 // http://www.digitalmars.com 6 6 // License for redistribution is by either the Artistic License 7 7 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/enum.h
r272 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/expression.c
r446 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 499 499 500 500 L1: 501 if (!(p-> inout == Lazy && p->type->ty == Tvoid))501 if (!(p->storageClass & STClazy && p->type->ty == Tvoid)) 502 502 arg = arg->implicitCastTo(sc, p->type); 503 if (p-> inout == Out || p->inout == InOut)503 if (p->storageClass & (STCout | STCref)) 504 504 { 505 // BUG: should check that argument to inoutis type 'invariant'506 // BUG: assignments to inoutshould also be type 'invariant'505 // BUG: should check that argument to ref is type 'invariant' 506 // BUG: assignments to ref should also be type 'invariant' 507 507 arg = arg->modifiableLvalue(sc, NULL); 508 508 509 509 //if (arg->op == TOKslice) 510 510 //arg->error("cannot modify slice %s", arg->toChars()); 511 512 // Don't have a way yet to do a pointer to a bit in array513 /*if (arg->op == TOKarray &&514 arg->type->toBasetype()->ty == Tbit)515 error("cannot have out or inout argument of bit in array"); */516 511 } 517 512 … … 524 519 525 520 // Convert lazy argument to a delegate 526 if (p-> inout == Lazy)521 if (p->storageClass & STClazy) 527 522 { 528 523 arg = arg->toDelegate(sc, p->type); … … 1619 1614 if (ti && 1620 1615 !ti->isTemplateMixin() && 1621 (ti-> idents.data[ti->idents.dim - 1]== f->ident ||1616 (ti->name == f->ident || 1622 1617 ti->toAlias()->ident == f->ident) 1623 1618 && … … 2398 2393 { 2399 2394 p = utf_decodeWchar((unsigned short *)string, len, &u, &c); 2400 if (p) 2401 error("%s", p);2395 if (p) 0; 2396 //error("%s", p); 2402 2397 else 2403 2398 tmp.writeUTF8(c); … … 2411 2406 { 2412 2407 c = ((unsigned *)string)[u]; 2413 if (!utf_isValidDchar(c)) 2414 error("invalid UCS-32 char \\U%08x", c);2408 if (!utf_isValidDchar(c)) 0; 2409 //error("invalid UCS-32 char \\U%08x", c); 2415 2410 else 2416 2411 tmp.writeUTF8(c); … … 2825 2820 error("e.new is only for allocating nested classes"); */ 2826 2821 } 2827 else if (thisexp)2828 error("e.new is only for allocating nested classes"); 2822 /* else if (thisexp) 2823 error("e.new is only for allocating nested classes"); */ 2829 2824 2830 2825 FuncDeclaration *f = cd->ctor; … … 3199 3194 synerr(EM_lvalue); // lvalue expected 3200 3195 #endif 3201 /* if (var->storage_class & STClazy)3196 /* if (var->storage_class & STClazy) 3202 3197 error("lazy variables cannot be lvalues"); */ 3203 3198 return this; … … 3207 3202 { 3208 3203 //printf("VarExp::modifiableLvalue('%s')\n", var->toChars()); 3209 /* if (sc->incontract && var->isParameter())3204 /* if (sc->incontract && var->isParameter()) 3210 3205 error("cannot modify parameter '%s' in contract", var->toChars()); 3211 3206 3212 3207 if (type && type->toBasetype()->ty == Tsarray) 3213 error("cannot change reference to static array '%s'", var->toChars()); 3214 3215 if (var->isConst()) 3216 error("cannot modify const variable '%s'", var->toChars()); */ 3208 error("cannot change reference to static array '%s'", var->toChars()); */ 3209 3210 VarDeclaration *v = var->isVarDeclaration(); 3211 /* if (v && v->canassign == 0 && (var->isConst() || var->isFinal())) 3212 error("cannot modify final variable '%s'", var->toChars()); */ 3217 3213 3218 3214 if (var->isCtorinit()) … … 3705 3701 for (size_t i = 0; i < cd->baseclasses.dim; i++) 3706 3702 { BaseClass *b = (BaseClass *)cd->baseclasses.data[i]; 3707 args->push(new Argument( In, b->type, NULL, NULL));3703 args->push(new Argument(STCin, b->type, NULL, NULL)); 3708 3704 } 3709 3705 tded = new TypeTuple(args); … … 3738 3734 { Argument *arg = Argument::getNth(params, i); 3739 3735 assert(arg && arg->type); 3740 args->push(new Argument(arg-> inout, arg->type, NULL, NULL));3736 args->push(new Argument(arg->storageClass, arg->type, NULL, NULL)); 3741 3737 } 3742 3738 tded = new TypeTuple(args); … … 4048 4044 Expression *CompileExp::semantic(Scope *sc) 4049 4045 { 4050 #if LOGSEMANTIC4046 #if 1 || LOGSEMANTIC 4051 4047 printf("CompileExp::semantic('%s')\n", toChars()); 4052 4048 #endif … … 4054 4050 e1 = resolveProperties(sc, e1); 4055 4051 e1 = e1->optimize(WANTvalue | WANTinterpret); 4052 e1->print(); 4056 4053 if (e1->op != TOKstring) 4057 { error("argument to mixin must be a string, not (%s)", e1->toChars());4054 { //error("argument to mixin must be a string, not (%s)", e1->toChars()); 4058 4055 return this; 4059 4056 } … … 4063 4060 p.loc = loc; 4064 4061 Expression *e = p.parseExpression(); 4065 if (p.token.value != TOKeof)4066 error("incomplete mixin expression (%s)", se->toChars()); 4062 /* if (p.token.value != TOKeof) 4063 error("incomplete mixin expression (%s)", se->toChars()); */ 4067 4064 return e->semantic(sc); 4068 4065 } … … 4093 4090 e1 = e1->optimize(WANTvalue); 4094 4091 if (e1->op != TOKstring) 4095 { error("file name argument must be a string, not (%s)", e1->toChars());4092 { //error("file name argument must be a string, not (%s)", e1->toChars()); 4096 4093 goto Lerror; 4097 4094 } … … 4101 4098 4102 4099 if (!global.params.fileImppath) 4103 { error("need -Jpath switch to import text file %s", name);4100 { //error("need -Jpath switch to import text file %s", name); 4104 4101 goto Lerror; 4105 4102 } 4106 4103 4107 4104 if (name != FileName::name(name)) 4108 { error("use -Jpath switch to provide path for filename %s", name);4105 { //error("use -Jpath switch to provide path for filename %s", name); 4109 4106 goto Lerror; 4110 4107 } … … 4112 4109 name = FileName::searchPath(global.filePath, name, 0); 4113 4110 if (!name) 4114 { error("file %s cannot be found, check -Jpath", se->toChars());4111 { //error("file %s cannot be found, check -Jpath", se->toChars()); 4115 4112 goto Lerror; 4116 4113 } … … 4121 4118 { File f(name); 4122 4119 if (f.read()) 4123 { error("cannot read file %s", f.toChars());4120 { //error("cannot read file %s", f.toChars()); 4124 4121 goto Lerror; 4125 4122 } … … 4736 4733 4737 4734 assert(s); 4738 id = (Identifier *)ti->idents.data[0];4735 id = ti->name; 4739 4736 s2 = s->search(loc, id, 0); 4740 4737 if (!s2) … … 5302 5299 5303 5300 if (ti && 5304 (ti-> idents.data[ti->idents.dim - 1]== f->ident ||5301 (ti->name == f->ident || 5305 5302 ti->toAlias()->ident == f->ident) 5306 5303 && … … 5819 5816 if (v) 5820 5817 { 5821 if (!v->isDataseg())5822 error("escaping reference to local %s", v->toChars()); 5818 /* if (!v->isDataseg()) 5819 error("escaping reference to local %s", v->toChars()); */ 5823 5820 } 5824 5821 } … … 7319 7316 { Expression *e; 7320 7317 7318 #if 0 7319 printf("MulExp::semantic() %s\n", toChars()); 7320 #endif 7321 7321 if (type) 7322 { 7322 7323 return this; 7324 } 7323 7325 7324 7326 BinExp::semanticp(sc); trunk/rebuild/expression.h
r446 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. trunk/rebuild/func.c
r446 r459 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 // www.digitalmars.com6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. … … 479 479 arg0->type->next->ty != Tarray || 480 480 arg0->type->next->next->ty != Tchar || 481 (arg0->inout != None && arg0->inout != In))481 arg0->storageClass & (STCout | STCref | STClazy)) 482 482 goto Lmainerr; 483 483 break; … … 696 696 for (size_t j = 0; j < dim; j++) 697 697 { Argument *narg = Argument::getNth(t->arguments, j); 698 narg-> inout = arg->inout;698 narg->storageClass = arg->storageClass; 699 699 } 700 700 } … … 726 726 if (f->varargs == 2 && i + 1 == nparams) 727 727 v->storage_class |= STCvariadic; 728 switch (arg->inout) 729 { case In: v->storage_class |= STCin; break; 730 case Out: v->storage_class |= STCout; break; 731 case InOut: v->storage_class |= STCin | STCout; break; 732 case Lazy: v->storage_class |= STCin | STClazy; break; 733 default: assert(0); 734 } 728 v->storage_class |= arg->storageClass & (STCin | STCout | STCref | STClazy); 729 if (v->storage_class & STClazy) 730 v->storage_class |= STCin; 735 731 v->semantic(sc2); 736 732 if (!sc2->insert(v)) {} … … 784 780 // BUG: need to treat parameters as const 785 781 // BUG: need to disallow returns and throws 786 // BUG: verify that all in and inoutparameters are read782 // BUG: verify that all in and ref parameters are read 787 783 frequire = frequire->semantic(sc2); 788 784 labtab = NULL; // so body can't refer to labels … … 1032 1028 1033 1029 v = (VarDeclaration *)parameters->data[i]; 1034 if ( (v->storage_class & (STCout | STCin)) ==STCout)1030 if (v->storage_class & STCout) 1035 1031 { 1036 1032 assert(v->init); trunk/rebuild/hdrgen.c
