Always create initializer contexts for pattern binding entries in non-local scopes.

We were optimizing away unused pattern binding initializer contexts in
both the parser and in semantic analysis, which led to a
somewhat-unpredictable set of DeclContexts in the AST. Normalize
everything by always creating these contexts.
This commit is contained in:
Doug Gregor
2016-09-01 17:10:39 -07:00
parent 5e25d25c96
commit 4eac3ea2e7
11 changed files with 126 additions and 114 deletions

View File

@@ -53,7 +53,7 @@ const uint16_t VERSION_MAJOR = 0;
/// in source control, you should also update the comment to briefly
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
const uint16_t VERSION_MINOR = 265; // Last change: pattern binding initializer index
const uint16_t VERSION_MINOR = 266; // Last change: pattern binding init contexts
using DeclID = PointerEmbeddedInt<unsigned, 31>;
using DeclIDField = BCFixed<31>;
@@ -927,9 +927,9 @@ namespace decls_block {
BCFixed<1>, // implicit flag
BCFixed<1>, // static?
StaticSpellingKindField, // spelling of 'static' or 'class'
BCVBR<3> // numpatterns
// The pattern trails the record.
BCVBR<3>, // numpatterns
BCArray<DeclContextIDField> // init contexts
// The patterns and decl-contexts trail the record.
>;
template <unsigned Code>