-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example converter from json to ast #207
base: main
Are you sure you want to change the base?
Conversation
@sebastienros @lahma |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the general idea is sound. Supporting new .NET feels like a good choice, of course until someone complaints about not having this on their Windows XP or something.
@@ -7,7 +7,7 @@ | |||
<NeutralLanguage>en-US</NeutralLanguage> | |||
<BuildNumber Condition="'$(BuildNumber)' == ''">0</BuildNumber> | |||
<Authors>Sebastien Ros</Authors> | |||
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks> | |||
<TargetFrameworks>net461;netstandard2.0;net5.0</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can now use net6.0 too
|
||
namespace Esprima.Utils | ||
{ | ||
public class AstJsonConverter : JsonConverter<object> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we keep this sealed until someone asks for it to be opened, generally I guess we should be able to reproduce the original JSON AST for this to be "feature-complete".
|
||
var op = new JsonSerializerOptions(); | ||
op.Converters.Add(new AstJsonConverter()); | ||
var ast = JsonSerializer.Deserialize<Node>(json, op); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the result be asserted? some acceptance criteria library probably could help here for text matching / diffing.
fix for #157