Beispiel #1
0
 public TransformNode(IIncrementalGeneratorNode <TInput> sourceNode, Func <TInput, CancellationToken, ImmutableArray <TOutput> > userFunc, IEqualityComparer <TOutput>?comparer = null, string?name = null)
 {
     _sourceNode = sourceNode;
     _func       = userFunc;
     _comparer   = comparer ?? EqualityComparer <TOutput> .Default;
     _name       = name;
 }
Beispiel #2
0
        public SourceOutputNode(IIncrementalGeneratorNode <TInput> source, Action <SourceProductionContext, TInput> action, IncrementalGeneratorOutputKind outputKind)
        {
            _source = source;
            _action = action;

            Debug.Assert(outputKind == IncrementalGeneratorOutputKind.Source || outputKind == IncrementalGeneratorOutputKind.Implementation);
            _outputKind = outputKind;
        }
        public SourceOutputNode(IIncrementalGeneratorNode <TInput> source, Action <SourceProductionContext, TInput, CancellationToken> action, IncrementalGeneratorOutputKind outputKind, string sourceExtension)
        {
            _source = source;
            _action = action;

            Debug.Assert(outputKind == IncrementalGeneratorOutputKind.Source || outputKind == IncrementalGeneratorOutputKind.Implementation);
            _outputKind      = outputKind;
            _sourceExtension = sourceExtension;
        }
Beispiel #4
0
            public NodeStateTable <T> GetLatestStateTableForNode <T>(IIncrementalGeneratorNode <T> source)
            {
                // if we've already evaluated a node during this build, we can just return the existing result
                if (_stateTableBuilder.TryGetTable(source, out var table))
                {
                    return((NodeStateTable <T>)table);
                }

                // get the previous table, if there was one for this node
                NodeStateTable <T> previousTable = _previousTable._tables.GetStateTableOrEmpty <T>(source);

                // request the node update its state based on the current driver table and store the new result
                var newTable = source.UpdateStateTable(this, previousTable, _cancellationToken);

                _stateTableBuilder.SetTable(source, newTable);
                return(newTable);
            }
Beispiel #5
0
 public BatchNode(IIncrementalGeneratorNode <TInput> sourceNode, IEqualityComparer <ImmutableArray <TInput> >?comparer = null, string?name = null)
 {
     _sourceNode = sourceNode;
     _comparer   = comparer ?? EqualityComparer <ImmutableArray <TInput> > .Default;
     _name       = name;
 }
Beispiel #6
0
 private static void RegisterSourceOutput <TSource>(IIncrementalGeneratorNode <TSource> node, Action <SourceProductionContext, TSource> action, IncrementalGeneratorOutputKind kind, string sourceExt)
 {
     node.RegisterOutput(new SourceOutputNode <TSource>(node, action.WrapUserAction(), kind, sourceExt));
 }
Beispiel #7
0
 public TransformNode(IIncrementalGeneratorNode <TInput> sourceNode, Func <TInput, CancellationToken, TOutput> userFunc, IEqualityComparer <TOutput>?comparer = null)
     : this(sourceNode, userFunc : (i, token) => ImmutableArray.Create(userFunc(i, token)), comparer)
 {
 }
 public SourceOutputNode(IIncrementalGeneratorNode <TInput> source, Action <SourceProductionContext, TInput> action)
 {
     _source = source;
     _action = action;
 }
 internal IncrementalValuesProvider(IIncrementalGeneratorNode <TValues> node)
 {
     this.Node = node;
 }