comparison dmd/expression.c @ 139:0ab29b838084 trunk

[svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :) Fixed: tango.io.Console seems to be working now.
author lindquist
date Tue, 22 Jan 2008 00:01:16 +0100
parents 0e28624814e8
children 5acec6b2eef8
comparison
equal deleted inserted replaced
138:aeddd4d533b3 139:0ab29b838084
516 arg = arg->implicitCastTo(sc, p->type); 516 arg = arg->implicitCastTo(sc, p->type);
517 if (p->storageClass & (STCout | STCref)) 517 if (p->storageClass & (STCout | STCref))
518 { 518 {
519 // BUG: should check that argument to ref is type 'invariant' 519 // BUG: should check that argument to ref is type 'invariant'
520 // BUG: assignments to ref should also be type 'invariant' 520 // BUG: assignments to ref should also be type 'invariant'
521 arg = arg->modifiableLvalue(sc, NULL); 521 arg = arg->modifiableLvalue(sc, arg);
522 522
523 //if (arg->op == TOKslice) 523 //if (arg->op == TOKslice)
524 //arg->error("cannot modify slice %s", arg->toChars()); 524 //arg->error("cannot modify slice %s", arg->toChars());
525 } 525 }
526 526
4355 4355
4356 e = op_overload(sc); 4356 e = op_overload(sc);
4357 if (e) 4357 if (e)
4358 return e; 4358 return e;
4359 4359
4360 e1 = e1->modifiableLvalue(sc, NULL); 4360 e1 = e1->modifiableLvalue(sc, e1);
4361 e1->checkScalar(); 4361 e1->checkScalar();
4362 type = e1->type; 4362 type = e1->type;
4363 if (type->toBasetype()->ty == Tbool) 4363 if (type->toBasetype()->ty == Tbool)
4364 { 4364 {
4365 error("operator not allowed on bool expression %s", toChars()); 4365 error("operator not allowed on bool expression %s", toChars());
4386 4386
4387 e = op_overload(sc); 4387 e = op_overload(sc);
4388 if (e) 4388 if (e)
4389 return e; 4389 return e;
4390 4390
4391 e1 = e1->modifiableLvalue(sc, NULL); 4391 e1 = e1->modifiableLvalue(sc, e1);
4392 e1->checkScalar(); 4392 e1->checkScalar();
4393 type = e1->type; 4393 type = e1->type;
4394 if (type->toBasetype()->ty == Tbool) 4394 if (type->toBasetype()->ty == Tbool)
4395 { 4395 {
4396 e2 = e2->implicitCastTo(sc, type); 4396 e2 = e2->implicitCastTo(sc, type);
6872 e = op_overload(sc); 6872 e = op_overload(sc);
6873 if (e) 6873 if (e)
6874 return e; 6874 return e;
6875 6875
6876 e = this; 6876 e = this;
6877 e1 = e1->modifiableLvalue(sc, NULL); 6877 e1 = e1->modifiableLvalue(sc, e1);
6878 e1->checkScalar(); 6878 e1->checkScalar();
6879 e1->checkNoBool(); 6879 e1->checkNoBool();
6880 if (e1->type->ty == Tpointer) 6880 if (e1->type->ty == Tpointer)
6881 e = scaleFactor(sc); 6881 e = scaleFactor(sc);
6882 else 6882 else
7058 if (e1->op == TOKarraylength) 7058 if (e1->op == TOKarraylength)
7059 { 7059 {
7060 // e1 is not an lvalue, but we let code generator handle it 7060 // e1 is not an lvalue, but we let code generator handle it
7061 ArrayLengthExp *ale = (ArrayLengthExp *)e1; 7061 ArrayLengthExp *ale = (ArrayLengthExp *)e1;
7062 7062
7063 ale->e1 = ale->e1->modifiableLvalue(sc, NULL); 7063 ale->e1 = ale->e1->modifiableLvalue(sc, e1);
7064 } 7064 }
7065 else if (e1->op == TOKslice) 7065 else if (e1->op == TOKslice)
7066 ; 7066 ;
7067 else 7067 else
7068 { // Try to do a decent error message with the expression 7068 { // Try to do a decent error message with the expression
7120 7120
7121 e = op_overload(sc); 7121 e = op_overload(sc);
7122 if (e) 7122 if (e)
7123 return e; 7123 return e;
7124 7124
7125 e1 = e1->modifiableLvalue(sc, NULL); 7125 e1 = e1->modifiableLvalue(sc, e1);
7126 7126
7127 Type *tb1 = e1->type->toBasetype(); 7127 Type *tb1 = e1->type->toBasetype();
7128 Type *tb2 = e2->type->toBasetype(); 7128 Type *tb2 = e2->type->toBasetype();
7129 7129
7130 if ((tb1->ty == Tarray || tb1->ty == Tsarray) && 7130 if ((tb1->ty == Tarray || tb1->ty == Tsarray) &&
7220 7220
7221 e = op_overload(sc); 7221 e = op_overload(sc);
7222 if (e) 7222 if (e)
7223 return e; 7223 return e;
7224 7224
7225 e1 = e1->modifiableLvalue(sc, NULL); 7225 e1 = e1->modifiableLvalue(sc, e1);
7226 e1->checkScalar(); 7226 e1->checkScalar();
7227 e1->checkNoBool(); 7227 e1->checkNoBool();
7228 if (e1->type->ty == Tpointer && e2->type->isintegral()) 7228 if (e1->type->ty == Tpointer && e2->type->isintegral())
7229 e = scaleFactor(sc); 7229 e = scaleFactor(sc);
7230 else 7230 else
7265 7265
7266 if (se->e1->type->toBasetype()->ty == Tsarray) 7266 if (se->e1->type->toBasetype()->ty == Tsarray)
7267 error("cannot append to static array %s", se->e1->type->toChars()); 7267 error("cannot append to static array %s", se->e1->type->toChars());
7268 } 7268 }
7269 7269
7270 e1 = e1->modifiableLvalue(sc, NULL); 7270 e1 = e1->modifiableLvalue(sc, e1);
7271 7271
7272 Type *tb1 = e1->type->toBasetype(); 7272 Type *tb1 = e1->type->toBasetype();
7273 Type *tb2 = e2->type->toBasetype(); 7273 Type *tb2 = e2->type->toBasetype();
7274 7274
7275 if ((tb1->ty == Tarray) && 7275 if ((tb1->ty == Tarray) &&
7314 7314
7315 e = op_overload(sc); 7315 e = op_overload(sc);
7316 if (e) 7316 if (e)
7317 return e; 7317 return e;
7318 7318
7319 e1 = e1->modifiableLvalue(sc, NULL); 7319 e1 = e1->modifiableLvalue(sc, e1);
7320 e1->checkScalar(); 7320 e1->checkScalar();
7321 e1->checkNoBool(); 7321 e1->checkNoBool();
7322 type = e1->type; 7322 type = e1->type;
7323 typeCombine(sc); 7323 typeCombine(sc);
7324 e1->checkArithmetic(); 7324 e1->checkArithmetic();
7370 7370
7371 e = op_overload(sc); 7371 e = op_overload(sc);
7372 if (e) 7372 if (e)
7373 return e; 7373 return e;
7374 7374
7375 e1 = e1->modifiableLvalue(sc, NULL); 7375 e1 = e1->modifiableLvalue(sc, e1);
7376 e1->checkScalar(); 7376 e1->checkScalar();
7377 e1->checkNoBool(); 7377 e1->checkNoBool();
7378 type = e1->type; 7378 type = e1->type;
7379 typeCombine(sc); 7379 typeCombine(sc);
7380 e1->checkArithmetic(); 7380 e1->checkArithmetic();
7441 7441
7442 e = op_overload(sc); 7442 e = op_overload(sc);
7443 if (e) 7443 if (e)
7444 return e; 7444 return e;
7445 7445
7446 e1 = e1->modifiableLvalue(sc, NULL); 7446 e1 = e1->modifiableLvalue(sc, e1);
7447 e1->checkScalar(); 7447 e1->checkScalar();
7448 e1->checkNoBool(); 7448 e1->checkNoBool();
7449 type = e1->type; 7449 type = e1->type;
7450 typeCombine(sc); 7450 typeCombine(sc);
7451 e1->checkIntegral(); 7451 e1->checkIntegral();
7470 7470
7471 e = op_overload(sc); 7471 e = op_overload(sc);
7472 if (e) 7472 if (e)
7473 return e; 7473 return e;
7474 7474
7475 e1 = e1->modifiableLvalue(sc, NULL); 7475 e1 = e1->modifiableLvalue(sc, e1);
7476 e1->checkScalar(); 7476 e1->checkScalar();
7477 e1->checkNoBool(); 7477 e1->checkNoBool();
7478 type = e1->type; 7478 type = e1->type;
7479 typeCombine(sc); 7479 typeCombine(sc);
7480 e1->checkIntegral(); 7480 e1->checkIntegral();
7499 7499
7500 e = op_overload(sc); 7500 e = op_overload(sc);
7501 if (e) 7501 if (e)
7502 return e; 7502 return e;
7503 7503
7504 e1 = e1->modifiableLvalue(sc, NULL); 7504 e1 = e1->modifiableLvalue(sc, e1);
7505 e1->checkScalar(); 7505 e1->checkScalar();
7506 e1->checkNoBool(); 7506 e1->checkNoBool();
7507 type = e1->type; 7507 type = e1->type;
7508 typeCombine(sc); 7508 typeCombine(sc);
7509 e1->checkIntegral(); 7509 e1->checkIntegral();