-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix null references #81
base: main
Are you sure you want to change the base?
Conversation
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 this PR is a bit misguided as there are two seperate changes in one PR (why?) and i personally disagree with both of them. I would be happy to discuss further though. But i have listed my arguments for now.
SudoScript.Core/Parser.cs
Outdated
{ | ||
paramChildren.Add(ParseParameterIdentifier(stream)); | ||
throw new Exception("Parameter are expected to be separated by space"); | ||
} |
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.
Not a fan of this change. Before it was an early return as a validation check. Now you have introduced an extra level of nesting across the entire function. It just reads worse and is less managable Imo.
@@ -47,8 +47,6 @@ public sealed class TokenStream : IDisposable | |||
|
|||
private char? _carry; | |||
|
|||
private readonly string _src; |
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.
Pretty sure this was supposed to be used to exceptions. I would probably rather that we implement those exceptions than remove the property.
I think it's fine to freeze this pull request for now, until the _src utility is implemented. The main reason for wanting to fix these now, was for performance tools to function properly. Since this is happening on a separate branch that likely won't be pulled anyways, I think it's fine to say that these changes need a little more work put in to them before merging. |
Why would you need this to be nullable for performance tools? You could make an argument it should be nullable. But i dont see why that by itself wouldnt fix it. |
BenchmarkDotNet won't run with possible null references in the code. I have these changes on a separate branch that won't be merged anyways. |
Removed _src from TokenStream.cs as it was never assigned or used.
Made the out Token on line 124 of the parser nullable.