System.Xml.Xsl.Xslt.XsltInput.InputScopeManager.SetFlag C# (CSharp) Method

SetFlag() private method

private SetFlag ( bool value, ScopeFlags flag ) : void
value bool
flag ScopeFlags
return void
            private void SetFlag(bool value, ScopeFlags flag) {
                Debug.Assert(flag == (flag & ScopeFlags.InheritedFlags) && (flag & (flag - 1)) == 0 && flag != 0);
                ScopeFlags lastFlags  =  records[lastRecord].scopeFlags;
                if (((lastFlags & flag) != 0) != value) {
                    //         lastScopes == records[lastRecord].scopeCount; // we know this because we are cashing it.
                    bool canReuseLastRecord = lastScopes == 0;                             // last record is from last scope
                    if (! canReuseLastRecord) {
                        AddRecord();
                        lastFlags = lastFlags & ScopeFlags.InheritedFlags;
                    }
                    records[lastRecord].scopeFlags = lastFlags ^ flag;
                }
            }