-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Removal of Unnecessary Overloads + Extension method tweaks. #68
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,15 @@ internal class SyntaxDiagnosticInfo : DiagnosticInfo | |
| internal readonly int Offset; | ||
| internal readonly int Width; | ||
|
|
||
| internal SyntaxDiagnosticInfo(int offset, int width, ErrorCode code, params object[] args) | ||
|
|
||
| internal SyntaxDiagnosticInfo(int offset, int width, ErrorCode code, string arg) | ||
| : base(CSharp.MessageProvider.Instance, (int)code, arg) | ||
| { | ||
| Debug.Assert(width >= 0); | ||
| this.Offset = offset; | ||
| this.Width = width; | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: blank line separator |
||
| internal SyntaxDiagnosticInfo(int offset, int width, ErrorCode code, params object[] args) | ||
| : base(CSharp.MessageProvider.Instance, (int)code, args) | ||
| { | ||
| Debug.Assert(width >= 0); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,11 @@ namespace Microsoft.CodeAnalysis.CSharp | |
| internal sealed class XmlSyntaxDiagnosticInfo : SyntaxDiagnosticInfo | ||
| { | ||
| private readonly XmlParseErrorCode xmlErrorCode; | ||
|
|
||
| internal XmlSyntaxDiagnosticInfo(XmlParseErrorCode code, params object[] args) | ||
| internal XmlSyntaxDiagnosticInfo(XmlParseErrorCode code, string arg) | ||
| : this(0, 0, code, arg) | ||
| { | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Need a blank line separator here |
||
| internal XmlSyntaxDiagnosticInfo(XmlParseErrorCode code, params object[] args) | ||
| : this(0, 0, code, args) | ||
| { | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,38 +60,28 @@ protected SyntaxDiagnosticInfo[] GetErrors(int leadingTriviaWidth) | |
| return null; | ||
| } | ||
| } | ||
| protected void AddError(int position, int width, ErrorCode code, string arg ) | ||
| { | ||
| this.AddError(this.MakeError(position, width, code, arg)); | ||
| } | ||
|
|
||
| protected void AddError(int position, int width, ErrorCode code) | ||
| { | ||
| this.AddError(this.MakeError(position, width, code)); | ||
| } | ||
|
|
||
| protected void AddError(int position, int width, ErrorCode code, params object[] args) | ||
| protected void AddError(int position, int width, ErrorCode code, object[] args = null) | ||
| { | ||
| this.AddError(this.MakeError(position, width, code, args)); | ||
| } | ||
|
|
||
| protected void AddError(int position, int width, XmlParseErrorCode code, params object[] args) | ||
| protected void AddError(int position, int width, XmlParseErrorCode code, object[] args = null) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What problem does this change solve? |
||
| { | ||
| this.AddError(this.MakeError(position, width, code, args)); | ||
| } | ||
|
|
||
| protected void AddError(ErrorCode code) | ||
| { | ||
| this.AddError(MakeError(code)); | ||
| } | ||
|
|
||
| protected void AddError(ErrorCode code, params object[] args) | ||
| { | ||
| this.AddError(MakeError(code, args)); | ||
| } | ||
|
|
||
| protected void AddError(XmlParseErrorCode code) | ||
| { | ||
| this.AddError(MakeError(code)); | ||
| } | ||
|
|
||
| protected void AddError(XmlParseErrorCode code, params object[] args) | ||
| protected void AddError(XmlParseErrorCode code, object[] args = null) | ||
| { | ||
| this.AddError(MakeError(code, args)); | ||
| } | ||
|
|
@@ -109,19 +99,21 @@ protected void AddError(SyntaxDiagnosticInfo error) | |
| } | ||
| } | ||
|
|
||
| protected SyntaxDiagnosticInfo MakeError(int position, int width, ErrorCode code) | ||
| { | ||
| int offset = GetLexemeOffsetFromPosition(position); | ||
| return new SyntaxDiagnosticInfo(offset, width, code); | ||
| } | ||
|
|
||
| protected SyntaxDiagnosticInfo MakeError(int position, int width, ErrorCode code, params object[] args) | ||
| protected SyntaxDiagnosticInfo MakeError(int position, int width, ErrorCode code, string arg ) | ||
| { | ||
| int offset = GetLexemeOffsetFromPosition(position); | ||
| return new SyntaxDiagnosticInfo(offset, width, code, arg); | ||
| } | ||
|
|
||
|
|
||
| protected SyntaxDiagnosticInfo MakeError(int position, int width, ErrorCode code, object[] args = null) | ||
| { | ||
| int offset = GetLexemeOffsetFromPosition(position); | ||
| return new SyntaxDiagnosticInfo(offset, width, code, args); | ||
| return new SyntaxDiagnosticInfo( offset, width, code, args); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: extra space |
||
|
|
||
| protected XmlSyntaxDiagnosticInfo MakeError(int position, int width, XmlParseErrorCode code, params object[] args) | ||
| protected XmlSyntaxDiagnosticInfo MakeError(int position, int width, XmlParseErrorCode code, object[] args = null) | ||
| { | ||
| int offset = GetLexemeOffsetFromPosition(position); | ||
| return new XmlSyntaxDiagnosticInfo(offset, width, code, args); | ||
|
|
@@ -132,24 +124,23 @@ private int GetLexemeOffsetFromPosition(int position) | |
| return position >= TextWindow.LexemeStartPosition ? position - TextWindow.LexemeStartPosition : position; | ||
| } | ||
|
|
||
| protected static SyntaxDiagnosticInfo MakeError(ErrorCode code) | ||
| { | ||
| return new SyntaxDiagnosticInfo(code); | ||
| } | ||
| protected static SyntaxDiagnosticInfo MakeError(ErrorCode code, string arg) | ||
| { | ||
| return new SyntaxDiagnosticInfo(code, arg); | ||
| } | ||
|
|
||
| protected static SyntaxDiagnosticInfo MakeError(ErrorCode code, params object[] args) | ||
| protected static SyntaxDiagnosticInfo MakeError(ErrorCode code, object[] args = null) | ||
| { | ||
| return new SyntaxDiagnosticInfo(code, args); | ||
| } | ||
|
|
||
| protected static XmlSyntaxDiagnosticInfo MakeError(XmlParseErrorCode code) | ||
| { | ||
| return new XmlSyntaxDiagnosticInfo(0, 0, code); | ||
| } | ||
|
|
||
| protected static XmlSyntaxDiagnosticInfo MakeError(XmlParseErrorCode code, params object[] args) | ||
| protected static XmlSyntaxDiagnosticInfo MakeError(XmlParseErrorCode code, object[] args = null) | ||
| { | ||
| return new XmlSyntaxDiagnosticInfo(0, 0, code, args); | ||
| } | ||
| protected static XmlSyntaxDiagnosticInfo MakeError(XmlParseErrorCode code, string arg) | ||
| { | ||
| return new XmlSyntaxDiagnosticInfo(0, 0, code, arg); | ||
| } | ||
| } | ||
| } | ||
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.
The previous error said it was a binary operator while this error states that it is a unary operator.