-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ca63c1
commit 219d6df
Showing
12 changed files
with
288 additions
and
166 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
17 changes: 17 additions & 0 deletions
17
src/Core/NetPad.Runtime/CodeAnalysis/CodeAnalysisExtensions.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,17 @@ | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
|
||
namespace NetPad.CodeAnalysis; | ||
|
||
public static class CodeAnalysisExtensions | ||
{ | ||
/// <summary> | ||
/// Gets the namespace value specified by the using directive. | ||
/// </summary> | ||
public static string GetNamespaceString(this UsingDirectiveSyntax node) | ||
{ | ||
return string.Join(' ', | ||
node.ChildNodes() | ||
.Select(x => x.NormalizeWhitespace().ToFullString())); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,26 +1,18 @@ | ||
namespace NetPad.DotNet; | ||
|
||
public abstract class SourceCodeElement : ValueObject | ||
public abstract record SourceCodeElement<TValue>(TValue Value) | ||
{ | ||
protected bool _valueChanged; | ||
|
||
public TValue Value { get; private set; } = Value; | ||
|
||
public virtual bool ValueChanged() => _valueChanged; | ||
|
||
public abstract string ToCodeString(); | ||
} | ||
|
||
public abstract class SourceCodeElement<TValue>(TValue value) : SourceCodeElement | ||
{ | ||
public TValue Value { get; private set; } = value; | ||
|
||
public void Update(TValue value) | ||
public void Update(TValue newValue) | ||
{ | ||
Value = value; | ||
Value = newValue; | ||
_valueChanged = true; | ||
} | ||
|
||
protected override IEnumerable<object?> GetEqualityComponents() | ||
{ | ||
yield return Value; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.