comparison dmd/CallExp.d @ 135:af1bebfd96a4 dmd2037

dmd 2.038
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 13 Sep 2010 22:19:42 +0100
parents 60bb0fe4563e
children e3afd1303184
comparison
equal deleted inserted replaced
134:4251f96733f4 135:af1bebfd96a4
277 } 277 }
278 278
279 istemp = 0; 279 istemp = 0;
280 Lagain: 280 Lagain:
281 //printf("Lagain: %s\n", toChars()); 281 //printf("Lagain: %s\n", toChars());
282 //printf("test1 %s\n", toChars());
283 f = null; 282 f = null;
284 if (e1.op == TOK.TOKthis || e1.op == TOK.TOKsuper) 283 if (e1.op == TOK.TOKthis || e1.op == TOK.TOKsuper)
285 { 284 {
286 // semantic() run later for these 285 // semantic() run later for these
287 } 286 }
507 printf("f = %s\n", f.toChars()); 506 printf("f = %s\n", f.toChars());
508 printf("t = %s\n", t.toChars()); 507 printf("t = %s\n", t.toChars());
509 printf("e1 = %s\n", e1.toChars()); 508 printf("e1 = %s\n", e1.toChars());
510 printf("e1.type = %s\n", e1.type.toChars()); 509 printf("e1.type = %s\n", e1.type.toChars());
511 } 510 }
512 // Const member function can take const/immutable/mutable this 511 // Const member function can take const/immutable/mutable/inout this
513 if (!(f.type.isConst())) 512 if (!(f.type.isConst()))
514 { 513 {
515 // Check for const/immutable compatibility 514 // Check for const/immutable compatibility
516 Type tthis = ue.e1.type.toBasetype(); 515 Type tthis = ue.e1.type.toBasetype();
517 if (tthis.ty == TY.Tpointer) 516 if (tthis.ty == TY.Tpointer)
518 tthis = tthis.nextOf().toBasetype(); 517 tthis = tthis.nextOf().toBasetype();
519 518
520 static if (false) { // this checking should have been already done 519 static if (false) { // this checking should have been already done
521 if (f.type.isInvariant()) 520 if (f.type.isImmutable())
522 { 521 {
523 if (tthis.mod != MOD.MODinvariant) 522 if (tthis.mod != MOD.MODimmutable)
524 error("%s can only be called with an immutable object", e1.toChars()); 523 error("%s can only be called with an immutable object", e1.toChars());
525 } 524 }
526 else if (f.type.isShared()) 525 else if (f.type.isShared())
527 { 526 {
528 if (tthis.mod != MOD.MODinvariant && tthis.mod != MOD.MODshared && tthis.mod != (MOD.MODshared | MOD.MODconst)) 527 if (tthis.mod != MOD.MODimmutable && tthis.mod != MOD.MODshared && tthis.mod != (MOD.MODshared | MOD.MODconst))
529 error("shared %s can only be called with a shared or immutable object", e1.toChars()); 528 error("shared %s can only be called with a shared or immutable object", e1.toChars());
530 } 529 }
531 else 530 else
532 { 531 {
533 if (tthis.mod != MOD.MODundefined) 532 if (tthis.mod != MOD.MODundefined)
793 assert(t1.ty == TY.Tfunction); 792 assert(t1.ty == TY.Tfunction);
794 tf = cast(TypeFunction)t1; 793 tf = cast(TypeFunction)t1;
795 794
796 Lcheckargs: 795 Lcheckargs:
797 assert(tf.ty == TY.Tfunction); 796 assert(tf.ty == TY.Tfunction);
798 type = tf.next;
799 797
800 if (!arguments) 798 if (!arguments)
801 arguments = new Expressions(); 799 arguments = new Expressions();
802 800
803 functionParameters(loc, sc, tf, arguments); 801 type = functionParameters(loc, sc, tf, arguments);
804 802
805 if (!type) 803 if (!type)
806 { 804 {
807 error("forward reference to inferred return type of function call %s", toChars()); 805 error("forward reference to inferred return type of function call %s", toChars());
808 type = Type.terror; 806 type = Type.terror;