mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILGen: Implement reftype elements and properties.
Generalize a bunch of code that assumed address-of-value-type for the "this" side of properties to accept reftypes as well. Use RefElementAddrInst to extract physical elements of reference types. Fix an off-by-one in the writeback logic in emitStoreToLValue so that writeback chains properly terminate at the deepest value type component below a reference type component. Swift SVN r3445
This commit is contained in:
@@ -57,6 +57,14 @@ SILConstant::SILConstant(SILConstant::Loc baseLoc) {
|
||||
id = 0;
|
||||
}
|
||||
|
||||
static Type propertyThisType(Type thisType, ASTContext &C) {
|
||||
if (thisType->hasReferenceSemantics()) {
|
||||
return thisType;
|
||||
} else {
|
||||
return LValueType::get(thisType, LValueType::Qual::DefaultForType, C);
|
||||
}
|
||||
}
|
||||
|
||||
Type SILConstant::getType() const {
|
||||
// FIXME: This should probably be a method on SILModule that caches the
|
||||
// type information.
|
||||
@@ -78,9 +86,7 @@ Type SILConstant::getType() const {
|
||||
}
|
||||
if (propertyType)
|
||||
return contextType
|
||||
? FunctionType::get(LValueType::get(contextType,
|
||||
LValueType::Qual::DefaultForType,
|
||||
C),
|
||||
? FunctionType::get(propertyThisType(contextType, C),
|
||||
propertyType, C)
|
||||
: propertyType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user