Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
using Hast.Layer;
using Hast.Transformer.Models;
using ICSharpCode.Decompiler.CSharp.Syntax;
namespace Hast.Transformer.Services.ConstantValuesSubstitution;
public class ConstantValuesSubstitutor : IConstantValuesSubstitutor
{
private readonly ITypeDeclarationLookupTableFactory _typeDeclarationLookupTableFactory;
private readonly IAstExpressionEvaluator _astExpressionEvaluator;
public ConstantValuesSubstitutor(
ITypeDeclarationLookupTableFactory typeDeclarationLookupTableFactory,
IAstExpressionEvaluator astExpressionEvaluator)
{
_typeDeclarationLookupTableFactory = typeDeclarationLookupTableFactory;
_astExpressionEvaluator = astExpressionEvaluator;
}
public void SubstituteConstantValues(
SyntaxTree syntaxTree,
IArraySizeHolder arraySizeHolder,
IHardwareGenerationConfiguration configuration,
IKnownTypeLookupTable knownTypeLookupTable) => new ConstantValuesSubstitutingAstProcessor(
new ConstantValuesTable(),
_typeDeclarationLookupTableFactory.Create(syntaxTree),
arraySizeHolder,
[],
_astExpressionEvaluator,
knownTypeLookupTable)
.SubstituteConstantValuesInSubTree(syntaxTree, reUseOriginalConstantValuesTable: false);
}
7f9864208This file is pinned to the selected release. Download the original to open it in your design tool.