mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ASTGen] Handle 'read' and 'modify' accessors
This commit is contained in:
@@ -393,6 +393,12 @@ extension ASTGenVisitor {
|
||||
return .modify
|
||||
case .`init`:
|
||||
return .`init`
|
||||
case .read:
|
||||
precondition(ctx.langOptsHasFeature(.CoroutineAccessors), "(compiler bug) 'read' accessor should only be parsed with 'CoroutineAccessors' feature")
|
||||
return .read2
|
||||
case .modify:
|
||||
precondition(ctx.langOptsHasFeature(.CoroutineAccessors), "(compiler bug) 'modify' accessor should only be parsed with 'CoroutineAccessors' feature")
|
||||
return .modify2
|
||||
default:
|
||||
self.diagnose(.unknownAccessorSpecifier(specifier))
|
||||
return nil
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend-dump-parse -disable-availability-checking -enable-experimental-move-only -enable-experimental-concurrency -enable-experimental-feature ParserASTGen \
|
||||
// RUN: -enable-experimental-feature CoroutineAccessors \
|
||||
// RUN: | %sanitize-address > %t/astgen.ast
|
||||
// RUN: %target-swift-frontend-dump-parse -disable-availability-checking -enable-experimental-move-only -enable-experimental-concurrency \
|
||||
// RUN: -enable-experimental-feature CoroutineAccessors \
|
||||
// RUN: | %sanitize-address > %t/cpp-parser.ast
|
||||
|
||||
// RUN: %diff -u %t/astgen.ast %t/cpp-parser.ast
|
||||
|
||||
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-concurrency -enable-experimental-feature ParserASTGen)
|
||||
// RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -Xfrontend -enable-experimental-concurrency -enable-experimental-feature CoroutineAccessors -enable-experimental-feature ParserASTGen)
|
||||
|
||||
// REQUIRES: executable_test
|
||||
// REQUIRES: swift_swift_parser
|
||||
// REQUIRES: swift_feature_ParserASTGen
|
||||
// REQUIRES: swift_feature_CoroutineAccessors
|
||||
|
||||
// rdar://116686158
|
||||
// UNSUPPORTED: asan
|
||||
@@ -108,6 +111,10 @@ func testVars() {
|
||||
var s: Int {
|
||||
get async throws { return 0 }
|
||||
}
|
||||
var t: Int {
|
||||
read { yield q }
|
||||
modify { yield &q }
|
||||
}
|
||||
}
|
||||
|
||||
func rethrowingFn(fn: () throws -> Void) rethrows {}
|
||||
|
||||
Reference in New Issue
Block a user