Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: dart/lib/compiler/compiler.dart

Issue 10579015: Update dart2js to use diagnostic kinds. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/apiimpl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/compiler.dart
diff --git a/dart/lib/compiler/compiler.dart b/dart/lib/compiler/compiler.dart
index 29f1d85e1a884be9f7bc705cf01cc96fbcc87092..3a15caf59805a600664f56a894ee3cc784a6d7e5 100644
--- a/dart/lib/compiler/compiler.dart
+++ b/dart/lib/compiler/compiler.dart
@@ -29,7 +29,7 @@ typedef Future<String> ReadStringFromUri(Uri uri);
* diagnostic it is.
*/
typedef void DiagnosticHandler(Uri uri, int begin, int end,
- String message, var kind);
+ String message, Diagnostic kind);
/**
* Returns a future that completes to [script] compiled to JavaScript. If
@@ -71,34 +71,34 @@ class Diagnostic {
* This means that the compiler can generate code that when executed
* terminates execution.
*/
- static final Diagnostic ERROR = const Diagnostic(1);
+ static final Diagnostic ERROR = const Diagnostic(1, 'error');
/**
* A warning as identified by the "Dart Programming Language
* Specification" [http://www.dartlang.org/docs/spec/].
*/
- static final Diagnostic WARNING = const Diagnostic(2);
+ static final Diagnostic WARNING = const Diagnostic(2, 'warning');
/**
* Any other warning that is not covered by [WARNING].
*/
- static final Diagnostic LINT = const Diagnostic(4);
+ static final Diagnostic LINT = const Diagnostic(4, 'lint');
/**
* Informational messages.
*/
- static final Diagnostic INFO = const Diagnostic(8);
+ static final Diagnostic INFO = const Diagnostic(8, 'info');
/**
* Informational messages that shouldn't be printed unless
* explicitly requested by the user of a compiler.
*/
- static final Diagnostic VERBOSE_INFO = const Diagnostic(16);
+ static final Diagnostic VERBOSE_INFO = const Diagnostic(16, 'verbose info');
/**
* An internal error in the compiler.
*/
- static final Diagnostic CRASH = const Diagnostic(32);
+ static final Diagnostic CRASH = const Diagnostic(32, 'crash');
/**
* An [int] representation of this kind. The ordinals are designed
@@ -107,8 +107,15 @@ class Diagnostic {
final int ordinal;
/**
+ * The name of this kind.
+ */
+ final String name;
+
+ /**
* This constructor is not private to support user-defined
* diagnostic kinds.
*/
- const Diagnostic(this.ordinal);
+ const Diagnostic(this.ordinal, this.name);
+
+ String toString() => name;
}
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/apiimpl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698