/// <summary>
 ///     Dead code was detected, but it was not an error because it was inside a function with a void return type.
 /// </summary>
 /// <param name="location">The location in the source code.</param>
 /// <param name="currentFunction">The signature of the function that dead code was detected in.</param>
 /// <param name="deadSegment">An object describing the range of code that is considered to be dead.</param>
 public virtual void DeadCodeDetected(LSLSourceCodeRange location, ILSLFunctionSignature currentFunction,
                                      ILSLDeadCodeSegment deadSegment)
 {
     if (deadSegment.SourceRange.IsSingleLine)
     {
         OnWarning(location, "Unreachable code detected in function \"" + currentFunction.Name + "\".");
     }
     else
     {
         OnWarning(location,
                   string.Format(
                       "Unreachable code detected in function \"" + currentFunction.Name +
                       "\" between lines {0} and {1}.",
                       MapLineNumber(deadSegment.SourceRange.LineStart),
                       MapLineNumber(deadSegment.SourceRange.LineEnd)));
     }
 }
Example #2
0
 void ILSLSyntaxWarningListener.DeadCodeDetected(LSLSourceCodeRange location,
                                                 ILSLEventSignature currentEvent, ILSLDeadCodeSegment deadSegment)
 {
     _warningActionQueue.Enqueue(location.StartIndex,
                                 () => SyntaxWarningListener.DeadCodeDetected(location, currentEvent, deadSegment));
 }
Example #3
0
 void ILSLSyntaxErrorListener.DeadCodeAfterReturnPath(LSLSourceCodeRange location,
                                                      ILSLFunctionSignature inFunction, ILSLDeadCodeSegment deadSegment)
 {
     _errorActionQueue.Enqueue(location.StartIndex,
                               () => SyntaxErrorListener.DeadCodeAfterReturnPath(location, inFunction, deadSegment));
 }