Skip to content

Commit

Permalink
Adds an obsolete notice for DMParser calling base.Error()
Browse files Browse the repository at this point in the history
DMParser should be emitting actual error codes and avoiding throwing when possible (so as to minimize code-skipping).
  • Loading branch information
Altoids1 committed Aug 7, 2023
1 parent 3c82f94 commit e3a78a2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions DMCompiler/Compiler/DM/DMParserHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ protected bool Error(WarningCode code, string message) {
return level == ErrorLevel.Error;
}

/// <inheritdoc cref="Parser{SourceType}.Error(string, bool)"/>
[Obsolete("This is not a desirable way for DMParser to emit an error, as errors should emit an error code and not cause unnecessary throws. Use DMParser's overrides of this method, instead.")]
new protected void Error(string message, bool throwException = true) {
base.Error(message, throwException);
}

protected bool PeekDelimiter() {
return Current().Type == TokenType.Newline || Current().Type == TokenType.DM_Semicolon;
}
Expand Down

0 comments on commit e3a78a2

Please sign in to comment.