mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Teach the parser to add the didSet/willSet functions to the enclosing
type, so we emit them. Add mangler (and demangler) support for these. Enhance our testcase to check to make sure that stores within these specifiers are direct, they don't cause recursive infinite loops. John, I picked w/W for the mangling letters, let me know if this is ok. Swift SVN r13050
This commit is contained in:
@@ -918,6 +918,14 @@ private:
|
||||
entityKind = Node::Kind::Setter;
|
||||
name = demangleDeclName();
|
||||
if (!name) return nullptr;
|
||||
} else if (Mangled.nextIf('w')) {
|
||||
entityKind = Node::Kind::WillSet;
|
||||
name = demangleDeclName();
|
||||
if (!name) return nullptr;
|
||||
} else if (Mangled.nextIf('W')) {
|
||||
entityKind = Node::Kind::DidSet;
|
||||
name = demangleDeclName();
|
||||
if (!name) return nullptr;
|
||||
} else if (Mangled.nextIf('U')) {
|
||||
entityKind = Node::Kind::ExplicitClosure;
|
||||
name = demangleIndexAsNode();
|
||||
@@ -2123,6 +2131,12 @@ void NodePrinter::print(Node *pointer, bool asContext, bool suppressType) {
|
||||
case Node::Kind::Setter:
|
||||
printEntity(true, true, ".setter");
|
||||
return;
|
||||
case Node::Kind::WillSet:
|
||||
printEntity(true, true, ".willset");
|
||||
return;
|
||||
case Node::Kind::DidSet:
|
||||
printEntity(true, true, ".didset");
|
||||
return;
|
||||
case Node::Kind::Allocator:
|
||||
printEntity(false, true, "__allocating_init");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user