Chromium Code Reviews| Index: pkg/compiler/lib/src/compiler.dart |
| diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart |
| index 085a25f71bf1793e0363e698336f14bce762d49f..86f7ab7fbc2e66ae71b03fbc496475431d707c7a 100644 |
| --- a/pkg/compiler/lib/src/compiler.dart |
| +++ b/pkg/compiler/lib/src/compiler.dart |
| @@ -346,7 +346,8 @@ abstract class Compiler { |
| ConstructorElement stringEnvironment; |
| /// Tracks elements with compile-time errors. |
| - final Set<Element> elementsWithCompileTimeErrors = new Set<Element>(); |
| + final Map<Element, DiagnosticMessage> elementsWithCompileTimeErrors = |
| + new Map<Element, DiagnosticMessage>(); |
| fromEnvironment(String name) => null; |
| @@ -408,16 +409,7 @@ abstract class Compiler { |
| static const int PHASE_COMPILING = 3; |
| int phase; |
| - bool compilationFailedInternal = false; |
| - |
| - bool get compilationFailed => compilationFailedInternal; |
| - |
| - void set compilationFailed(bool value) { |
| - if (value) { |
| - elementsWithCompileTimeErrors.add(currentElement); |
| - } |
| - compilationFailedInternal = value; |
| - } |
| + bool compilationFailed = false; |
| /// Set by the backend if real reflection is detected in use of dart:mirrors. |
| bool disableTypeInferenceForMirrors = false; |
| @@ -1423,8 +1415,13 @@ abstract class Compiler { |
| backend.forgetElement(element); |
| } |
| + /// Returns [true] if a compile-time error has been reported for element. |
| + /// |
| + /// This function should only be called when |
| + /// [generateCodeWithCompileTimeErrors] is true. |
| bool elementHasCompileTimeError(Element element) { |
| - return elementsWithCompileTimeErrors.contains(element); |
| + assert(generateCodeWithCompileTimeErrors); |
|
Johnni Winther
2015/12/14 11:31:20
Change the approach to only store message when [ge
sigurdm
2015/12/14 12:07:43
Done.
|
| + return elementsWithCompileTimeErrors.containsKey(element); |
| } |
| EventSink<String> outputProvider(String name, String extension) { |
| @@ -1693,6 +1690,7 @@ class _CompilerDiagnosticReporter extends DiagnosticReporter { |
| kind == api.Diagnostic.CRASH || |
| (options.fatalWarnings && |
| kind == api.Diagnostic.WARNING)) { |
| + compiler.elementsWithCompileTimeErrors[currentElement] = message; |
| compiler.compilationFailed = true; |
| } |
| compiler.reportDiagnostic(message, infos, kind); |