-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for many new c# LST(#26)
- Loading branch information
Showing
214 changed files
with
10,783 additions
and
1,087 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
882 changes: 522 additions & 360 deletions
882
Rewrite/src/Rewrite.CSharp/Parser/CSharpParserVisitor.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using Rewrite.RewriteJava.Tree; | ||
|
||
namespace Rewrite.RewriteCSharp.Tree; | ||
|
||
[SuppressMessage("ReSharper", "InconsistentNaming")] | ||
[SuppressMessage("ReSharper", "PossibleUnintendedReferenceComparison")] | ||
[SuppressMessage("ReSharper", "InvertIf")] | ||
[SuppressMessage("ReSharper", "RedundantExtendsListEntry")] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global")] | ||
[SuppressMessage("ReSharper", "RedundantNameQualifier")] | ||
public partial interface Cs : J | ||
{ | ||
partial class AliasQualifiedName | ||
{ | ||
public bool Equals(Core.Marker.Marker? other) | ||
{ | ||
return other is AliasQualifiedName otherAlias && otherAlias.Alias.Equals(this.Alias) && otherAlias.Name.Equals(this.Name); | ||
} | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
Rewrite/src/Rewrite.CSharp/Tree/AliasQualifiedName.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 |
---|---|---|
@@ -0,0 +1,136 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
#nullable enable | ||
#pragma warning disable CS0108 // 'member1' hides inherited member 'member2'. Use the new keyword if hiding was intended. | ||
#pragma warning disable CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes). | ||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Rewrite.Core; | ||
using Rewrite.Core.Marker; | ||
using FileAttributes = Rewrite.Core.FileAttributes; | ||
using Rewrite.RewriteJava.Tree; | ||
|
||
namespace Rewrite.RewriteCSharp.Tree; | ||
|
||
[SuppressMessage("ReSharper", "InconsistentNaming")] | ||
[SuppressMessage("ReSharper", "PossibleUnintendedReferenceComparison")] | ||
[SuppressMessage("ReSharper", "InvertIf")] | ||
[SuppressMessage("ReSharper", "RedundantExtendsListEntry")] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global")] | ||
[SuppressMessage("ReSharper", "RedundantNameQualifier")] | ||
public partial interface Cs : J | ||
{ | ||
/// <summary> | ||
/// Represents a C# alias qualified name, which uses an extern alias to qualify a name. | ||
/// <br/> | ||
/// For example: | ||
/// <code> | ||
/// // Using LibA to qualify TypeName | ||
/// LibA::TypeName | ||
/// // Using LibB to qualify namespace | ||
/// LibB::System.Collections | ||
/// </code> | ||
/// </summary> | ||
#if DEBUG_VISITOR | ||
[DebuggerStepThrough] | ||
#endif | ||
public partial class AliasQualifiedName( | ||
Guid id, | ||
Space prefix, | ||
Markers markers, | ||
JRightPadded<J.Identifier> alias, | ||
Expression name | ||
) : Cs, TypeTree, Expression, Rewrite.Core.Marker.Marker, Expression<AliasQualifiedName>, TypedTree<AliasQualifiedName>, J<AliasQualifiedName>, TypeTree<AliasQualifiedName>, MutableTree<AliasQualifiedName> | ||
{ | ||
[NonSerialized] private WeakReference<PaddingHelper>? _padding; | ||
|
||
public PaddingHelper Padding | ||
{ | ||
get | ||
{ | ||
PaddingHelper? p; | ||
if (_padding == null) | ||
{ | ||
p = new PaddingHelper(this); | ||
_padding = new WeakReference<PaddingHelper>(p); | ||
} | ||
else | ||
{ | ||
_padding.TryGetTarget(out p); | ||
if (p == null || p.T != this) | ||
{ | ||
p = new PaddingHelper(this); | ||
_padding.SetTarget(p); | ||
} | ||
} | ||
return p; | ||
} | ||
} | ||
|
||
public J? AcceptCSharp<P>(CSharpVisitor<P> v, P p) | ||
{ | ||
return v.VisitAliasQualifiedName(this, p); | ||
} | ||
|
||
public Guid Id => id; | ||
|
||
public AliasQualifiedName WithId(Guid newId) | ||
{ | ||
return newId == id ? this : new AliasQualifiedName(newId, prefix, markers, _alias, name); | ||
} | ||
public Space Prefix => prefix; | ||
|
||
public AliasQualifiedName WithPrefix(Space newPrefix) | ||
{ | ||
return newPrefix == prefix ? this : new AliasQualifiedName(id, newPrefix, markers, _alias, name); | ||
} | ||
public Markers Markers => markers; | ||
|
||
public AliasQualifiedName WithMarkers(Markers newMarkers) | ||
{ | ||
return ReferenceEquals(newMarkers, markers) ? this : new AliasQualifiedName(id, prefix, newMarkers, _alias, name); | ||
} | ||
private readonly JRightPadded<J.Identifier> _alias = alias; | ||
public J.Identifier Alias => _alias.Element; | ||
|
||
public AliasQualifiedName WithAlias(J.Identifier newAlias) | ||
{ | ||
return Padding.WithAlias(_alias.WithElement(newAlias)); | ||
} | ||
public Expression Name => name; | ||
|
||
public AliasQualifiedName WithName(Expression newName) | ||
{ | ||
return ReferenceEquals(newName, name) ? this : new AliasQualifiedName(id, prefix, markers, _alias, newName); | ||
} | ||
public sealed record PaddingHelper(Cs.AliasQualifiedName T) | ||
{ | ||
public JRightPadded<J.Identifier> Alias => T._alias; | ||
|
||
public Cs.AliasQualifiedName WithAlias(JRightPadded<J.Identifier> newAlias) | ||
{ | ||
return T._alias == newAlias ? T : new Cs.AliasQualifiedName(T.Id, T.Prefix, T.Markers, newAlias, T.Name); | ||
} | ||
|
||
} | ||
|
||
#if DEBUG_VISITOR | ||
[DebuggerStepThrough] | ||
#endif | ||
public bool Equals(Rewrite.Core.Tree? other) | ||
{ | ||
return other is AliasQualifiedName && other.Id == Id; | ||
} | ||
#if DEBUG_VISITOR | ||
[DebuggerStepThrough] | ||
#endif | ||
public override int GetHashCode() | ||
{ | ||
return Id.GetHashCode(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
#nullable enable | ||
#pragma warning disable CS0108 // 'member1' hides inherited member 'member2'. Use the new keyword if hiding was intended. | ||
#pragma warning disable CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes). | ||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Rewrite.Core; | ||
using Rewrite.Core.Marker; | ||
using FileAttributes = Rewrite.Core.FileAttributes; | ||
using Rewrite.RewriteJava.Tree; | ||
|
||
namespace Rewrite.RewriteCSharp.Tree; | ||
|
||
[SuppressMessage("ReSharper", "InconsistentNaming")] | ||
[SuppressMessage("ReSharper", "PossibleUnintendedReferenceComparison")] | ||
[SuppressMessage("ReSharper", "InvertIf")] | ||
[SuppressMessage("ReSharper", "RedundantExtendsListEntry")] | ||
[SuppressMessage("ReSharper", "UnusedMember.Global")] | ||
[SuppressMessage("ReSharper", "RedundantNameQualifier")] | ||
public partial interface Cs : J | ||
{ | ||
#if DEBUG_VISITOR | ||
[DebuggerStepThrough] | ||
#endif | ||
public partial class ArrayType( | ||
Guid id, | ||
Space prefix, | ||
Markers markers, | ||
TypeTree? typeExpression, | ||
IList<J.ArrayDimension> dimensions, | ||
JavaType? type | ||
) : Cs, Expression, TypeTree, Expression<ArrayType>, TypedTree<ArrayType>, J<ArrayType>, TypeTree<ArrayType>, MutableTree<ArrayType> | ||
{ | ||
public J? AcceptCSharp<P>(CSharpVisitor<P> v, P p) | ||
{ | ||
return v.VisitArrayType(this, p); | ||
} | ||
|
||
public Guid Id => id; | ||
|
||
public ArrayType WithId(Guid newId) | ||
{ | ||
return newId == id ? this : new ArrayType(newId, prefix, markers, typeExpression, dimensions, type); | ||
} | ||
public Space Prefix => prefix; | ||
|
||
public ArrayType WithPrefix(Space newPrefix) | ||
{ | ||
return newPrefix == prefix ? this : new ArrayType(id, newPrefix, markers, typeExpression, dimensions, type); | ||
} | ||
public Markers Markers => markers; | ||
|
||
public ArrayType WithMarkers(Markers newMarkers) | ||
{ | ||
return ReferenceEquals(newMarkers, markers) ? this : new ArrayType(id, prefix, newMarkers, typeExpression, dimensions, type); | ||
} | ||
public TypeTree? TypeExpression => typeExpression; | ||
|
||
public ArrayType WithTypeExpression(TypeTree? newTypeExpression) | ||
{ | ||
return ReferenceEquals(newTypeExpression, typeExpression) ? this : new ArrayType(id, prefix, markers, newTypeExpression, dimensions, type); | ||
} | ||
public IList<J.ArrayDimension> Dimensions => dimensions; | ||
|
||
public ArrayType WithDimensions(IList<J.ArrayDimension> newDimensions) | ||
{ | ||
return newDimensions == dimensions ? this : new ArrayType(id, prefix, markers, typeExpression, newDimensions, type); | ||
} | ||
public JavaType? Type => type; | ||
|
||
public ArrayType WithType(JavaType? newType) | ||
{ | ||
return newType == type ? this : new ArrayType(id, prefix, markers, typeExpression, dimensions, newType); | ||
} | ||
#if DEBUG_VISITOR | ||
[DebuggerStepThrough] | ||
#endif | ||
public bool Equals(Rewrite.Core.Tree? other) | ||
{ | ||
return other is ArrayType && other.Id == Id; | ||
} | ||
#if DEBUG_VISITOR | ||
[DebuggerStepThrough] | ||
#endif | ||
public override int GetHashCode() | ||
{ | ||
return Id.GetHashCode(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.