예제 #1
0
        public override void OnError(JScriptExceptionEventArgs error) {
            var span = new SourceSpan(
                new SourceLocation(
                    error.Exception.Span.Start,
                    error.Error.StartLine,
                    error.Error.StartColumn
                ),
                new SourceLocation(
                    error.Exception.Span.End,
                    error.Error.EndLine,
                    error.Error.EndColumn
                )
            );
            var result = new ErrorResult(error.Error.Message, span, error.Error.ErrorCode);

            if (error.Error.IsError) {
                Errors.Add(result);
            } else {
                Warnings.Add(result);
            }
        }
예제 #2
0
        public override void OnError(JScriptExceptionEventArgs error)
        {
            var span = new SourceSpan(
                new SourceLocation(
                    error.Exception.Span.Start,
                    error.Error.StartLine,
                    error.Error.StartColumn
                ),
                new SourceLocation(
                    error.Exception.Span.End,
                    error.Error.EndLine,
                    error.Error.EndColumn
                )
            );
            var result = new ErrorResult(error.Error.Message, span, error.Error.ErrorCode);

            if (error.Error.IsError) {
                Errors.Add(result);
            } else {
                Warnings.Add(result);
            }
        }
 private bool ShouldIncludeWarning(ErrorResult error) {
     switch (error.ErrorCode) {
         case JSError.SemicolonInsertion:
         case JSError.ObjectLiteralKeyword:
         case JSError.OctalLiteralsDeprecated:
         case JSError.StatementBlockExpected:
         case JSError.MisplacedFunctionDeclaration:
         case JSError.KeywordUsedAsIdentifier:
         case JSError.SuspectAssignment:
         case JSError.UndeclaredFunction:
         case JSError.UndeclaredVariable:
             // TODO: Allow the user to control what warnings are reported?
             return false;
     }
     return true;
 }