-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add copyright notice to generated files.
These were added only to files with a significant amount of roslyn code.
- Loading branch information
1 parent
dee33bc
commit 42ff839
Showing
12 changed files
with
231 additions
and
21 deletions.
There are no files selected for viewing
39 changes: 38 additions & 1 deletion
39
.../Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample/Internal/GreenList`1.Enumerable.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,38 @@ | ||
| ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// Modified by the Tsu (https://github.com/GGG-KILLER/Tsu) project for embedding into other projects. | ||
// <auto-generated /> | ||
|
||
#nullable enable | ||
|
||
namespace Tsu.Trees.RedGreen.Sample.Internal | ||
{ | ||
internal partial struct SampleList<TNode> where TNode : global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode | ||
{ | ||
internal struct Enumerator | ||
{ | ||
private readonly SampleList<TNode> _list; | ||
private int _index; | ||
|
||
internal Enumerator(SampleList<TNode> list) | ||
{ | ||
_list = list; | ||
_index = -1; | ||
} | ||
|
||
public bool MoveNext() | ||
{ | ||
var newIndex = _index + 1; | ||
if (newIndex < _list.Count) | ||
{ | ||
_index = newIndex; | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public TNode Current => _list[_index]!; | ||
} | ||
} | ||
} |
146 changes: 145 additions & 1 deletion
146
...es.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample/Internal/GreenList`1.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,145 @@ | ||
| ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// Modified by the Tsu (https://github.com/GGG-KILLER/Tsu) project for embedding into other projects. | ||
// <auto-generated /> | ||
|
||
#nullable enable | ||
|
||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
|
||
namespace Tsu.Trees.RedGreen.Sample.Internal | ||
{ | ||
internal readonly partial struct SampleList<TNode> : global::System.IEquatable<SampleList<TNode>> | ||
where TNode : global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode | ||
{ | ||
private readonly global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? _node; | ||
|
||
internal SampleList(global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? node) | ||
{ | ||
_node = node; | ||
} | ||
|
||
internal global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? Node => _node; | ||
|
||
public int Count => _node == null ? 0 : (_node.IsList ? _node.SlotCount : 1); | ||
|
||
public TNode? this[int index] | ||
{ | ||
get | ||
{ | ||
if (_node == null) | ||
{ | ||
return null; | ||
} | ||
else if (_node.IsList) | ||
{ | ||
global::System.Diagnostics.Debug.Assert(index >= 0); | ||
global::System.Diagnostics.Debug.Assert(index <= _node.SlotCount); | ||
|
||
return (TNode?) _node.GetSlot(index); | ||
} | ||
else if (index == 0) | ||
{ | ||
return (TNode?) _node; | ||
} | ||
else | ||
{ | ||
throw new global::System.InvalidOperationException("The program has reached a state that was thought to be unreachable."); | ||
} | ||
} | ||
} | ||
|
||
internal TNode GetRequiredItem(int index) | ||
{ | ||
var node = this[index]; | ||
global::System.Diagnostics.Debug.Assert(node is object); | ||
return node!; | ||
} | ||
|
||
internal global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode? ItemUntyped(int index) | ||
{ | ||
global::System.Diagnostics.Debug.Assert(_node is not null); | ||
var node = _node!; | ||
if (node.IsList) | ||
{ | ||
return node.GetSlot(index); | ||
} | ||
|
||
global::System.Diagnostics.Debug.Assert(index == 0); | ||
return node; | ||
} | ||
|
||
public bool Any() => _node != null; | ||
|
||
public bool Any(global::Tsu.Trees.RedGreen.Sample.SampleKind kind) | ||
{ | ||
foreach (var element in this) | ||
{ | ||
if (element.Kind == kind) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
internal TNode[] Nodes | ||
{ | ||
get | ||
{ | ||
var arr = new TNode[Count]; | ||
for (int i = 0; i < Count; i++) | ||
{ | ||
arr[i] = GetRequiredItem(i); | ||
} | ||
return arr; | ||
} | ||
} | ||
|
||
public TNode? Last | ||
{ | ||
get | ||
{ | ||
global::System.Diagnostics.Debug.Assert(_node is not null); | ||
var node = _node!; | ||
if (node.IsList) | ||
{ | ||
return (TNode?) node.GetSlot(node.SlotCount - 1); | ||
} | ||
|
||
return (TNode?) node; | ||
} | ||
} | ||
|
||
public Enumerator GetEnumerator() => new(this); | ||
|
||
internal void CopyTo(int offset, global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode[] array, int arrayOffset, int count) | ||
{ | ||
for (int i = 0; i < count; i++) | ||
{ | ||
array[arrayOffset + i] = GetRequiredItem(i + offset); | ||
} | ||
} | ||
|
||
public static bool operator ==(SampleList<TNode> left, SampleList<TNode> right) => | ||
left._node == right._node; | ||
|
||
public static bool operator !=(SampleList<TNode> left, SampleList<TNode> right) => | ||
left._node != right._node; | ||
|
||
public bool Equals(SampleList<TNode> other) => _node == other._node; | ||
|
||
public override bool Equals(object? obj) => (obj is SampleList<TNode> list) && Equals(list); | ||
|
||
public override int GetHashCode() => _node != null ? _node.GetHashCode() : 0; | ||
|
||
public static implicit operator SampleList<TNode>(TNode node) => new(node); | ||
|
||
public static implicit operator SampleList<TNode>(SampleList<global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode> nodes) => new(nodes._node); | ||
|
||
public static implicit operator SampleList<global::Tsu.Trees.RedGreen.Sample.Internal.GreenNode>(SampleList<TNode> nodes) => new(nodes.Node); | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
...rees.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample/Internal/GreenRoot.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...es.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample/Internal/GreenWalker.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...rated/Tsu.Trees.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample/RedBase.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
...ted/Tsu.Trees.RedGreen/Tsu.Trees.RedGreen.SourceGenerator.Generator/Sample/RedWalker.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
Tsu.Trees.RedGreen/src/Templates/Internal/GreenList`1.Enumerable.sbn-cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters