/// <summary> /// Removes substitution currently used by the rewriter for a placeholder node. /// Asserts if there isn't already a substitution. /// </summary> private void RemovePlaceholderReplacement(BoundValuePlaceholderBase placeholder) { Debug.Assert((object)placeholder != null); bool removed = _placeholderReplacementMapDoNotUseDirectly.Remove(placeholder); Debug.Assert(removed); }
/// <summary> /// Returns substitution currently used by the rewriter for a placeholder node. /// Each occurrence of the placeholder node is replaced with the node returned. /// Throws if there is no substitution. /// </summary> private BoundExpression PlaceholderReplacement(BoundValuePlaceholderBase placeholder) { var value = _placeholderReplacementMapDoNotUseDirectly[placeholder]; AssertPlaceholderReplacement(placeholder, value); return(value); }
/// <summary> /// Sets substitution used by the rewriter for a placeholder node. /// Each occurrence of the placeholder node is replaced with the node returned. /// Throws if there is already a substitution. /// </summary> private void AddPlaceholderReplacement(BoundValuePlaceholderBase placeholder, BoundExpression value) { AssertPlaceholderReplacement(placeholder, value); if ((object)_placeholderReplacementMapDoNotUseDirectly == null) { _placeholderReplacementMapDoNotUseDirectly = new Dictionary <BoundValuePlaceholderBase, BoundExpression>(); } _placeholderReplacementMapDoNotUseDirectly.Add(placeholder, value); }
private static void AssertPlaceholderReplacement(BoundValuePlaceholderBase placeholder, BoundExpression value) { Debug.Assert(value.Type.Equals(placeholder.Type, TypeCompareKind.AllIgnoreOptions)); }