Changeset View
Changeset View
Standalone View
Standalone View
duchain/typeconversion.cpp
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Line(s) | 124 | uint TypeConversion::implicitConversion( IndexedType _from, IndexedType _to, bool fromLValue, bool noUserDefinedConversion ) { | |||
---|---|---|---|---|---|
141 | AbstractType::Ptr to = unAliasedType(_to.abstractType()); | 141 | AbstractType::Ptr to = unAliasedType(_to.abstractType()); | ||
142 | AbstractType::Ptr from = unAliasedType(_from.abstractType()); | 142 | AbstractType::Ptr from = unAliasedType(_from.abstractType()); | ||
143 | 143 | | |||
144 | if( !from || !to ) { | 144 | if( !from || !to ) { | ||
145 | problem( from, to, "one type is invalid" ); | 145 | problem( from, to, "one type is invalid" ); | ||
146 | goto ready; | 146 | goto ready; | ||
147 | }else{ | 147 | }else{ | ||
148 | 148 | | |||
149 | //kDebug(9007) << "Checking conversion from " << from->toString() << " to " << to->toString(); | 149 | //qDebug(9007) << "Checking conversion from " << from->toString() << " to " << to->toString(); | ||
150 | ReferenceType::Ptr fromReference = from.cast<ReferenceType>(); | 150 | ReferenceType::Ptr fromReference = from.cast<ReferenceType>(); | ||
151 | if( fromReference ) | 151 | if( fromReference ) | ||
152 | fromLValue = true; | 152 | fromLValue = true; | ||
153 | 153 | | |||
154 | ///iso c++ draft 13.3.3.1.4 reference-binding, modeled roughly | 154 | ///iso c++ draft 13.3.3.1.4 reference-binding, modeled roughly | ||
155 | ReferenceType::Ptr toReference = to.cast<ReferenceType>(); | 155 | ReferenceType::Ptr toReference = to.cast<ReferenceType>(); | ||
156 | if( toReference ) { | 156 | if( toReference ) { | ||
157 | AbstractType::Ptr realFrom = realType(from, m_topContext); | 157 | AbstractType::Ptr realFrom = realType(from, m_topContext); | ||
▲ Show 20 Lines • Show All 342 Lines • ▼ Show 20 Line(s) | 499 | if( !from && !to ) | |||
500 | return true; | 500 | return true; | ||
501 | else if( !from || !to ) | 501 | else if( !from || !to ) | ||
502 | return false; | 502 | return false; | ||
503 | 503 | | |||
504 | //ConstantIntegralType::equals does not return true on equals in this case, but the type is compatible. | 504 | //ConstantIntegralType::equals does not return true on equals in this case, but the type is compatible. | ||
505 | if(from.cast<ConstantIntegralType>() && typeid(*to) == typeid(IntegralType)) | 505 | if(from.cast<ConstantIntegralType>() && typeid(*to) == typeid(IntegralType)) | ||
506 | return true; | 506 | return true; | ||
507 | 507 | | |||
508 | return from->equals(to.unsafeData()); | 508 | return from->equals(to.data()); | ||
509 | } | 509 | } | ||
510 | 510 | | |||
511 | void TypeConversion::problem( AbstractType::Ptr from, AbstractType::Ptr to, const QString& desc ) { | 511 | void TypeConversion::problem( AbstractType::Ptr from, AbstractType::Ptr to, const QString& desc ) { | ||
512 | Q_UNUSED(from) | 512 | Q_UNUSED(from) | ||
513 | Q_UNUSED(to) | 513 | Q_UNUSED(to) | ||
514 | Q_UNUSED(desc) | 514 | Q_UNUSED(desc) | ||
515 | } | 515 | } | ||
516 | 516 | | |||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |