Debian Codegraph @

src/com/google/javascript/jscomp/parsing/NullErrorReporter.java

raw symbols SCIP
1 /*
2 * Copyright 2009 The Closure Compiler Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.google.javascript.jscomp.parsing;
18
19 import com.google.javascript.rhino.ErrorReporter;
20
21 /**
22 * An error reporter which consumes all calls and performs no actions.
23 *
24 */
25 public abstract class NullErrorReporter {
26 private NullErrorReporter() {
27 }
28
29 public void error(String message, String sourceName, int line,
30 int lineOffset) {
31 }
32
33 public void warning(String message, String sourceName, int line,
34 int lineOffset) {
35 }
36
37 public static ErrorReporter forOldRhino() {
38 return new OldRhinoNullReporter();
39 }
40
41 public static com.google.javascript.rhino.head.ErrorReporter
42 forNewRhino() {
43 return new NewRhinoNullReporter();
44 }
45
46 private static class NewRhinoNullReporter extends NullErrorReporter
47 implements com.google.javascript.rhino.head.ErrorReporter {
48 @Override
49 public com.google.javascript.rhino.head.EvaluatorException
50 runtimeError(String message, String sourceName, int line,
51 String lineSource, int lineOffset) {
52 return new com.google.javascript.rhino.head.EvaluatorException(
53 message);
54 }
55
56 @Override
57 public void error(String message, String sourceName, int line,
58 String sourceLine, int lineOffset) {
59 super.error(message, sourceName, line, lineOffset);
60 }
61
62 @Override
63 public void warning(String message, String sourceName, int line,
64 String sourceLine, int lineOffset) {
65 super.warning(message, sourceName, line, lineOffset);
66 }
67 }
68
69 private static class OldRhinoNullReporter extends NullErrorReporter
70 implements ErrorReporter {
71 }
72 }