public override void EndVisit(ElementNode node) { if (node.IsFhirResource()) { Tuple <ElementNode, ProcessResult> context = _contextStack.Pop(); ProcessResult result = context.Item2; if (context.Item1 != node) { // Should never throw exception here. In case any bug happen, we can get clear message for this exception. throw new ConstraintException("Internal error: access wrong context."); } if (_contextStack.Count() > 0) { _contextStack.Peek().Item2.Update(result); } if (AddSecurityTag && !node.IsContainedNode()) { node.AddSecurityTag(result); } } }