Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix null references #81

wants to merge 2 commits into from

Conversation

IronicJuice
Copy link
Collaborator

Removed _src from TokenStream.cs as it was never assigned or used.

Made the out Token on line 124 of the parser nullable.

Copy link
Owner

@frederikja163 frederikja163 left a 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.

{
paramChildren.Add(ParseParameterIdentifier(stream));
throw new Exception("Parameter are expected to be separated by space");
}
Copy link
Owner

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;
Copy link
Owner

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.

@IronicJuice
Copy link
Collaborator Author

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.

@frederikja163
Copy link
Owner

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.

@IronicJuice
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants