Rework has .sil files handle computed vardecls and subscripts.

Previously, we would just parse vars and subscripts with no definitions,
then let getters and setters be referenced arbitrarily later.  This was
problematic for a number of reasons, not least of which, the .sil file
might be invalid.

Instead, change sil to require that a protocol style definition indicate
whether a vardecl/subscript is computed or not, and whether it is both 
get-able and set-able, e.g. like "var x : Int { get }".  Change the 
sil printer to print decls in this form, and change the SILParser to 
make SILDeclRef::Func values instead of ::Getter/Setter values.

One thing that this exposed is that we weren't correctly serializing the
accessor state in modules, so accessors would get detatched from their
AbstractStorageDecls when deserialized (and in fact, their ASD never got
deserialized at all in some cases).  Fix this in the serialization of
the accessors.

NFC, other than the SIL printer and parser.



Swift SVN r13884
This commit is contained in:
Chris Lattner
2014-02-14 00:57:04 +00:00
parent 51609c1ac8
commit a6640a1b12
12 changed files with 78 additions and 54 deletions

View File

@@ -633,6 +633,7 @@ namespace decls_block {
TypeIDField, // interface type
DeclIDField, // operator decl
DeclIDField, // overridden function
DeclIDField, // AccessorStorageDecl
BCBlob // asmname, if any
// The record is trailed by its generic parameters, if any, followed by its
// argument and body parameter patterns.