< Summary

Class:NanoCLang.Entities.Substitutor
Assembly:NanoCLang
File(s):C:\GitLab-Runner\builds\JxAESPd8\0\chenmichael\nanoc\src\NanoCLang\Entities\ISubstitutable.cs
Covered lines:3
Uncovered lines:0
Coverable lines:3
Total lines:33
Line coverage:100% (3 of 3)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_Locations()100%1100%
get_Variables()100%1100%
get_BlockOffsets()100%1100%

File(s)

C:\GitLab-Runner\builds\JxAESPd8\0\chenmichael\nanoc\src\NanoCLang\Entities\ISubstitutable.cs

#LineLine coverage
 1using System.Collections.Generic;
 2
 3namespace NanoCLang.Entities {
 4    /// <summary>
 5    /// Provides an interface that allows for variable expressions to be aliased.
 6    /// </summary>
 7    /// <typeparam name="T">Type of object to substitute in.</typeparam>
 8    public interface ISubstitutable<T> {
 9        /// <summary>
 10        /// Substitutes all entities in the object with the substitutor rules from <paramref name="sub"/> and returns a 
 11        /// </summary>
 12        /// <param name="sub">Replacement partial function.</param>
 13        /// <returns>New object with replaced entities.</returns>
 14        T Replace(Substitutor sub);
 15    }
 16    /// <summary>
 17    /// Provides a class for substituting entities in abstract syntax trees.
 18    /// </summary>
 19    public class Substitutor {
 20        /// <summary>
 21        /// The location replacement dictionary. Replaces all location names, does not change abstract/concrete!
 22        /// </summary>
 75523        public IDictionary<string, string> Locations { get; set; } = new Dictionary<string, string>();
 24        /// <summary>
 25        /// The variable replacement dictionary. Replaces all variables that are keys with the expression in the corresp
 26        /// </summary>
 206327        public IDictionary<string, PureExpression> Variables { get; set; } = new Dictionary<string, PureExpression>();
 28        /// <summary>
 29        /// The block offset replacement dictionary. Replaces all block offsets with expressions.
 30        /// </summary>
 51131        public IDictionary<int, PureExpression> BlockOffsets { get; set; } = new Dictionary<int, PureExpression>();
 32    }
 33}