Mercurial > projects > ddmd
comparison dmd/TypeAArray.d @ 135:af1bebfd96a4 dmd2037
dmd 2.038
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Mon, 13 Sep 2010 22:19:42 +0100 |
parents | 010eb8f0e18d |
children | af724d3510d7 |
comparison
equal
deleted
inserted
replaced
134:4251f96733f4 | 135:af1bebfd96a4 |
---|---|
114 } | 114 } |
115 } | 115 } |
116 else | 116 else |
117 index = index.semantic(loc,sc); | 117 index = index.semantic(loc,sc); |
118 | 118 |
119 if (index.nextOf() && !index.nextOf().isInvariant()) | 119 if (index.nextOf() && !index.nextOf().isImmutable()) |
120 { | 120 { |
121 index = index.constOf().mutableOf(); | 121 index = index.constOf().mutableOf(); |
122 static if (false) | 122 static if (false) |
123 { | 123 { |
124 printf("index is %p %s\n", index, index.toChars()); | 124 printf("index is %p %s\n", index, index.toChars()); |
328 override Expression defaultInit(Loc loc) | 328 override Expression defaultInit(Loc loc) |
329 { | 329 { |
330 version (LOGDEFAULTINIT) { | 330 version (LOGDEFAULTINIT) { |
331 printf("TypeAArray.defaultInit() '%s'\n", toChars()); | 331 printf("TypeAArray.defaultInit() '%s'\n", toChars()); |
332 } | 332 } |
333 Expression e = new NullExp(loc); | 333 return new NullExp(loc, this); |
334 e.type = this; | |
335 return e; | |
336 } | 334 } |
337 | 335 |
338 override MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) | 336 override MATCH deduceType(Scope sc, Type tparam, TemplateParameters parameters, Objects dedtypes) |
339 { | 337 { |
340 static if (false) { | 338 static if (false) { |
383 | 381 |
384 if (to.ty == Taarray) | 382 if (to.ty == Taarray) |
385 { | 383 { |
386 TypeAArray ta = cast(TypeAArray)to; | 384 TypeAArray ta = cast(TypeAArray)to; |
387 | 385 |
388 if (!(next.mod == ta.next.mod || ta.next.mod == MODconst)) | 386 if (!MODimplicitConv(next.mod, ta.next.mod)) |
389 return MATCHnomatch; // not const-compatible | 387 return MATCHnomatch; // not const-compatible |
390 | 388 |
391 if (!(index.mod == ta.index.mod || ta.index.mod == MODconst)) | 389 if (!MODimplicitConv(index.mod, ta.index.mod)) |
392 return MATCHnomatch; // not const-compatible | 390 return MATCHnomatch; // not const-compatible |
393 | 391 |
394 MATCH m = next.constConv(ta.next); | 392 MATCH m = next.constConv(ta.next); |
395 MATCH mi = index.constConv(ta.index); | 393 MATCH mi = index.constConv(ta.index); |
396 if (m != MATCHnomatch && mi != MATCHnomatch) | 394 if (m != MATCHnomatch && mi != MATCHnomatch) |