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

Unified Diff: pkg/csslib/lib/src/messages.dart

Issue 426053003: Use source_span rather than source_maps in csslib. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add CHANGELOG Created 6 years, 5 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 | « pkg/csslib/lib/parser.dart ('k') | pkg/csslib/lib/src/token.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/csslib/lib/src/messages.dart
diff --git a/pkg/csslib/lib/src/messages.dart b/pkg/csslib/lib/src/messages.dart
index 6c2ecbf6ff25525368eed0bd00876f8b23a2c65c..92f8451b7ab2d9b44266929c5143872e088c898d 100644
--- a/pkg/csslib/lib/src/messages.dart
+++ b/pkg/csslib/lib/src/messages.dart
@@ -5,7 +5,7 @@
library csslib.src.messages;
import 'package:logging/logging.dart' show Level;
-import 'package:source_maps/span.dart' show Span;
+import 'package:source_span/source_span.dart';
import 'options.dart';
@@ -43,16 +43,16 @@ final Map<Level, String> _ERROR_LABEL = (() {
class Message {
final Level level;
final String message;
- final Span span;
+ final SourceSpan span;
final bool useColors;
- Message(this.level, this.message, {Span span, bool useColors: false})
+ Message(this.level, this.message, {SourceSpan span, bool useColors: false})
: this.span = span, this.useColors = useColors;
String toString() {
var output = new StringBuffer();
bool colors = useColors && _ERROR_COLORS.containsKey(level);
- var levelColor = _ERROR_COLORS[level];
+ var levelColor = colors ? _ERROR_COLORS[level] : null;
if (colors) output.write(levelColor);
output..write(_ERROR_LABEL[level])..write(' ');
if (colors) output.write(NO_COLOR);
@@ -61,8 +61,7 @@ class Message {
output.write(message);
} else {
output.write('on ');
- output.write(span.getLocationMessage(message, useColors: colors,
- color: levelColor));
+ output.write(span.message(message, color: levelColor));
}
return output.toString();
@@ -87,7 +86,7 @@ class Messages {
: options = options != null ? options : new PreprocessorOptions();
/** Report a compile-time CSS error. */
- void error(String message, Span span) {
+ void error(String message, SourceSpan span) {
var msg = new Message(Level.SEVERE, message, span: span,
useColors: options.useColors);
@@ -97,7 +96,7 @@ class Messages {
}
/** Report a compile-time CSS warning. */
- void warning(String message, Span span) {
+ void warning(String message, SourceSpan span) {
if (options.warningsAsErrors) {
error(message, span);
} else {
@@ -109,7 +108,7 @@ class Messages {
}
/** Report and informational message about what the compiler is doing. */
- void info(String message, Span span) {
+ void info(String message, SourceSpan span) {
var msg = new Message(Level.INFO, message, span: span,
useColors: options.useColors);
« no previous file with comments | « pkg/csslib/lib/parser.dart ('k') | pkg/csslib/lib/src/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698