Skip to content

Commit 4b0005d

Browse files
authored
Merge pull request #3041 from jckarter/property-behavior-flag
2 parents 0be4440 + dfcdbdc commit 4b0005d

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

docs/ABI.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,11 @@ Globals
782782
global ::= 'TV' global // vtable override thunk
783783
global ::= 'TW' protocol-conformance entity
784784
// protocol witness thunk
785+
global ::= 'TB' identifier context identifier
786+
// property behavior initializer thunk
787+
global ::= 'Tb' identifier context identifier
788+
// property behavior setter thunk
789+
785790
entity ::= nominal-type // named type declaration
786791
entity ::= static? entity-kind context entity-name
787792
entity-kind ::= 'F' // function (ctor, accessor, etc.)

include/swift/Parse/Tokens.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ KEYWORD(__LINE__)
144144
KEYWORD(__COLUMN__)
145145
KEYWORD(__FUNCTION__)
146146
KEYWORD(__DSO_HANDLE__)
147-
KEYWORD(__behavior)
148147

149148
// Pattern keywords.
150149
KEYWORD(_)

lib/Parse/ParseDecl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4200,7 +4200,10 @@ ParserStatus Parser::parseDeclVar(ParseDeclOptions Flags,
42004200
}
42014201

42024202
// Parse a behavior block if present.
4203-
if (consumeIf(tok::kw___behavior)) {
4203+
if (Context.LangOpts.EnableExperimentalPropertyBehaviors
4204+
&& Tok.is(tok::identifier)
4205+
&& Tok.getRawText().equals("__behavior")) {
4206+
consumeToken(tok::identifier);
42044207
auto type = parseType(diag::expected_behavior_name,
42054208
/*handle completion*/ true);
42064209
if (type.isParseError())

test/SILGen/property_behavior_init.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
1+
// RUN: %target-swift-frontend -enable-experimental-property-behaviors -emit-silgen %s | FileCheck %s
22
protocol diBehavior {
33
associatedtype Value
44
var storage: Value { get set }

0 commit comments

Comments
 (0)