| Index: compiler/java/com/google/dart/compiler/parser/DartParser.java
|
| diff --git a/compiler/java/com/google/dart/compiler/parser/DartParser.java b/compiler/java/com/google/dart/compiler/parser/DartParser.java
|
| index cfc5fbfd2b33688ec86bc198dfb940e25a659a3d..4e5892ba64d95ae6bb24e907dd5cace3062a9d48 100644
|
| --- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
|
| +++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
|
| @@ -11,6 +11,7 @@ import com.google.dart.compiler.DartCompilationError;
|
| import com.google.dart.compiler.DartCompilerListener;
|
| import com.google.dart.compiler.DartSource;
|
| import com.google.dart.compiler.ErrorCode;
|
| +import com.google.dart.compiler.ErrorSeverity;
|
| import com.google.dart.compiler.InternalCompilerException;
|
| import com.google.dart.compiler.LibrarySource;
|
| import com.google.dart.compiler.PackageLibraryManager;
|
| @@ -370,6 +371,7 @@ public class DartParser extends CompletionHooksParserBase {
|
| DartParserCommentsHelper.addComments(unit, source, sourceCode, commentLocs);
|
| }
|
| // done
|
| + unit.setHasParseErrors(errorCount != 0);
|
| return done(unit);
|
| } catch (StringInterpolationParseError exception) {
|
| throw new InternalCompilerException("Failed to parse " + source.getUri(), exception);
|
| @@ -5357,8 +5359,11 @@ public class DartParser extends CompletionHooksParserBase {
|
| *
|
| * @return whether the current error should be reported
|
| */
|
| - private boolean incErrorCount() {
|
| - errorCount++;
|
| + private boolean incErrorCount(ErrorCode errorCode) {
|
| + // count only errors, but not warnings (such as "abstract")
|
| + if (errorCode.getErrorSeverity() == ErrorSeverity.ERROR) {
|
| + errorCount++;
|
| + }
|
|
|
| if (errorCount >= MAX_DEFAULT_ERRORS) {
|
| if (errorCount == MAX_DEFAULT_ERRORS) {
|
| @@ -5383,7 +5388,7 @@ public class DartParser extends CompletionHooksParserBase {
|
| @Override
|
| protected void reportError(int position, ErrorCode errorCode, Object... arguments) {
|
| // TODO(devoncarew): we're not correctly identifying dart:html as a core library
|
| - if (incErrorCount()) {
|
| + if (incErrorCount(errorCode)) {
|
| super.reportError(position, errorCode, arguments);
|
| }
|
| }
|
| @@ -5391,13 +5396,13 @@ public class DartParser extends CompletionHooksParserBase {
|
| @Override
|
| protected void reportErrorAtPosition(int startPosition, int endPosition,
|
| ErrorCode errorCode, Object... arguments) {
|
| - if (incErrorCount()) {
|
| + if (incErrorCount(errorCode)) {
|
| super.reportErrorAtPosition(startPosition, endPosition, errorCode, arguments);
|
| }
|
| }
|
|
|
| private void reportError(DartCompilationError dartError) {
|
| - if (incErrorCount()) {
|
| + if (incErrorCount(dartError.getErrorCode())) {
|
| ctx.error(dartError);
|
| errorHistory.add(dartError.hashCode());
|
| }
|
|
|