mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Parse] Add an attribute for typeEraser.
This will be used for compiler-driven type erasure for dynamic replacement of functions with an opaque return type. For now, just parse the attribute and ignore it.
This commit is contained in:
@@ -519,6 +519,11 @@ SIMPLE_DECL_ATTR(_inheritsConvenienceInitializers,
|
||||
APIStableToAdd | ABIStableToAdd | APIBreakingToRemove | ABIBreakingToRemove,
|
||||
93)
|
||||
|
||||
DECL_ATTR(_typeEraser, TypeEraser,
|
||||
OnProtocol | UserInaccessible | NotSerialized |
|
||||
ABIStableToAdd | ABIBreakingToRemove | APIStableToAdd | APIBreakingToRemove,
|
||||
94)
|
||||
|
||||
SIMPLE_DECL_ATTR(IBSegueAction, IBSegueAction,
|
||||
OnFunc |
|
||||
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
|
||||
|
||||
@@ -1108,6 +1108,21 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// The \c @_typeEraser(TypeEraserType) attribute.
|
||||
class TypeEraserAttr final : public DeclAttribute {
|
||||
TypeLoc TypeEraserLoc;
|
||||
public:
|
||||
TypeEraserAttr(SourceLoc atLoc, SourceRange range, TypeLoc typeEraserLoc)
|
||||
: DeclAttribute(DAK_TypeEraser, atLoc, range, /*Implicit=*/false),
|
||||
TypeEraserLoc(typeEraserLoc) {}
|
||||
|
||||
const TypeLoc &getTypeEraserLoc() const { return TypeEraserLoc; }
|
||||
|
||||
static bool classof(const DeclAttribute *DA) {
|
||||
return DA->getKind() == DAK_TypeEraser;
|
||||
}
|
||||
};
|
||||
|
||||
/// Represents any sort of access control modifier.
|
||||
class AbstractAccessControlAttr : public DeclAttribute {
|
||||
protected:
|
||||
|
||||
@@ -1488,6 +1488,11 @@ ERROR(attr_dynamic_replacement_expected_for,none,
|
||||
ERROR(attr_dynamic_replacement_expected_colon,none,
|
||||
"expected ':' after @_dynamicReplacement(for", ())
|
||||
|
||||
ERROR(attr_type_eraser_expected_type_name,none,
|
||||
"expected a type name in @_typeEraser()", ())
|
||||
ERROR(attr_type_eraser_expected_rparen,none,
|
||||
"expected ')' after type name for @_typeEraser", ())
|
||||
|
||||
ERROR(attr_private_import_expected_rparen,none,
|
||||
"expected ')' after function name for @_private", ())
|
||||
ERROR(attr_private_import_expected_sourcefile, none,
|
||||
|
||||
Reference in New Issue
Block a user