Java Code Examples for com.google.javascript.jscomp.CheckLevel#ERROR

The following examples show how to use com.google.javascript.jscomp.CheckLevel#ERROR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonMLError.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public static JsonMLError make(JSError error, JsonMLAst ast) {
  // try to find the corresponding JsonML element
  // it is stored as line number of the JSError
  int n = error.lineNumber;
  JsonML element = ast.getElementPreOrder(n);

  ErrorLevel level = error.getDefaultLevel() == CheckLevel.ERROR
      ? ErrorLevel.COMPILATION_ERROR
      : ErrorLevel.COMPILATION_WARNING;

  return new JsonMLError(error.getType(), error.sourceName, element, 0,
      level, error.description);
}
 
Example 2
Source File: ComposeWarningsGuard.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
public CheckLevel level(JSError error) {
  for (WarningsGuard guard : guards) {
    CheckLevel newLevel = guard.level(error);
    if (newLevel != null) {
      if (demoteErrors && newLevel == CheckLevel.ERROR) {
        return CheckLevel.WARNING;
      }
      return newLevel;
    }
  }
  return null;
}
 
Example 3
Source File: BasicErrorManager.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void report(CheckLevel level, JSError error) {
  if (messages.add(new ErrorWithLevel(error, level))) {
    if (level == CheckLevel.ERROR) {
      errorCount++;
    } else if (level == CheckLevel.WARNING) {
      warningCount++;
    }
  }
}
 
Example 4
Source File: CheckMissingReturnTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected CompilerPass getProcessor(final Compiler compiler) {
  return new CombinedCompilerPass(compiler,
      new CheckMissingReturn(compiler, CheckLevel.ERROR));
}
 
Example 5
Source File: BasicErrorManagerTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
private ErrorWithLevel error(JSError e) {
  return new ErrorWithLevel(e, CheckLevel.ERROR);
}
 
Example 6
Source File: CheckUnreachableCodeTest.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected CompilerPass getProcessor(Compiler compiler) {
  return new CombinedCompilerPass(compiler,
      new CheckUnreachableCode(compiler, CheckLevel.ERROR));
}