mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
TextualInterface: print __conuming before accessors
rdar://80535144
This commit is contained in:
@@ -3428,7 +3428,9 @@ void PrintAST::visitAccessorDecl(AccessorDecl *decl) {
|
|||||||
printAttributes(decl);
|
printAttributes(decl);
|
||||||
// Explicitly print 'mutating' and 'nonmutating' if needed.
|
// Explicitly print 'mutating' and 'nonmutating' if needed.
|
||||||
printMutabilityModifiersIfNeeded(decl);
|
printMutabilityModifiersIfNeeded(decl);
|
||||||
|
if (decl->isConsuming()) {
|
||||||
|
Printer.printKeyword("__consuming", Options, " ");
|
||||||
|
}
|
||||||
switch (auto kind = decl->getAccessorKind()) {
|
switch (auto kind = decl->getAccessorKind()) {
|
||||||
case AccessorKind::Get:
|
case AccessorKind::Get:
|
||||||
case AccessorKind::Address:
|
case AccessorKind::Address:
|
||||||
|
|||||||
27
test/ModuleInterface/consuming.swift
Normal file
27
test/ModuleInterface/consuming.swift
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// RUN: %empty-directory(%t)
|
||||||
|
// RUN: %empty-directory(%t/missing)
|
||||||
|
// RUN: %empty-directory(%t/inputs)
|
||||||
|
// RUN: %target-swift-frontend -emit-module-path %t/missing/Foo.swiftmodule -enable-library-evolution -emit-module-interface-path %t/inputs/Foo.swiftinterface -enable-objc-interop -disable-objc-attr-requires-foundation-module -module-name Foo %s
|
||||||
|
// RUN: %FileCheck --input-file %t/inputs/Foo.swiftinterface %s
|
||||||
|
|
||||||
|
// RUN: touch %t/Bar.swift
|
||||||
|
// RUN: echo "import Foo" > %t/Bar.swift
|
||||||
|
// RUN: echo "let f = Field()" >> %t/Bar.swift
|
||||||
|
|
||||||
|
// RUN: %target-swift-frontend -emit-module-path %t/Bar.swiftmodule -enable-library-evolution -enable-objc-interop -disable-objc-attr-requires-foundation-module -module-name Bar %t/Bar.swift -I %t/inputs
|
||||||
|
|
||||||
|
|
||||||
|
import Swift
|
||||||
|
|
||||||
|
public struct Field {
|
||||||
|
public init() {}
|
||||||
|
public var area: Int {
|
||||||
|
__consuming get { return 1 }
|
||||||
|
_modify {
|
||||||
|
var a = 1
|
||||||
|
yield &a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CHECK: __consuming get
|
||||||
Reference in New Issue
Block a user